Update grammar to match implementation
This commit is contained in:
parent
03fc44f339
commit
42445338a4
@ -1,12 +1,11 @@
|
|||||||
/* string literals are lexer identifier tokens with that particular value */
|
|
||||||
<program> ::= <statement>*
|
<program> ::= <statement>*
|
||||||
<statement> ::= <label> | <directive> | <instruction>
|
<statement> ::= <label> | <directive> | <instruction>
|
||||||
|
|
||||||
<label> ::= <identifier> <colon>
|
<label> ::= <identifier> <colon>
|
||||||
|
|
||||||
<directive> ::= <dot> <section>
|
<directive> ::= <dot> <section_directive>
|
||||||
|
|
||||||
<section> ::= "section" <identifier>
|
<section_directive> ::= "section" <identifier>
|
||||||
|
|
||||||
<instruction> ::= <identifier> <operands>
|
<instruction> ::= <identifier> <operands>
|
||||||
|
|
||||||
@ -14,11 +13,8 @@
|
|||||||
|
|
||||||
<operand> ::= <register> | <immediate> | <memory>
|
<operand> ::= <register> | <immediate> | <memory>
|
||||||
|
|
||||||
<register> ::= <register_base> | <register_extra>
|
|
||||||
<register_base> ::= "rax" | "rbx" | "rcx" | "rdx" | "rsi" | "rdi" | "rbp" | "rsp"
|
|
||||||
<register_extra> ::= "r8" | "r9" | "r10" | "r11" | "r12" | "r13" | "r14" | "r15"
|
|
||||||
|
|
||||||
<immediate> ::= <number> | <label_reference>
|
<immediate> ::= <number> | <label_reference>
|
||||||
|
|
||||||
<number> ::= <octal> | <binary> | <decimal> | <hexadecimal>
|
<number> ::= <octal> | <binary> | <decimal> | <hexadecimal>
|
||||||
|
|
||||||
<label_reference> ::= <identifier>
|
<label_reference> ::= <identifier>
|
||||||
@ -34,3 +30,10 @@
|
|||||||
<register_offset> ::= <plus_or_minus> <number>
|
<register_offset> ::= <plus_or_minus> <number>
|
||||||
|
|
||||||
<plus_or_minus> ::= <plus> | <minus>
|
<plus_or_minus> ::= <plus> | <minus>
|
||||||
|
|
||||||
|
|
||||||
|
/* These are lexer identifiers with the correct string value */
|
||||||
|
<section> ::= "section"
|
||||||
|
|
||||||
|
<register> ::= "rax" | "rbx" | "rcx" | "rdx" | "rsi" | "rdi" | "rbp" | "rsp" |
|
||||||
|
"r8" | "r9" | "r10" | "r11" | "r12" | "r13" | "r14" | "r15"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user