summaryrefslogtreecommitdiff
path: root/bnftest
blob: 7e61b1a632132ba0981c2ea435f5d1e836f8e46d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
tokens = tokPlus tokMinus tokMult tokDivide tokOpenParen tokCloseParen
	tokEquals tokNumber;

input: input line
	 |
	 ;
	 
line: expr tokEquals {print}
	;

expr: expr tokPlus expr {add}
	| expr tokMinus expr {subtract}
	| expr tokMult expr {multiply}
	| expr tokDivide expr {divide}
	| tokOpenParen expr tokCloseParen
	| [tokNumber]
	;