annotate python/burg.x @ 322:44f336460c2a

Half of use of burg spec for arm
author Windel Bouwman
date Mon, 27 Jan 2014 19:58:07 +0100
parents 8d07a4254f04
children 818be710e13d
rev   line source
318
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
1
322
44f336460c2a Half of use of burg spec for arm
Windel Bouwman
parents: 319
diff changeset
2 %tokens ':' ';' '(' ')' ',' template id number '%%' '%terminal' header
318
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
322
44f336460c2a Half of use of burg spec for arm
Windel Bouwman
parents: 319
diff changeset
6 burgdef: header '%%' directives '%%' rules { self.system.header_lines = $1.val };
319
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
7
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
8 directives:
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
9 | directives directive;
318
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
10
319
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
11 directive: termdef;
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
12
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
13 termdef: '%terminal' termids;
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
14
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
15 termids:
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
16 | termids termid;
318
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
17
319
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
18 termid: id { self.system.add_terminal($1.val) };
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
19
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
20 rules:
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
21 | rules rule;
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
22
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
23 rule: id ':' tree cost template { self.system.add_rule($1.val, $3, $4, $5.val) };
318
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
24
319
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
25 cost: number { return $1.val };
318
e84047f29c78 Add burg and yacc initial attempts
Windel Bouwman
parents:
diff changeset
26
319
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
27 tree: id { return self.system.tree($1.val) }
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
28 | id '(' tree ')' { return self.system.tree($1.val, $3) }
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
29 | id '(' tree ',' tree ')' { return self.system.tree($1.val, $3, $5) };
8d07a4254f04 Work on burg
Windel Bouwman
parents: 318
diff changeset
30