Asm/doc/GRAMMAR

34 lines
531 B
Plaintext

program: { section | statement }
section: "." WORD newline
newline: [ space ] NEWLINE
space: SPACE { SPACE }
statement: ( function | space [ instruction ] ) newline
function: name [ space ] ":"
name: WORD
instruction: operator [ operand_list ]
operator: WORD
operand_list: operand { "," operand }
operand: [ space ] ( value | address ) [ space ]
value: symbol | register | immediate
symbol: WORD
register: "%" WORD
immediate: "$" NUMBER
address: "[" offset [ "+" offset ] "]"
offset: [ space ] value [ space ]