minor fixes to lib
This commit is contained in:
parent
b7dee58454
commit
c506fdd966
@ -35,14 +35,11 @@ prog:
|
||||
|
||||
expr:
|
||||
| c = COMMENT { Comment c }
|
||||
| e = arithmetic { e }
|
||||
| POP; p = pop { p }
|
||||
| PUSH; p = push { p }
|
||||
| b = branching { b }
|
||||
| FUNCTION; f = function_definition { f }
|
||||
| CALL; c = function_call { c }
|
||||
| RETURN { Return }
|
||||
| e = expr; COMMENT { e }
|
||||
| e = arithmetic { e }
|
||||
| e = memoryaccess { e }
|
||||
| e = programflow { e }
|
||||
| e = functioncall { e }
|
||||
;
|
||||
|
||||
arithmetic:
|
||||
@ -57,6 +54,11 @@ arithmetic:
|
||||
| NOT { ArithmeticCommand Not }
|
||||
;
|
||||
|
||||
memoryaccess:
|
||||
| POP; e = pop { e }
|
||||
| PUSH; e = push { e }
|
||||
;
|
||||
|
||||
pop:
|
||||
| ARGUMENT; a = ADDRESS { MemoryAccessCommand (Pop, Argument, a) }
|
||||
| LOCAL; a = ADDRESS { MemoryAccessCommand (Pop, Local, a) }
|
||||
@ -78,16 +80,14 @@ push:
|
||||
| CONSTANT; a = ADDRESS { MemoryAccessCommand (Push, Constant, a) }
|
||||
;
|
||||
|
||||
branching:
|
||||
programflow:
|
||||
| LABEL; i = ID { ProgramFlowCommand (Label, i) }
|
||||
| GOTO; i = ID { ProgramFlowCommand (Goto, i) }
|
||||
| IFGOTO; i = ID { ProgramFlowCommand (Ifgoto, i) }
|
||||
;
|
||||
|
||||
function_definition:
|
||||
| i = ID; a = ADDRESS { FunctionCallCommand (Function, i, a) }
|
||||
;
|
||||
|
||||
function_call:
|
||||
| i = ID; a = ADDRESS { FunctionCallCommand (Call, i, a) }
|
||||
functioncall:
|
||||
| FUNCTION; i = ID; a = ADDRESS { FunctionCallCommand (Function, i, a) }
|
||||
| CALL; i = ID; a = ADDRESS { FunctionCallCommand (Call, i, a) }
|
||||
| RETURN { Return }
|
||||
;
|
Loading…
Reference in New Issue
Block a user