Hopefully more accurate and complete

This commit is contained in:
Pierre Pronchery 2012-07-07 01:23:36 +00:00
parent b640bdc855
commit c6b072a6ae

View File

@ -1,6 +1,8 @@
program: { section | statement } program: { section | statement }
section: "." WORD newline section: "." section_name newline
section_name: WORD
newline: [ space ] NEWLINE newline: [ space ] NEWLINE
@ -8,17 +10,17 @@ space: SPACE { SPACE }
statement: ( function | space [ instruction ] ) newline 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 value: symbol | register | immediate
@ -26,6 +28,10 @@ symbol: WORD
register: "%" 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