nitlanguage
/
nit.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
pep8analysis: intro a variant main program for a web interface
[nit.git]
/
contrib
/
nitcc
/
tests
/
inf5000-06-grammaire2-calculatrice.sablecc
1
Grammar calc;
2
Lexer
3
int = ('0'..'9')+;
4
blank = ' ' | #9 | #10 | #13;
5
6
Parser
7
Ignored blank;
8
exprs = expr*;
9
expr =
10
{add:} [left:]expr '+' [right:]expr |
11
{sub:} [left:]expr '-' [right:]expr |
12
{mul:} [left:]expr '*' [right:]expr |
13
{int:} int |
14
{par:} '(' expr ')' ;
15
Precedence Left mul; Left add, sub;