grammar: specify expressions
This commit is contained in:
parent
ac6cc2154d
commit
4b52f663c6
1 changed files with 13 additions and 3 deletions
|
@ -16,11 +16,21 @@ funcargs = expr-list
|
|||
|
||||
array-literal = "[" expr-list "]"
|
||||
|
||||
expr-list = expr *("," expr) [","] ; Allows a trailling comma
|
||||
expr = number
|
||||
; See `OperatorTable` at compiler/parse.c for the precedences
|
||||
binary-operator = "+" / "-" / "*" / "/" / "<" / "<=" / ">" / ">=" / "==" / "!="
|
||||
unary-operator = "-"
|
||||
ident-or-call = ident / function-call
|
||||
|
||||
atom = number
|
||||
/ array-literal
|
||||
/ function-call
|
||||
/ string-literal
|
||||
/ ident-or-call
|
||||
/ "(" expr ")"
|
||||
|
||||
unary = [unary-operator] atom
|
||||
expr = unary [binary-operator expr]
|
||||
|
||||
expr-list = expr *("," expr) [","] ; Allows a trailling comma
|
||||
|
||||
pragma-directive = ident *("," ident) [","]
|
||||
pragma = "#" "[" pragma-directive "]"
|
||||
|
|
Loading…
Add table
Reference in a new issue