New grammar, sort of working

This commit is contained in:
2023-08-02 21:56:26 -05:00
parent ba4f98e2a5
commit e8940feea7
5 changed files with 701 additions and 660 deletions
+2 -13
View File
@@ -64,19 +64,8 @@ operator = _{
| ne
}
expr = { prefix? ~ val ~ suffix* ~ (operator ~ prefix? ~ val ~ suffix*)* }
val = {
// These are what get evaluated and left on the stack:
number
| // Literal numbers
("(" ~ expr ~ ")")
| // Nested parenthesized exprs
// Bare literal ids, fn calls, array references
// (call, or pointer arithmetic, since ids all reference addresses)
// (multiple calls / subscripts aren't allowed; use CALL or collapse to one
// subscript)
name
}
expr = { val ~ (operator ~ val)* }
val = { prefix* ~ (number | name | "(" ~ expr ~ ")") ~ suffix* }
suffix = { subscript | arglist | member }
subscript = { "[" ~ expr ~ "]" }