summary refs log tree commit diff
path: root/grammar
diff options
context:
space:
mode:
authorErik Oosting2023-12-12 15:20:56 +0100
committerErik Oosting2023-12-12 15:20:56 +0100
commitd9ffc2f3f679bf6e87cf12dc1ed9809badf673da (patch)
tree8e7d9cf3b5ea50790353290c34566f00e6de05f2 /grammar
parent60c8f636596de722a91f9dba1f2ae631a61a6484 (diff)
start working on actual visitor
Diffstat (limited to 'grammar')
-rw-r--r--grammar/ANF.g44
1 files changed, 3 insertions, 1 deletions
diff --git a/grammar/ANF.g4 b/grammar/ANF.g4
index 07e199e..f940a20 100644
--- a/grammar/ANF.g4
+++ b/grammar/ANF.g4
@@ -5,6 +5,7 @@ aexp
     | 'false' # false
     | IDENT #var
     | NUMBER #num
+    | STRING #str
     | '(' aexp '+' aexp ')' #add
     | '(' aexp '-' aexp ')' #sub
     | '(' aexp '*' aexp ')' #mul
@@ -17,7 +18,7 @@ aexp
     | '(' aexp '&&' aexp ')' #and
     | '(' aexp '||' aexp ')' #or
     | '(' aexp '^^' aexp ')' #xor
-    | '(' IDENT ':' cexp ')' #lam
+    | '(' IDENT (',' IDENT)* ':' cexp ')' #lam
     ;
 
 funcall
@@ -32,6 +33,7 @@ cexp
 
 IDENT: Letter (Letter | Digit)*;
 NUMBER: Digit+;
+STRING: '"' ([^"]|'\\'.)* '"';
 
 fragment Letter: 'A' .. 'Z' | 'a' .. 'z';
 fragment Digit: '0'..'9';