Mercurial > lcfOS
comparison test/expression.x @ 318:e84047f29c78
Add burg and yacc initial attempts
author | Windel Bouwman |
---|---|
date | Tue, 31 Dec 2013 12:38:15 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
317:e30a77ae359b | 318:e84047f29c78 |
---|---|
1 | |
2 %tokens '+' number '(' ')' '*' | |
3 %% | |
4 | |
5 input: expression {return $1}; | |
6 | |
7 expression: term { return $1 } | |
8 | expression '+' term {}; | |
9 | |
10 term: factor { return $1 } | |
11 | term '*' factor { return $1 * $3 }; | |
12 | |
13 factor: '(' expression ')' | |
14 | number {return $1.val}; | |
15 | |
16 |