-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.mly
More file actions
25 lines (20 loc) · 696 Bytes
/
parser.mly
File metadata and controls
25 lines (20 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
%{ open BDD %}
%token <int> VAR
%token <string> AND OR IMP BIMP
%token NEG OPEN CLOSE EOL
%left AND NEG OR IMP BIMP
%start main
%type <BDD.expression> main
%%
expression:
| VAR { BDD.Var $1 }
| OPEN expression CLOSE { $2 }
| expression AND expression { BDD.And($1,$3) }
| expression OR expression { BDD.Or($1,$3) }
| expression IMP expression { BDD.Imp($1,$3) }
| expression BIMP expression { BDD.BImp($1,$3) }
| NEG expression { BDD.Neg($2) }
;
main:
| expression EOL { $1 }
;