From 5c628213098b54a3907d295136d8641507bb4b62 Mon Sep 17 00:00:00 2001 From: DanielBentleyMacLeod <62396297+DanielBentleyMacLeod@users.noreply.github.com> Date: Fri, 5 Nov 2021 19:21:35 -0400 Subject: [PATCH] Update Parser.mly --- src/lib/frontend/Parser.mly | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/frontend/Parser.mly b/src/lib/frontend/Parser.mly index c17ac8ca..6fe48ee1 100644 --- a/src/lib/frontend/Parser.mly +++ b/src/lib/frontend/Parser.mly @@ -34,6 +34,7 @@ %token NUM %token BITPAT %token STRING +%token INCLUDE %token TRUE %token FALSE %token EQ @@ -108,7 +109,7 @@ %token EOF %start prog -%type prog +%type <(string list * Syntax.decls)> prog %right ID EVENT %left AND OR /* lowest precedence */ @@ -377,6 +378,12 @@ statement1: | PRINTF LPAREN STRING COMMA args RPAREN SEMI { sprintf_sp (snd $3) $5 (Span.extend $1 $7) } | FOR LPAREN ID LESS size RPAREN LBRACE statement RBRACE { loop_sp $8 (snd $3) (snd $5) (Span.extend $1 $9) } +includes: + | INCLUDE STRING {[(snd $2)]} + | INCLUDE STRING includes {(snd $2)::$3} + + prog: - | decls EOF { $1 } + | includes decls EOF { ($1, $2) } + | decls EOF { ([], $1) } ;