summaryrefslogtreecommitdiff
path: root/bnftest.2
blob: 229943ba13508f82ff40cd65bae1fd12dd704955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
tokens = tokPlus tokMinus tokMult tokDivide tokOpenParen tokCloseParen
	tokEquals tokNumber;

input: line input#
     |
	 ;

input#: line input#
      |
	  ;

line: expr tokEquals {print}
	;

expr: tokOpenParen expr tokCloseParen expr#
	| [tokNumber] expr#
	;

expr#: tokPlus expr {add} expr#
     | tokMinus expr {subtract} expr#
	 | tokMult expr {multiply} expr#
	 | tokDivide expr {divide} expr#
	 |
	 ;