From d9ffc2f3f679bf6e87cf12dc1ed9809badf673da Mon Sep 17 00:00:00 2001 From: Erik Oosting Date: Tue, 12 Dec 2023 15:20:56 +0100 Subject: start working on actual visitor --- grammar/ANF.g4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'grammar') 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'; -- cgit 1.4.1-2-gfad0