summary refs log tree commit diff
path: root/grammar
diff options
context:
space:
mode:
authorErik Oosting2023-12-12 16:24:03 +0100
committerErik Oosting2023-12-12 16:24:03 +0100
commit258121cfb53b6b002dd0d2f68b91ce5234011620 (patch)
treeb81b6435096a4088d4f110c089206be7ff3a0633 /grammar
parentd9ffc2f3f679bf6e87cf12dc1ed9809badf673da (diff)
first visit method done
Diffstat (limited to 'grammar')
-rw-r--r--grammar/ANF.g45
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: '"' ([^"]|'\\'.)* '"';