Skip to content

Commit 091c1e2

Browse files
committed
correct mistakes
1 parent 71694bb commit 091c1e2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

LR.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ def BuildLR0AnalyseTable(self):
180180
for stat in self.action:
181181
for sy in self.action[stat]:
182182
if len(self.action[stat][sy]) > 1:
183-
print("It's not a LR(0) grammer.")
183+
print("It's not a LR(0) grammar.")
184184
return False
185-
print("It's a LR(0) grammer.")
185+
print("It's a LR(0) grammar.")
186186
return True
187187

188188
def addFirst(self, nt, sy):
@@ -310,7 +310,7 @@ def BuildSLR1AnalyseTable(self):
310310
else:
311311
followj = reduction[j]
312312
if len(followi.intersection(followj)):
313-
print("It's not a SLR(1) grammer.")
313+
print("It's not a SLR(1) grammar.")
314314
return False
315315
reduction.pop()
316316

@@ -328,7 +328,7 @@ def BuildSLR1AnalyseTable(self):
328328
self.changeAction(stat, sy, '')
329329
movein = set()
330330
reduction = []
331-
print("It's a SLR(1) grammer.")
331+
print("It's a SLR(1) grammar.")
332332
return True
333333

334334
def addLATerminal(self, set_num, project, sy):
@@ -504,9 +504,9 @@ def BuildLR1AnalyseTable(self):
504504
for stat in self.action:
505505
for sy in self.action[stat]:
506506
if len(self.action[stat][sy]) > 1:
507-
print("It's not a LR(1) grammer.")
507+
print("It's not a LR(1) grammar.")
508508
return False
509-
print("It's a LR(1) grammer.")
509+
print("It's a LR(1) grammar.")
510510
return True
511511

512512
def BuildLALR1AnalyseTable(self):
@@ -531,7 +531,7 @@ def BuildLALR1AnalyseTable(self):
531531
f_num += 1
532532

533533
if concentric_num == 0:
534-
print("It's a LALR(1) grammer.")
534+
print("It's a LALR(1) grammar.")
535535
return True
536536

537537
for Iid in self.projectSet:
@@ -562,9 +562,9 @@ def BuildLALR1AnalyseTable(self):
562562
for sy in self.action[stat]:
563563
if len(self.action[stat][sy]) > 1:
564564
self.action, self.goto = action, goto
565-
print("It's not a LALR(1) grammer.")
565+
print("It's not a LALR(1) grammar.")
566566
return False
567-
print("It's a LALR(1) grammer.")
567+
print("It's a LALR(1) grammar.")
568568

569569
def Analysis(self, sentence):
570570
statstack = [0]

0 commit comments

Comments
 (0)