Updated READMEs and added comments to compiler.py
This commit is contained in:
parent
5c558eb84a
commit
c66bed3dee
@ -10,7 +10,7 @@ The emulator / debugger...
|
||||
|
||||
### compiler.py / compiler_beta.py
|
||||
This compiler compiles from 'tronScript' to a binary save-state of the emulator. It has been designed with the main priority of being as easy as possible to compile. Usability was ~~maybe~~ impacted by this decisio.
|
||||
I forgot, what the difference between normal and beta is...
|
||||
compiler_beta does not work, but contains code to add stack / push / pop functionality to tronScript.
|
||||
More information about tronScript can be found in TronScript_README.txt
|
||||
|
||||
|
||||
|
@ -3,9 +3,10 @@ tronScript is a stupid and pretty assembly-like low level language for my asmTro
|
||||
|
||||
Available Commands:
|
||||
|
||||
newVar [var] - Initializes new var; not needed most of the time:
|
||||
newVar [name] - Initializes new var; not needed most of the time:
|
||||
Compiler automatically initializes new vars when used,
|
||||
so this is no longer necessary...
|
||||
newArray [name] [len] - Initializes a new array with length len.
|
||||
jumpMark [jumpMark name] - Sets an JumpMark to jump to using the "jump" command
|
||||
jump [jumpMark name] - Jumps to an JumpMark
|
||||
getVarAddress [var A] [var B] - Saves [var A]'s memory-address into [var B]
|
||||
@ -46,6 +47,3 @@ function [funcName] { - Defines function [funcName] with code
|
||||
} to store the jump-back-address... :P
|
||||
Fun Fact: Pascal used to do a similar thing, which is why you couldn't
|
||||
do recursion in early versions of Pascal.
|
||||
|
||||
Q: There are some command ś that operate on an array. How do I initialize one?
|
||||
A: Good Question. Do you know, what defines a good question? That you dont have an answer to it...
|
||||
|
@ -38,6 +38,8 @@ def compile(cmd,par,memAddr):
|
||||
print("Creating array '"+par[0].upper()+"' at memory-space "+padBin(len(varRec)+(2**8)/2)+" - "+padBin(len(varRec)+int(par[1])+(2**8)/2))
|
||||
for i in range(int(par[1])):
|
||||
varRec["array_"par[0].upper()+"["+i+"]"] = len(varRec)+(2**8)/2
|
||||
# Yes, we implement array by just having variables named array_{name}[0] to array_{name}[n]; deal with it!
|
||||
# (But they mapped into memory like you would expect; so pointer arithmetic should be possible...)
|
||||
elif cmd=="jumpMark": # creates a jumpMark and saves current adress in the DB for later use by the jump-name-replacement
|
||||
print("Creating jumpMark '"+par[0].upper()+"' at memory-address "+padBin(memAddr))
|
||||
jumpMark[par[0].upper()] = memAddr
|
||||
|
Loading…
Reference in New Issue
Block a user