Link Index
Pages
Number
Variable
Temp Pool
Virtual Machine
Chunks
Comments
Call Conventions
Expressions
Programs
Diagrams
Memory Layout
Stack Routine Call Layout
Chunk Layout
Commands
put
input
print
putchr
lab
jump
sub
return
pull
push
new
static
free
use
asm
Instructions
"set"
"add"
"sub"
"shg"
"shs"
"lor"
"and"
"xor"
"not"
"lDA"
"lDR"
"sAD"
"sRD"
"lPA"
"lPR"
"sAP"
"sRP"
"out"
"inp"
"lab"
"got"
"jm0"
"jmA"
"jmG"
"jmL"
"jmS"
"ret"
"pha"
"pla"
"brk"
"clr"
"putstr"
Grammar
program ::= unit*
unit ::= ( statement eos | comment ) ("\n"*)
eos ::= ";"
comment ::= /".+?/
statement ::=
put |
input |
print |
putchr |
lab |
jump |
sub |
return |
pull |
push |
new |
free |
static |
use |
asm
put ::= "put" (
var "=" expr |
var "<-" expr |
expr "->" expr )
input ::= "input" var
print ::= "print" expr
putchr ::= "putchr" expr
lab ::= "lab" label
jump ::= "jump" label [cond]
sub ::= "sub" label [cond]
return ::= "return"
pull ::= "pull" var
push ::= "push" expr
new ::= "new" (expr | string) var
static ::= "static" (expr | string) var
free ::= "free" var
use ::= "use" string
asm ::= "asm" "'" (inst ";")* "'"
inst ::=
"set" number |
"add" |
"sub" |
"shg" |
"shs" |
"lor" |
"and" |
"xor" |
"not" |
"lDA" addr |
"lDR" addr |
"sAD" addr |
"sRD" addr |
"lPA" addr |
"lPR" addr |
"sAP" addr |
"sRP" addr |
"out" addr |
"inp" addr |
"lab" label |
"got" label |
"jm0" label |
"jmA" label |
"jmG" label |
"jmL" label |
"jmS" label |
"ret" |
"pha" |
"pla" |
"brk" |
"clr" |
"putstr" |
addr ::= " " (
number | "(" var ")" | "-" iden
)
expr ::=
number |
var |
binary |
paran
binary ::= expr op expr
paran ::= "(" expr ")"
op ::=
"+" |
"-" |
"|" |
"&" |
"^" |
"<<" |
">>"
cond ::= "~" expr ('==' | '!=' | '>' | '<') expr
label ::= iden
string ::= /'[^']*'/
var ::= "_" iden
iden ::= /[^'|;|\s|(|)]+/
number ::= /\d+/