annotate ply-3.8/test/yacc_rr_unused.py @ 10776:b474172c9892
<b_jonas> slashlearn ance//Spelling of -ance/-ence words: advance, science, conference, experience, finance, insurance, licence, performance, reference, assistance, balance, defence, difference, distance, evidence, acceptance, appliance, audience, compliance, importance, influence, instance, intelligence, maintenance, preference, presence, sentence, sequence, substance, violence, absence, accordance, alliance, appearance, assurance, attendance, circumstance, clea
author |
HackBot |
date |
Fri, 21 Apr 2017 18:06:38 +0000 |
parents |
343ff337a19b |
children |
|
rev |
line source |
7267
|
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()
|