comparison python/pyyacc.py @ 180:25a0753da4cf

Re-organized files
author Windel Bouwman
date Thu, 09 May 2013 17:35:19 +0200
parents 0f3b1adfd416
children 216da5e46efc
comparison
equal deleted inserted replaced
179:0f3b1adfd416 180:25a0753da4cf
11 def productionsForName(self, name): 11 def productionsForName(self, name):
12 return [p for p in self.productions if p.name == name] 12 return [p for p in self.productions if p.name == name]
13 @property 13 @property
14 def Symbols(self): 14 def Symbols(self):
15 return self.nonterminals + self.terminals 15 return self.nonterminals + self.terminals
16 def calcFollow(self):
17 follow = {}
18 for nt in self.nonterminals:
19 follow[nt] = set()
20 while True:
21 change = False
22 # 1.
23 for p in self.productions:
24 pass
25 if not change:
26 break
27 return follow
28 def calcFirst(self):
29 first = {}
30 return first
16 31
17 class Production: 32 class Production:
18 def __init__(self, name, symbols): 33 def __init__(self, name, symbols):
19 self.name = name 34 self.name = name
20 self.symbols = symbols 35 self.symbols = symbols