44 lines
836 B
Plaintext
44 lines
836 B
Plaintext
program: { directive | statement }
|
|
|
|
directive: "." directive_name [ space [ directive_args ] ] newline
|
|
|
|
directive_name: WORD
|
|
|
|
directive_args: directive_arg { space [ directive_arg ] }
|
|
|
|
directive_arg: WORD | NUMBER
|
|
|
|
newline: [ space ] NEWLINE
|
|
|
|
space: SPACE { SPACE }
|
|
|
|
statement: ( function | space [ instruction ] ) newline
|
|
|
|
function: function_name [ space ] ":"
|
|
|
|
function_name: WORD
|
|
|
|
instruction: [ prefix space ] instruction_name [ space [ operand_list ] ]
|
|
|
|
prefix: WORD
|
|
|
|
instruction_name: WORD
|
|
|
|
operand_list: operand [ space ] { "," [ space ] operand [ space ] }
|
|
|
|
operand: value | address
|
|
|
|
value: symbol | register | immediate
|
|
|
|
symbol: WORD
|
|
|
|
register: "%" WORD
|
|
|
|
immediate: [ sign ] "$" NUMBER
|
|
|
|
address: "[" [ space ] [ sign [ space ] ] value [ space ] [ offset [ space ] ] "]"
|
|
|
|
sign: ( "+" | "-" )
|
|
|
|
offset: sign [ space ] value
|