Skip to content

Commit

Permalink
Merge pull request #1 from DanielBentleyMacLeod/patch-2
Browse files Browse the repository at this point in the history
Update Parser.mly
  • Loading branch information
DanielBentleyMacLeod authored Nov 5, 2021
2 parents c3b68b5 + 5c62821 commit aaaa10b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib/frontend/Parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
%token <Span.t * Z.t> NUM
%token <Span.t * int list> BITPAT
%token <Span.t * string> STRING
%token <Span.t> INCLUDE
%token <Span.t> TRUE
%token <Span.t> FALSE
%token <Span.t> EQ
Expand Down Expand Up @@ -108,7 +109,7 @@
%token EOF

%start prog
%type <Syntax.decls> prog
%type <(string list * Syntax.decls)> prog

%right ID EVENT
%left AND OR /* lowest precedence */
Expand Down Expand Up @@ -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) }
;

0 comments on commit aaaa10b

Please sign in to comment.