Mercurial > repo
comparison ply-3.8/test/yacc_rr_unused.py @ 7267:343ff337a19b
<ais523> ` tar -xf ply-3.8.tar.gz
author | HackBot |
---|---|
date | Wed, 23 Mar 2016 02:40:16 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
7266:61a39a120dee | 7267:343ff337a19b |
---|---|
1 # ----------------------------------------------------------------------------- | |
2 # yacc_rr_unused.py | |
3 # | |
4 # A grammar with reduce/reduce conflicts and a rule that never | |
5 # gets reduced. | |
6 # ----------------------------------------------------------------------------- | |
7 import sys | |
8 | |
9 if ".." not in sys.path: sys.path.insert(0,"..") | |
10 import ply.yacc as yacc | |
11 | |
12 tokens = ('A', 'B', 'C') | |
13 | |
14 def p_grammar(p): | |
15 ''' | |
16 rule1 : rule2 B | |
17 | rule2 C | |
18 | |
19 rule2 : rule3 B | |
20 | rule4 | |
21 | rule5 | |
22 | |
23 rule3 : A | |
24 | |
25 rule4 : A | |
26 | |
27 rule5 : A | |
28 ''' | |
29 | |
30 yacc.yacc() |