annotate test/expression.x @ 343:11c5a8a70c02 devel

Fix ide
author Windel Bouwman
date Sat, 01 Mar 2014 16:27:52 +0100
parents e84047f29c78
children
rev   line source
318
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
1
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
2 %tokens '+' number '(' ')' '*'
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
3 %%
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
4
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
5 input: expression {return $1};
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
6
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
7 expression: term { return $1 }
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
8 | expression '+' term {};
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
9
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
10 term: factor { return $1 }
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
11 | term '*' factor { return $1 * $3 };
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
12
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
13 factor: '(' expression ')'
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
14 | number {return $1.val};
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
15
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
16