annotate python/burg.x @ 346:3bb7dcfe5529

expanded arm target
author Windel Bouwman
date Fri, 07 Mar 2014 17:05:32 +0100
parents 44f336460c2a
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