Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhou5042 committed Oct 2, 2023
1 parent 5bbd8ee commit 5c2c8cd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Parser/LR1Table/LR1Table.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def LR1_construct_table(self):

if j in self.Collection:
parse_table[i][A] = self.Collection.index(j)
self.print_info()
return parse_table

def print_info(self):
Expand All @@ -179,3 +180,4 @@ def print_info(self):
print('TERMINALS', self.G_prime.terminals)
print('NONTERMINALS', self.G_prime.nonterminals)
print('SYMBOLS', self.G_prime.symbols)
print()
3 changes: 2 additions & 1 deletion Parser/LR1Table/LR1TableUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def __init__(self, parent, action, goto, table):
def initUI(self):
self.grid.SetCellValue(0, 0, '状态')

for i in range(len(self.action) + len(self.action) - 1):
for i in range(len(self.action) + len(self.goto) - 1):
print(f"i = {i}, len(self.action) = {len(self.action)}, len(self.goto) = {len(self.goto)}")
if i < len(self.action):
self.grid.SetCellValue(0, i + 1, self.action[i])
else:
Expand Down
Binary file modified Parser/LR1Table/__pycache__/GenTable.cpython-310.pyc
Binary file not shown.
Binary file modified Parser/LR1Table/__pycache__/LR1Table.cpython-310.pyc
Binary file not shown.
Binary file modified Parser/LR1Table/__pycache__/LR1TableUI.cpython-310.pyc
Binary file not shown.
1 change: 0 additions & 1 deletion Parser/LR1Table/grammars/mygrammar.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
S' -> S
S -> V = E
S -> id
V -> id
Expand Down

0 comments on commit 5c2c8cd

Please sign in to comment.