diff options
author | Erik Oosting | 2023-12-12 16:24:03 +0100 |
---|---|---|
committer | Erik Oosting | 2023-12-12 16:24:03 +0100 |
commit | 258121cfb53b6b002dd0d2f68b91ce5234011620 (patch) | |
tree | b81b6435096a4088d4f110c089206be7ff3a0633 /grammar | |
parent | d9ffc2f3f679bf6e87cf12dc1ed9809badf673da (diff) |
first visit method done
Diffstat (limited to 'grammar')
-rw-r--r-- | grammar/ANF.g4 | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/grammar/ANF.g4 b/grammar/ANF.g4 index f940a20..6408f2e 100644 --- a/grammar/ANF.g4 +++ b/grammar/ANF.g4 @@ -1,5 +1,9 @@ grammar ANF; +prog: def+; + +def: 'def' IDENT '('(IDENT (',' IDENT)*)? ')' ':' cexp; + aexp : 'true' #true | 'false' # false @@ -31,6 +35,7 @@ cexp | funcall #fc ; + IDENT: Letter (Letter | Digit)*; NUMBER: Digit+; STRING: '"' ([^"]|'\\'.)* '"'; |