Hopefully more accurate and complete
This commit is contained in:
parent
b640bdc855
commit
c6b072a6ae
24
doc/GRAMMAR
24
doc/GRAMMAR
|
@ -1,6 +1,8 @@
|
|||
program: { section | statement }
|
||||
|
||||
section: "." WORD newline
|
||||
section: "." section_name newline
|
||||
|
||||
section_name: WORD
|
||||
|
||||
newline: [ space ] NEWLINE
|
||||
|
||||
|
@ -8,17 +10,17 @@ space: SPACE { SPACE }
|
|||
|
||||
statement: ( function | space [ instruction ] ) newline
|
||||
|
||||
function: name [ space ] ":"
|
||||
function: function_name [ space ] ":"
|
||||
|
||||
name: WORD
|
||||
function_name: WORD
|
||||
|
||||
instruction: operator [ operand_list ]
|
||||
instruction: instruction_name [ space [ operand_list ] ]
|
||||
|
||||
operator: WORD
|
||||
instruction_name: WORD
|
||||
|
||||
operand_list: operand { "," operand }
|
||||
operand_list: operand [ space ] { "," [ space ] operand [ space ] }
|
||||
|
||||
operand: [ space ] ( value | address ) [ space ]
|
||||
operand: value | address
|
||||
|
||||
value: symbol | register | immediate
|
||||
|
||||
|
@ -26,6 +28,10 @@ symbol: WORD
|
|||
|
||||
register: "%" WORD
|
||||
|
||||
immediate: "$" NUMBER
|
||||
immediate: "$" [ sign ] NUMBER
|
||||
|
||||
address: "[" [ space ] value [ value ] [ "+" [ space ] offset [ space ] ] "]"
|
||||
address: "[" [ space ] [ sign [ space ] ] value [ space ] [ offset [ space ] ] "]"
|
||||
|
||||
sign: ( "+" | "-" )
|
||||
|
||||
offset: sign [ space ] value
|
||||
|
|
Loading…
Reference in New Issue
Block a user