From 1be80bcbd3ed6a82ce0caed5e84a169f6789f91e Mon Sep 17 00:00:00 2001 From: AYM1607 Date: Fri, 12 Apr 2019 14:08:28 -0500 Subject: [PATCH] Added translation for do statements with exit --- final_lang/fort.py | 36 +- final_lang/parser.out | 897 ++++++++++++++++++++------------------ final_lang/parsetab.py | 183 ++++---- final_lang/test2.fort | 7 + final_lang/test2.fort.out | 8 + 5 files changed, 613 insertions(+), 518 deletions(-) diff --git a/final_lang/fort.py b/final_lang/fort.py index 864ce8b..cd186e4 100644 --- a/final_lang/fort.py +++ b/final_lang/fort.py @@ -250,9 +250,9 @@ def p_S(p): | print RDimOrString | if action_16 Relif ElseOrEmpty end if action_20 | do id equals EA coma EA IntOrEmpty then B end do - | do then B end do + | do then action_21 B action_22 end do | swap Dimensional coma Dimensional - | exit + | exit action_23 ''' # Adjust the action to support matrices @@ -622,6 +622,36 @@ def p_action_20(p): fillGoto(Dir, quadrupletIndex) jumpsStack.pop() + +def p_action_21(p): + "action_21 :" + jumpsStack.append(quadrupletIndex) + exitsStack.append('$') + + +def p_action_22(p): + "action_22 :" + global resultQuadruplets + global quadrupletIndex + Dir = jumpsStack.pop() + resultQuadruplets.append(f'goto {Dir}\n') + quadrupletIndex += 1 + while(peek(exitsStack) != '$'): + Dir = exitsStack.pop() + fillGoto(Dir, quadrupletIndex) + exitsStack.pop() + + +def p_action_23(p): + "action_23 :" + global quadrupletIndex + global quadrupletIndex + exitsStack.append(quadrupletIndex) + resultQuadruplets.append('goto _\n') + quadrupletIndex += 1 + + + def p_error(p): print('XXX Invalid program') print(p) @@ -642,8 +672,6 @@ if (len(sys.argv) > 1): program = programFile.read().replace('\\n', '\n') parser.parse(program) - print(resultQuadruplets) - print(symbols) resultFile.writelines(resultQuadruplets) # Close the files. diff --git a/final_lang/parser.out b/final_lang/parser.out index 9c46fda..0ed31ad 100644 --- a/final_lang/parser.out +++ b/final_lang/parser.out @@ -23,9 +23,9 @@ Rule 17 S -> read RDimensional Rule 18 S -> print RDimOrString Rule 19 S -> if action_16 Relif ElseOrEmpty end if action_20 Rule 20 S -> do id equals EA coma EA IntOrEmpty then B end do -Rule 21 S -> do then B end do +Rule 21 S -> do then action_21 B action_22 end do Rule 22 S -> swap Dimensional coma Dimensional -Rule 23 S -> exit +Rule 23 S -> exit action_23 Rule 24 Dimensional -> id DimensionsOrEmpty Rule 25 DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen Rule 26 DimensionsOrEmpty -> @@ -90,6 +90,9 @@ Rule 84 action_17 -> Rule 85 action_18 -> Rule 86 action_19 -> Rule 87 action_20 -> +Rule 88 action_21 -> +Rule 89 action_22 -> +Rule 90 action_23 -> Terminals, with rules where they appear @@ -175,6 +178,9 @@ action_18 : 36 action_19 : 37 action_2 : 59 action_20 : 19 +action_21 : 21 +action_22 : 21 +action_23 : 23 action_2_rea : 60 action_3 : 42 action_4 : 42 @@ -310,9 +316,9 @@ state 9 (18) S -> . print RDimOrString (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 (20) S -> . do id equals EA coma EA IntOrEmpty then B end do - (21) S -> . do then B end do + (21) S -> . do then action_21 B action_22 end do (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit + (23) S -> . exit action_23 (24) Dimensional -> . id DimensionsOrEmpty end shift and go to state 14 @@ -434,7 +440,7 @@ state 19 state 20 (20) S -> do . id equals EA coma EA IntOrEmpty then B end do - (21) S -> do . then B end do + (21) S -> do . then action_21 B action_22 end do id shift and go to state 39 then shift and go to state 40 @@ -451,19 +457,21 @@ state 21 state 22 - (23) S -> exit . + (23) S -> exit . action_23 + (90) action_23 -> . - end reduce using rule 23 (S -> exit .) - id reduce using rule 23 (S -> exit .) - read reduce using rule 23 (S -> exit .) - print reduce using rule 23 (S -> exit .) - if reduce using rule 23 (S -> exit .) - do reduce using rule 23 (S -> exit .) - swap reduce using rule 23 (S -> exit .) - exit reduce using rule 23 (S -> exit .) - elif reduce using rule 23 (S -> exit .) - else reduce using rule 23 (S -> exit .) + end reduce using rule 90 (action_23 -> .) + id reduce using rule 90 (action_23 -> .) + read reduce using rule 90 (action_23 -> .) + print reduce using rule 90 (action_23 -> .) + if reduce using rule 90 (action_23 -> .) + do reduce using rule 90 (action_23 -> .) + swap reduce using rule 90 (action_23 -> .) + exit reduce using rule 90 (action_23 -> .) + elif reduce using rule 90 (action_23 -> .) + else reduce using rule 90 (action_23 -> .) + action_23 shift and go to state 42 state 23 @@ -480,7 +488,7 @@ state 23 swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - B shift and go to state 42 + B shift and go to state 43 state 24 @@ -488,16 +496,16 @@ state 24 (4) Rid -> . id (5) Rid -> . Rid coma id - id shift and go to state 44 + id shift and go to state 45 - Rid shift and go to state 43 + Rid shift and go to state 44 state 25 (8) Dim -> openBra int . closedBra (9) Dim -> openBra int . closedBra openBra int closedBra - closedBra shift and go to state 45 + closedBra shift and go to state 46 state 26 @@ -562,16 +570,16 @@ state 28 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EA shift and go to state 47 - MultDiv shift and go to state 48 - EAParens shift and go to state 49 - EItem shift and go to state 50 - Dimensional shift and go to state 51 + EA shift and go to state 48 + MultDiv shift and go to state 49 + EAParens shift and go to state 50 + EItem shift and go to state 51 + Dimensional shift and go to state 52 state 29 @@ -584,7 +592,7 @@ state 30 (15) S -> Dimensional action_7 . equals EA action_8 - equals shift and go to state 54 + equals shift and go to state 55 state 31 @@ -602,7 +610,7 @@ state 31 exit reduce using rule 17 (S -> read RDimensional .) elif reduce using rule 17 (S -> read RDimensional .) else reduce using rule 17 (S -> read RDimensional .) - coma shift and go to state 55 + coma shift and go to state 56 state 32 @@ -672,7 +680,7 @@ state 34 exit reduce using rule 18 (S -> print RDimOrString .) elif reduce using rule 18 (S -> print RDimOrString .) else reduce using rule 18 (S -> print RDimOrString .) - coma shift and go to state 56 + coma shift and go to state 57 state 35 @@ -732,43 +740,58 @@ state 38 (35) Relif -> . openParen EL closedParen action_17 then B (36) Relif -> . Relif elif action_18 openParen EL closedParen action_17 then B - openParen shift and go to state 58 + openParen shift and go to state 59 - Relif shift and go to state 57 + Relif shift and go to state 58 state 39 (20) S -> do id . equals EA coma EA IntOrEmpty then B end do - equals shift and go to state 59 + equals shift and go to state 60 state 40 - (21) S -> do then . B end do - (13) B -> . B S - (14) B -> . + (21) S -> do then . action_21 B action_22 end do + (88) action_21 -> . - end reduce using rule 14 (B -> .) - id reduce using rule 14 (B -> .) - read reduce using rule 14 (B -> .) - print reduce using rule 14 (B -> .) - if reduce using rule 14 (B -> .) - do reduce using rule 14 (B -> .) - swap reduce using rule 14 (B -> .) - exit reduce using rule 14 (B -> .) + id reduce using rule 88 (action_21 -> .) + read reduce using rule 88 (action_21 -> .) + print reduce using rule 88 (action_21 -> .) + if reduce using rule 88 (action_21 -> .) + do reduce using rule 88 (action_21 -> .) + swap reduce using rule 88 (action_21 -> .) + exit reduce using rule 88 (action_21 -> .) + end reduce using rule 88 (action_21 -> .) - B shift and go to state 60 + action_21 shift and go to state 61 state 41 (22) S -> swap Dimensional . coma Dimensional - coma shift and go to state 61 + coma shift and go to state 62 state 42 + (23) S -> exit action_23 . + + end reduce using rule 23 (S -> exit action_23 .) + id reduce using rule 23 (S -> exit action_23 .) + read reduce using rule 23 (S -> exit action_23 .) + print reduce using rule 23 (S -> exit action_23 .) + if reduce using rule 23 (S -> exit action_23 .) + do reduce using rule 23 (S -> exit action_23 .) + swap reduce using rule 23 (S -> exit action_23 .) + exit reduce using rule 23 (S -> exit action_23 .) + elif reduce using rule 23 (S -> exit action_23 .) + else reduce using rule 23 (S -> exit action_23 .) + + +state 43 + (11) F -> F subroutine id B . end subroutine (13) B -> B . S (15) S -> . Dimensional action_7 equals EA action_8 @@ -777,12 +800,12 @@ state 42 (18) S -> . print RDimOrString (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 (20) S -> . do id equals EA coma EA IntOrEmpty then B end do - (21) S -> . do then B end do + (21) S -> . do then action_21 B action_22 end do (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit + (23) S -> . exit action_23 (24) Dimensional -> . id DimensionsOrEmpty - end shift and go to state 62 + end shift and go to state 63 id shift and go to state 13 read shift and go to state 17 print shift and go to state 18 @@ -794,7 +817,7 @@ state 42 S shift and go to state 15 Dimensional shift and go to state 16 -state 43 +state 44 (2) V -> V Tipo Dim doubleColon Rid . (5) Rid -> Rid . coma id @@ -810,10 +833,10 @@ state 43 do reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) swap reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) exit reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) - coma shift and go to state 63 + coma shift and go to state 64 -state 44 +state 45 (4) Rid -> id . @@ -831,16 +854,16 @@ state 44 exit reduce using rule 4 (Rid -> id .) -state 45 +state 46 (8) Dim -> openBra int closedBra . (9) Dim -> openBra int closedBra . openBra int closedBra doubleColon reduce using rule 8 (Dim -> openBra int closedBra .) - openBra shift and go to state 64 + openBra shift and go to state 65 -state 46 +state 47 (50) EAParens -> openParen . EA closedParen (41) EA -> . MultDiv @@ -854,18 +877,18 @@ state 46 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EA shift and go to state 65 - MultDiv shift and go to state 48 - EAParens shift and go to state 49 - EItem shift and go to state 50 - Dimensional shift and go to state 51 + EA shift and go to state 66 + MultDiv shift and go to state 49 + EAParens shift and go to state 50 + EItem shift and go to state 51 + Dimensional shift and go to state 52 -state 47 +state 48 (25) DimensionsOrEmpty -> openParen EA . ComaEAOrEmpty closedParen (42) EA -> EA . SumOrSub action_3 MultDiv action_4 @@ -874,15 +897,15 @@ state 47 (43) SumOrSub -> . plus (44) SumOrSub -> . minus - coma shift and go to state 68 + coma shift and go to state 69 closedParen reduce using rule 28 (ComaEAOrEmpty -> .) - plus shift and go to state 69 - minus shift and go to state 70 + plus shift and go to state 70 + minus shift and go to state 71 - ComaEAOrEmpty shift and go to state 66 - SumOrSub shift and go to state 67 + ComaEAOrEmpty shift and go to state 67 + SumOrSub shift and go to state 68 -state 48 +state 49 (41) EA -> MultDiv . (46) MultDiv -> MultDiv . MDSymbols action_5 EAParens action_6 @@ -904,12 +927,12 @@ state 48 elif reduce using rule 41 (EA -> MultDiv .) else reduce using rule 41 (EA -> MultDiv .) then reduce using rule 41 (EA -> MultDiv .) - mul shift and go to state 72 - div shift and go to state 73 + mul shift and go to state 73 + div shift and go to state 74 - MDSymbols shift and go to state 71 + MDSymbols shift and go to state 72 -state 49 +state 50 (45) MultDiv -> EAParens . @@ -932,7 +955,7 @@ state 49 then reduce using rule 45 (MultDiv -> EAParens .) -state 50 +state 51 (49) EAParens -> EItem . @@ -955,7 +978,7 @@ state 50 then reduce using rule 49 (EAParens -> EItem .) -state 51 +state 52 (58) EItem -> Dimensional . action_1 (67) action_1 -> . @@ -986,9 +1009,9 @@ state 51 and reduce using rule 67 (action_1 -> .) or reduce using rule 67 (action_1 -> .) - action_1 shift and go to state 74 + action_1 shift and go to state 75 -state 52 +state 53 (59) EItem -> int . action_2 (68) action_2 -> . @@ -1019,9 +1042,9 @@ state 52 and reduce using rule 68 (action_2 -> .) or reduce using rule 68 (action_2 -> .) - action_2 shift and go to state 75 + action_2 shift and go to state 76 -state 53 +state 54 (60) EItem -> rea . action_2_rea (69) action_2_rea -> . @@ -1052,9 +1075,9 @@ state 53 and reduce using rule 69 (action_2_rea -> .) or reduce using rule 69 (action_2_rea -> .) - action_2_rea shift and go to state 76 + action_2_rea shift and go to state 77 -state 54 +state 55 (15) S -> Dimensional action_7 equals . EA action_8 (41) EA -> . MultDiv @@ -1068,27 +1091,27 @@ state 54 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - Dimensional shift and go to state 51 - EA shift and go to state 77 - MultDiv shift and go to state 48 - EAParens shift and go to state 49 - EItem shift and go to state 50 + Dimensional shift and go to state 52 + EA shift and go to state 78 + MultDiv shift and go to state 49 + EAParens shift and go to state 50 + EItem shift and go to state 51 -state 55 +state 56 (30) RDimensional -> RDimensional coma . Dimensional (24) Dimensional -> . id DimensionsOrEmpty id shift and go to state 33 - Dimensional shift and go to state 78 + Dimensional shift and go to state 79 -state 56 +state 57 (32) RDimOrString -> RDimOrString coma . DimOrString (33) DimOrString -> . Dimensional @@ -1098,23 +1121,23 @@ state 56 string shift and go to state 37 id shift and go to state 33 - DimOrString shift and go to state 79 + DimOrString shift and go to state 80 Dimensional shift and go to state 36 -state 57 +state 58 (19) S -> if action_16 Relif . ElseOrEmpty end if action_20 (36) Relif -> Relif . elif action_18 openParen EL closedParen action_17 then B (37) ElseOrEmpty -> . else action_19 B (38) ElseOrEmpty -> . - elif shift and go to state 81 - else shift and go to state 82 + elif shift and go to state 82 + else shift and go to state 83 end reduce using rule 38 (ElseOrEmpty -> .) - ElseOrEmpty shift and go to state 80 + ElseOrEmpty shift and go to state 81 -state 58 +state 59 (35) Relif -> openParen . EL closedParen action_17 then B (51) EL -> . AND @@ -1129,19 +1152,19 @@ state 58 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 83 - not shift and go to state 88 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 84 + not shift and go to state 89 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EL shift and go to state 84 - AND shift and go to state 85 - Equality shift and go to state 86 - EItem shift and go to state 87 - Dimensional shift and go to state 51 + EL shift and go to state 85 + AND shift and go to state 86 + Equality shift and go to state 87 + EItem shift and go to state 88 + Dimensional shift and go to state 52 -state 59 +state 60 (20) S -> do id equals . EA coma EA IntOrEmpty then B end do (41) EA -> . MultDiv @@ -1155,95 +1178,85 @@ state 59 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EA shift and go to state 89 - MultDiv shift and go to state 48 - EAParens shift and go to state 49 - EItem shift and go to state 50 - Dimensional shift and go to state 51 - -state 60 - - (21) S -> do then B . end do - (13) B -> B . S - (15) S -> . Dimensional action_7 equals EA action_8 - (16) S -> . id parens - (17) S -> . read RDimensional - (18) S -> . print RDimOrString - (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 - (20) S -> . do id equals EA coma EA IntOrEmpty then B end do - (21) S -> . do then B end do - (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit - (24) Dimensional -> . id DimensionsOrEmpty - - end shift and go to state 90 - id shift and go to state 13 - read shift and go to state 17 - print shift and go to state 18 - if shift and go to state 19 - do shift and go to state 20 - swap shift and go to state 21 - exit shift and go to state 22 - - S shift and go to state 15 - Dimensional shift and go to state 16 + EA shift and go to state 90 + MultDiv shift and go to state 49 + EAParens shift and go to state 50 + EItem shift and go to state 51 + Dimensional shift and go to state 52 state 61 + (21) S -> do then action_21 . B action_22 end do + (13) B -> . B S + (14) B -> . + + id reduce using rule 14 (B -> .) + read reduce using rule 14 (B -> .) + print reduce using rule 14 (B -> .) + if reduce using rule 14 (B -> .) + do reduce using rule 14 (B -> .) + swap reduce using rule 14 (B -> .) + exit reduce using rule 14 (B -> .) + end reduce using rule 14 (B -> .) + + B shift and go to state 91 + +state 62 + (22) S -> swap Dimensional coma . Dimensional (24) Dimensional -> . id DimensionsOrEmpty id shift and go to state 33 - Dimensional shift and go to state 91 - -state 62 - - (11) F -> F subroutine id B end . subroutine - - subroutine shift and go to state 92 - + Dimensional shift and go to state 92 state 63 - (5) Rid -> Rid coma . id + (11) F -> F subroutine id B end . subroutine - id shift and go to state 93 + subroutine shift and go to state 93 state 64 - (9) Dim -> openBra int closedBra openBra . int closedBra + (5) Rid -> Rid coma . id - int shift and go to state 94 + id shift and go to state 94 state 65 + (9) Dim -> openBra int closedBra openBra . int closedBra + + int shift and go to state 95 + + +state 66 + (50) EAParens -> openParen EA . closedParen (42) EA -> EA . SumOrSub action_3 MultDiv action_4 (43) SumOrSub -> . plus (44) SumOrSub -> . minus - closedParen shift and go to state 95 - plus shift and go to state 69 - minus shift and go to state 70 + closedParen shift and go to state 96 + plus shift and go to state 70 + minus shift and go to state 71 - SumOrSub shift and go to state 67 + SumOrSub shift and go to state 68 -state 66 +state 67 (25) DimensionsOrEmpty -> openParen EA ComaEAOrEmpty . closedParen - closedParen shift and go to state 96 + closedParen shift and go to state 97 -state 67 +state 68 (42) EA -> EA SumOrSub . action_3 MultDiv action_4 (70) action_3 -> . @@ -1253,9 +1266,9 @@ state 67 rea reduce using rule 70 (action_3 -> .) id reduce using rule 70 (action_3 -> .) - action_3 shift and go to state 97 + action_3 shift and go to state 98 -state 68 +state 69 (27) ComaEAOrEmpty -> coma . EA (41) EA -> . MultDiv @@ -1269,18 +1282,18 @@ state 68 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EA shift and go to state 98 - MultDiv shift and go to state 48 - EAParens shift and go to state 49 - EItem shift and go to state 50 - Dimensional shift and go to state 51 + EA shift and go to state 99 + MultDiv shift and go to state 49 + EAParens shift and go to state 50 + EItem shift and go to state 51 + Dimensional shift and go to state 52 -state 69 +state 70 (43) SumOrSub -> plus . @@ -1290,7 +1303,7 @@ state 69 id reduce using rule 43 (SumOrSub -> plus .) -state 70 +state 71 (44) SumOrSub -> minus . @@ -1300,7 +1313,7 @@ state 70 id reduce using rule 44 (SumOrSub -> minus .) -state 71 +state 72 (46) MultDiv -> MultDiv MDSymbols . action_5 EAParens action_6 (72) action_5 -> . @@ -1310,9 +1323,9 @@ state 71 rea reduce using rule 72 (action_5 -> .) id reduce using rule 72 (action_5 -> .) - action_5 shift and go to state 99 + action_5 shift and go to state 100 -state 72 +state 73 (47) MDSymbols -> mul . @@ -1322,7 +1335,7 @@ state 72 id reduce using rule 47 (MDSymbols -> mul .) -state 73 +state 74 (48) MDSymbols -> div . @@ -1332,7 +1345,7 @@ state 73 id reduce using rule 48 (MDSymbols -> div .) -state 74 +state 75 (58) EItem -> Dimensional action_1 . @@ -1363,7 +1376,7 @@ state 74 or reduce using rule 58 (EItem -> Dimensional action_1 .) -state 75 +state 76 (59) EItem -> int action_2 . @@ -1394,7 +1407,7 @@ state 75 or reduce using rule 59 (EItem -> int action_2 .) -state 76 +state 77 (60) EItem -> rea action_2_rea . @@ -1425,7 +1438,7 @@ state 76 or reduce using rule 60 (EItem -> rea action_2_rea .) -state 77 +state 78 (15) S -> Dimensional action_7 equals EA . action_8 (42) EA -> EA . SumOrSub action_3 MultDiv action_4 @@ -1443,13 +1456,13 @@ state 77 exit reduce using rule 75 (action_8 -> .) elif reduce using rule 75 (action_8 -> .) else reduce using rule 75 (action_8 -> .) - plus shift and go to state 69 - minus shift and go to state 70 + plus shift and go to state 70 + minus shift and go to state 71 - action_8 shift and go to state 100 - SumOrSub shift and go to state 67 + action_8 shift and go to state 101 + SumOrSub shift and go to state 68 -state 78 +state 79 (30) RDimensional -> RDimensional coma Dimensional . @@ -1466,7 +1479,7 @@ state 78 else reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) -state 79 +state 80 (32) RDimOrString -> RDimOrString coma DimOrString . @@ -1483,23 +1496,23 @@ state 79 else reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) -state 80 +state 81 (19) S -> if action_16 Relif ElseOrEmpty . end if action_20 - end shift and go to state 101 + end shift and go to state 102 -state 81 +state 82 (36) Relif -> Relif elif . action_18 openParen EL closedParen action_17 then B (85) action_18 -> . openParen reduce using rule 85 (action_18 -> .) - action_18 shift and go to state 102 + action_18 shift and go to state 103 -state 82 +state 83 (37) ElseOrEmpty -> else . action_19 B (86) action_19 -> . @@ -1513,9 +1526,9 @@ state 82 exit reduce using rule 86 (action_19 -> .) end reduce using rule 86 (action_19 -> .) - action_19 shift and go to state 103 + action_19 shift and go to state 104 -state 83 +state 84 (56) Equality -> openParen . EL closedParen (51) EL -> . AND @@ -1530,28 +1543,28 @@ state 83 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 83 - not shift and go to state 88 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 84 + not shift and go to state 89 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EL shift and go to state 104 - AND shift and go to state 85 - Equality shift and go to state 86 - EItem shift and go to state 87 - Dimensional shift and go to state 51 + EL shift and go to state 105 + AND shift and go to state 86 + Equality shift and go to state 87 + EItem shift and go to state 88 + Dimensional shift and go to state 52 -state 84 +state 85 (35) Relif -> openParen EL . closedParen action_17 then B (52) EL -> EL . or action_10 AND action_9 - closedParen shift and go to state 105 - or shift and go to state 106 + closedParen shift and go to state 106 + or shift and go to state 107 -state 85 +state 86 (51) EL -> AND . (54) AND -> AND . and action_12 Equality action_11 @@ -1559,12 +1572,12 @@ state 85 ! shift/reduce conflict for and resolved as shift closedParen reduce using rule 51 (EL -> AND .) or reduce using rule 51 (EL -> AND .) - and shift and go to state 107 + and shift and go to state 108 ! and [ reduce using rule 51 (EL -> AND .) ] -state 86 +state 87 (53) AND -> Equality . @@ -1573,7 +1586,7 @@ state 86 or reduce using rule 53 (AND -> Equality .) -state 87 +state 88 (55) Equality -> EItem . EQSymbols action_13 EItem action_14 (61) EQSymbols -> . less @@ -1583,16 +1596,16 @@ state 87 (65) EQSymbols -> . lessEquals (66) EQSymbols -> . moreEquals - less shift and go to state 109 - more shift and go to state 110 - doubleEquals shift and go to state 111 - notEquals shift and go to state 112 - lessEquals shift and go to state 113 - moreEquals shift and go to state 114 + less shift and go to state 110 + more shift and go to state 111 + doubleEquals shift and go to state 112 + notEquals shift and go to state 113 + lessEquals shift and go to state 114 + moreEquals shift and go to state 115 - EQSymbols shift and go to state 108 + EQSymbols shift and go to state 109 -state 88 +state 89 (57) Equality -> not . EL action_15 (51) EL -> . AND @@ -1607,40 +1620,62 @@ state 88 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 83 - not shift and go to state 88 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 84 + not shift and go to state 89 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EL shift and go to state 115 - AND shift and go to state 85 - Equality shift and go to state 86 - EItem shift and go to state 87 - Dimensional shift and go to state 51 + EL shift and go to state 116 + AND shift and go to state 86 + Equality shift and go to state 87 + EItem shift and go to state 88 + Dimensional shift and go to state 52 -state 89 +state 90 (20) S -> do id equals EA . coma EA IntOrEmpty then B end do (42) EA -> EA . SumOrSub action_3 MultDiv action_4 (43) SumOrSub -> . plus (44) SumOrSub -> . minus - coma shift and go to state 116 - plus shift and go to state 69 - minus shift and go to state 70 - - SumOrSub shift and go to state 67 - -state 90 - - (21) S -> do then B end . do - - do shift and go to state 117 + coma shift and go to state 117 + plus shift and go to state 70 + minus shift and go to state 71 + SumOrSub shift and go to state 68 state 91 + (21) S -> do then action_21 B . action_22 end do + (13) B -> B . S + (89) action_22 -> . + (15) S -> . Dimensional action_7 equals EA action_8 + (16) S -> . id parens + (17) S -> . read RDimensional + (18) S -> . print RDimOrString + (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 + (20) S -> . do id equals EA coma EA IntOrEmpty then B end do + (21) S -> . do then action_21 B action_22 end do + (22) S -> . swap Dimensional coma Dimensional + (23) S -> . exit action_23 + (24) Dimensional -> . id DimensionsOrEmpty + + end reduce using rule 89 (action_22 -> .) + id shift and go to state 13 + read shift and go to state 17 + print shift and go to state 18 + if shift and go to state 19 + do shift and go to state 20 + swap shift and go to state 21 + exit shift and go to state 22 + + action_22 shift and go to state 118 + S shift and go to state 15 + Dimensional shift and go to state 16 + +state 92 + (22) S -> swap Dimensional coma Dimensional . end reduce using rule 22 (S -> swap Dimensional coma Dimensional .) @@ -1655,7 +1690,7 @@ state 91 else reduce using rule 22 (S -> swap Dimensional coma Dimensional .) -state 92 +state 93 (11) F -> F subroutine id B end subroutine . @@ -1670,7 +1705,7 @@ state 92 exit reduce using rule 11 (F -> F subroutine id B end subroutine .) -state 93 +state 94 (5) Rid -> Rid coma id . @@ -1688,14 +1723,14 @@ state 93 exit reduce using rule 5 (Rid -> Rid coma id .) -state 94 +state 95 (9) Dim -> openBra int closedBra openBra int . closedBra - closedBra shift and go to state 118 + closedBra shift and go to state 119 -state 95 +state 96 (50) EAParens -> openParen EA closedParen . @@ -1718,7 +1753,7 @@ state 95 then reduce using rule 50 (EAParens -> openParen EA closedParen .) -state 96 +state 97 (25) DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen . @@ -1750,7 +1785,7 @@ state 96 or reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) -state 97 +state 98 (42) EA -> EA SumOrSub action_3 . MultDiv action_4 (45) MultDiv -> . EAParens @@ -1762,17 +1797,17 @@ state 97 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - MultDiv shift and go to state 119 - EAParens shift and go to state 49 - EItem shift and go to state 50 - Dimensional shift and go to state 51 + MultDiv shift and go to state 120 + EAParens shift and go to state 50 + EItem shift and go to state 51 + Dimensional shift and go to state 52 -state 98 +state 99 (27) ComaEAOrEmpty -> coma EA . (42) EA -> EA . SumOrSub action_3 MultDiv action_4 @@ -1780,12 +1815,12 @@ state 98 (44) SumOrSub -> . minus closedParen reduce using rule 27 (ComaEAOrEmpty -> coma EA .) - plus shift and go to state 69 - minus shift and go to state 70 + plus shift and go to state 70 + minus shift and go to state 71 - SumOrSub shift and go to state 67 + SumOrSub shift and go to state 68 -state 99 +state 100 (46) MultDiv -> MultDiv MDSymbols action_5 . EAParens action_6 (49) EAParens -> . EItem @@ -1795,16 +1830,16 @@ state 99 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EAParens shift and go to state 120 - EItem shift and go to state 50 - Dimensional shift and go to state 51 + EAParens shift and go to state 121 + EItem shift and go to state 51 + Dimensional shift and go to state 52 -state 100 +state 101 (15) S -> Dimensional action_7 equals EA action_8 . @@ -1820,22 +1855,22 @@ state 100 else reduce using rule 15 (S -> Dimensional action_7 equals EA action_8 .) -state 101 +state 102 (19) S -> if action_16 Relif ElseOrEmpty end . if action_20 - if shift and go to state 121 - - -state 102 - - (36) Relif -> Relif elif action_18 . openParen EL closedParen action_17 then B - - openParen shift and go to state 122 + if shift and go to state 122 state 103 + (36) Relif -> Relif elif action_18 . openParen EL closedParen action_17 then B + + openParen shift and go to state 123 + + +state 104 + (37) ElseOrEmpty -> else action_19 . B (13) B -> . B S (14) B -> . @@ -1849,27 +1884,27 @@ state 103 exit reduce using rule 14 (B -> .) end reduce using rule 14 (B -> .) - B shift and go to state 123 + B shift and go to state 124 -state 104 +state 105 (56) Equality -> openParen EL . closedParen (52) EL -> EL . or action_10 AND action_9 - closedParen shift and go to state 124 - or shift and go to state 106 + closedParen shift and go to state 125 + or shift and go to state 107 -state 105 +state 106 (35) Relif -> openParen EL closedParen . action_17 then B (84) action_17 -> . then reduce using rule 84 (action_17 -> .) - action_17 shift and go to state 125 + action_17 shift and go to state 126 -state 106 +state 107 (52) EL -> EL or . action_10 AND action_9 (77) action_10 -> . @@ -1880,9 +1915,9 @@ state 106 rea reduce using rule 77 (action_10 -> .) id reduce using rule 77 (action_10 -> .) - action_10 shift and go to state 126 + action_10 shift and go to state 127 -state 107 +state 108 (54) AND -> AND and . action_12 Equality action_11 (79) action_12 -> . @@ -1893,9 +1928,9 @@ state 107 rea reduce using rule 79 (action_12 -> .) id reduce using rule 79 (action_12 -> .) - action_12 shift and go to state 127 + action_12 shift and go to state 128 -state 108 +state 109 (55) Equality -> EItem EQSymbols . action_13 EItem action_14 (80) action_13 -> . @@ -1904,9 +1939,9 @@ state 108 rea reduce using rule 80 (action_13 -> .) id reduce using rule 80 (action_13 -> .) - action_13 shift and go to state 128 + action_13 shift and go to state 129 -state 109 +state 110 (61) EQSymbols -> less . @@ -1915,7 +1950,7 @@ state 109 id reduce using rule 61 (EQSymbols -> less .) -state 110 +state 111 (62) EQSymbols -> more . @@ -1924,7 +1959,7 @@ state 110 id reduce using rule 62 (EQSymbols -> more .) -state 111 +state 112 (63) EQSymbols -> doubleEquals . @@ -1933,7 +1968,7 @@ state 111 id reduce using rule 63 (EQSymbols -> doubleEquals .) -state 112 +state 113 (64) EQSymbols -> notEquals . @@ -1942,7 +1977,7 @@ state 112 id reduce using rule 64 (EQSymbols -> notEquals .) -state 113 +state 114 (65) EQSymbols -> lessEquals . @@ -1951,7 +1986,7 @@ state 113 id reduce using rule 65 (EQSymbols -> lessEquals .) -state 114 +state 115 (66) EQSymbols -> moreEquals . @@ -1960,22 +1995,22 @@ state 114 id reduce using rule 66 (EQSymbols -> moreEquals .) -state 115 +state 116 (57) Equality -> not EL . action_15 (52) EL -> EL . or action_10 AND action_9 (82) action_15 -> . ! shift/reduce conflict for or resolved as shift - or shift and go to state 106 + or shift and go to state 107 and reduce using rule 82 (action_15 -> .) closedParen reduce using rule 82 (action_15 -> .) ! or [ reduce using rule 82 (action_15 -> .) ] - action_15 shift and go to state 129 + action_15 shift and go to state 130 -state 116 +state 117 (20) S -> do id equals EA coma . EA IntOrEmpty then B end do (41) EA -> . MultDiv @@ -1989,41 +2024,32 @@ state 116 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 46 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 47 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EA shift and go to state 130 - MultDiv shift and go to state 48 - EAParens shift and go to state 49 - EItem shift and go to state 50 - Dimensional shift and go to state 51 - -state 117 - - (21) S -> do then B end do . - - end reduce using rule 21 (S -> do then B end do .) - id reduce using rule 21 (S -> do then B end do .) - read reduce using rule 21 (S -> do then B end do .) - print reduce using rule 21 (S -> do then B end do .) - if reduce using rule 21 (S -> do then B end do .) - do reduce using rule 21 (S -> do then B end do .) - swap reduce using rule 21 (S -> do then B end do .) - exit reduce using rule 21 (S -> do then B end do .) - elif reduce using rule 21 (S -> do then B end do .) - else reduce using rule 21 (S -> do then B end do .) - + EA shift and go to state 131 + MultDiv shift and go to state 49 + EAParens shift and go to state 50 + EItem shift and go to state 51 + Dimensional shift and go to state 52 state 118 + (21) S -> do then action_21 B action_22 . end do + + end shift and go to state 132 + + +state 119 + (9) Dim -> openBra int closedBra openBra int closedBra . doubleColon reduce using rule 9 (Dim -> openBra int closedBra openBra int closedBra .) -state 119 +state 120 (42) EA -> EA SumOrSub action_3 MultDiv . action_4 (46) MultDiv -> MultDiv . MDSymbols action_5 EAParens action_6 @@ -2046,13 +2072,13 @@ state 119 elif reduce using rule 71 (action_4 -> .) else reduce using rule 71 (action_4 -> .) then reduce using rule 71 (action_4 -> .) - mul shift and go to state 72 - div shift and go to state 73 + mul shift and go to state 73 + div shift and go to state 74 - action_4 shift and go to state 131 - MDSymbols shift and go to state 71 + action_4 shift and go to state 133 + MDSymbols shift and go to state 72 -state 120 +state 121 (46) MultDiv -> MultDiv MDSymbols action_5 EAParens . action_6 (73) action_6 -> . @@ -2075,9 +2101,9 @@ state 120 else reduce using rule 73 (action_6 -> .) then reduce using rule 73 (action_6 -> .) - action_6 shift and go to state 132 + action_6 shift and go to state 134 -state 121 +state 122 (19) S -> if action_16 Relif ElseOrEmpty end if . action_20 (87) action_20 -> . @@ -2093,9 +2119,9 @@ state 121 elif reduce using rule 87 (action_20 -> .) else reduce using rule 87 (action_20 -> .) - action_20 shift and go to state 133 + action_20 shift and go to state 135 -state 122 +state 123 (36) Relif -> Relif elif action_18 openParen . EL closedParen action_17 then B (51) EL -> . AND @@ -2110,19 +2136,19 @@ state 122 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 83 - not shift and go to state 88 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 84 + not shift and go to state 89 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EL shift and go to state 134 - AND shift and go to state 85 - Equality shift and go to state 86 - EItem shift and go to state 87 - Dimensional shift and go to state 51 + EL shift and go to state 136 + AND shift and go to state 86 + Equality shift and go to state 87 + EItem shift and go to state 88 + Dimensional shift and go to state 52 -state 123 +state 124 (37) ElseOrEmpty -> else action_19 B . (13) B -> B . S @@ -2132,9 +2158,9 @@ state 123 (18) S -> . print RDimOrString (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 (20) S -> . do id equals EA coma EA IntOrEmpty then B end do - (21) S -> . do then B end do + (21) S -> . do then action_21 B action_22 end do (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit + (23) S -> . exit action_23 (24) Dimensional -> . id DimensionsOrEmpty end reduce using rule 37 (ElseOrEmpty -> else action_19 B .) @@ -2149,7 +2175,7 @@ state 123 S shift and go to state 15 Dimensional shift and go to state 16 -state 124 +state 125 (56) Equality -> openParen EL closedParen . @@ -2158,14 +2184,14 @@ state 124 or reduce using rule 56 (Equality -> openParen EL closedParen .) -state 125 +state 126 (35) Relif -> openParen EL closedParen action_17 . then B - then shift and go to state 135 + then shift and go to state 137 -state 126 +state 127 (52) EL -> EL or action_10 . AND action_9 (53) AND -> . Equality @@ -2178,18 +2204,18 @@ state 126 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 83 - not shift and go to state 88 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 84 + not shift and go to state 89 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - AND shift and go to state 136 - Equality shift and go to state 86 - EItem shift and go to state 87 - Dimensional shift and go to state 51 + AND shift and go to state 138 + Equality shift and go to state 87 + EItem shift and go to state 88 + Dimensional shift and go to state 52 -state 127 +state 128 (54) AND -> AND and action_12 . Equality action_11 (55) Equality -> . EItem EQSymbols action_13 EItem action_14 @@ -2200,17 +2226,17 @@ state 127 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 83 - not shift and go to state 88 - int shift and go to state 52 - rea shift and go to state 53 + openParen shift and go to state 84 + not shift and go to state 89 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - Equality shift and go to state 137 - EItem shift and go to state 87 - Dimensional shift and go to state 51 + Equality shift and go to state 139 + EItem shift and go to state 88 + Dimensional shift and go to state 52 -state 128 +state 129 (55) Equality -> EItem EQSymbols action_13 . EItem action_14 (58) EItem -> . Dimensional action_1 @@ -2218,14 +2244,14 @@ state 128 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - int shift and go to state 52 - rea shift and go to state 53 + int shift and go to state 53 + rea shift and go to state 54 id shift and go to state 33 - EItem shift and go to state 138 - Dimensional shift and go to state 51 + EItem shift and go to state 140 + Dimensional shift and go to state 52 -state 129 +state 130 (57) Equality -> not EL action_15 . @@ -2234,7 +2260,7 @@ state 129 or reduce using rule 57 (Equality -> not EL action_15 .) -state 130 +state 131 (20) S -> do id equals EA coma EA . IntOrEmpty then B end do (42) EA -> EA . SumOrSub action_3 MultDiv action_4 @@ -2243,15 +2269,22 @@ state 130 (43) SumOrSub -> . plus (44) SumOrSub -> . minus - coma shift and go to state 139 + coma shift and go to state 141 then reduce using rule 40 (IntOrEmpty -> .) - plus shift and go to state 69 - minus shift and go to state 70 + plus shift and go to state 70 + minus shift and go to state 71 - IntOrEmpty shift and go to state 140 - SumOrSub shift and go to state 67 + IntOrEmpty shift and go to state 142 + SumOrSub shift and go to state 68 -state 131 +state 132 + + (21) S -> do then action_21 B action_22 end . do + + do shift and go to state 143 + + +state 133 (42) EA -> EA SumOrSub action_3 MultDiv action_4 . @@ -2272,7 +2305,7 @@ state 131 then reduce using rule 42 (EA -> EA SumOrSub action_3 MultDiv action_4 .) -state 132 +state 134 (46) MultDiv -> MultDiv MDSymbols action_5 EAParens action_6 . @@ -2295,7 +2328,7 @@ state 132 then reduce using rule 46 (MultDiv -> MultDiv MDSymbols action_5 EAParens action_6 .) -state 133 +state 135 (19) S -> if action_16 Relif ElseOrEmpty end if action_20 . @@ -2311,16 +2344,16 @@ state 133 else reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) -state 134 +state 136 (36) Relif -> Relif elif action_18 openParen EL . closedParen action_17 then B (52) EL -> EL . or action_10 AND action_9 - closedParen shift and go to state 141 - or shift and go to state 106 + closedParen shift and go to state 144 + or shift and go to state 107 -state 135 +state 137 (35) Relif -> openParen EL closedParen action_17 then . B (13) B -> . B S @@ -2337,24 +2370,24 @@ state 135 else reduce using rule 14 (B -> .) end reduce using rule 14 (B -> .) - B shift and go to state 142 + B shift and go to state 145 -state 136 +state 138 (52) EL -> EL or action_10 AND . action_9 (54) AND -> AND . and action_12 Equality action_11 (76) action_9 -> . ! shift/reduce conflict for and resolved as shift - and shift and go to state 107 + and shift and go to state 108 closedParen reduce using rule 76 (action_9 -> .) or reduce using rule 76 (action_9 -> .) ! and [ reduce using rule 76 (action_9 -> .) ] - action_9 shift and go to state 143 + action_9 shift and go to state 146 -state 137 +state 139 (54) AND -> AND and action_12 Equality . action_11 (78) action_11 -> . @@ -2363,9 +2396,9 @@ state 137 closedParen reduce using rule 78 (action_11 -> .) or reduce using rule 78 (action_11 -> .) - action_11 shift and go to state 144 + action_11 shift and go to state 147 -state 138 +state 140 (55) Equality -> EItem EQSymbols action_13 EItem . action_14 (81) action_14 -> . @@ -2374,32 +2407,48 @@ state 138 closedParen reduce using rule 81 (action_14 -> .) or reduce using rule 81 (action_14 -> .) - action_14 shift and go to state 145 + action_14 shift and go to state 148 -state 139 +state 141 (39) IntOrEmpty -> coma . int - int shift and go to state 146 + int shift and go to state 149 -state 140 +state 142 (20) S -> do id equals EA coma EA IntOrEmpty . then B end do - then shift and go to state 147 + then shift and go to state 150 -state 141 +state 143 + + (21) S -> do then action_21 B action_22 end do . + + end reduce using rule 21 (S -> do then action_21 B action_22 end do .) + id reduce using rule 21 (S -> do then action_21 B action_22 end do .) + read reduce using rule 21 (S -> do then action_21 B action_22 end do .) + print reduce using rule 21 (S -> do then action_21 B action_22 end do .) + if reduce using rule 21 (S -> do then action_21 B action_22 end do .) + do reduce using rule 21 (S -> do then action_21 B action_22 end do .) + swap reduce using rule 21 (S -> do then action_21 B action_22 end do .) + exit reduce using rule 21 (S -> do then action_21 B action_22 end do .) + elif reduce using rule 21 (S -> do then action_21 B action_22 end do .) + else reduce using rule 21 (S -> do then action_21 B action_22 end do .) + + +state 144 (36) Relif -> Relif elif action_18 openParen EL closedParen . action_17 then B (84) action_17 -> . then reduce using rule 84 (action_17 -> .) - action_17 shift and go to state 148 + action_17 shift and go to state 151 -state 142 +state 145 (35) Relif -> openParen EL closedParen action_17 then B . (13) B -> B . S @@ -2409,9 +2458,9 @@ state 142 (18) S -> . print RDimOrString (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 (20) S -> . do id equals EA coma EA IntOrEmpty then B end do - (21) S -> . do then B end do + (21) S -> . do then action_21 B action_22 end do (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit + (23) S -> . exit action_23 (24) Dimensional -> . id DimensionsOrEmpty elif reduce using rule 35 (Relif -> openParen EL closedParen action_17 then B .) @@ -2428,7 +2477,7 @@ state 142 S shift and go to state 15 Dimensional shift and go to state 16 -state 143 +state 146 (52) EL -> EL or action_10 AND action_9 . @@ -2437,7 +2486,7 @@ state 143 and reduce using rule 52 (EL -> EL or action_10 AND action_9 .) -state 144 +state 147 (54) AND -> AND and action_12 Equality action_11 . @@ -2446,7 +2495,7 @@ state 144 or reduce using rule 54 (AND -> AND and action_12 Equality action_11 .) -state 145 +state 148 (55) Equality -> EItem EQSymbols action_13 EItem action_14 . @@ -2455,14 +2504,14 @@ state 145 or reduce using rule 55 (Equality -> EItem EQSymbols action_13 EItem action_14 .) -state 146 +state 149 (39) IntOrEmpty -> coma int . then reduce using rule 39 (IntOrEmpty -> coma int .) -state 147 +state 150 (20) S -> do id equals EA coma EA IntOrEmpty then . B end do (13) B -> . B S @@ -2477,16 +2526,16 @@ state 147 swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - B shift and go to state 149 + B shift and go to state 152 -state 148 +state 151 (36) Relif -> Relif elif action_18 openParen EL closedParen action_17 . then B - then shift and go to state 150 + then shift and go to state 153 -state 149 +state 152 (20) S -> do id equals EA coma EA IntOrEmpty then B . end do (13) B -> B . S @@ -2496,12 +2545,12 @@ state 149 (18) S -> . print RDimOrString (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 (20) S -> . do id equals EA coma EA IntOrEmpty then B end do - (21) S -> . do then B end do + (21) S -> . do then action_21 B action_22 end do (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit + (23) S -> . exit action_23 (24) Dimensional -> . id DimensionsOrEmpty - end shift and go to state 151 + end shift and go to state 154 id shift and go to state 13 read shift and go to state 17 print shift and go to state 18 @@ -2513,7 +2562,7 @@ state 149 S shift and go to state 15 Dimensional shift and go to state 16 -state 150 +state 153 (36) Relif -> Relif elif action_18 openParen EL closedParen action_17 then . B (13) B -> . B S @@ -2530,16 +2579,16 @@ state 150 else reduce using rule 14 (B -> .) end reduce using rule 14 (B -> .) - B shift and go to state 152 + B shift and go to state 155 -state 151 +state 154 (20) S -> do id equals EA coma EA IntOrEmpty then B end . do - do shift and go to state 153 + do shift and go to state 156 -state 152 +state 155 (36) Relif -> Relif elif action_18 openParen EL closedParen action_17 then B . (13) B -> B . S @@ -2549,9 +2598,9 @@ state 152 (18) S -> . print RDimOrString (19) S -> . if action_16 Relif ElseOrEmpty end if action_20 (20) S -> . do id equals EA coma EA IntOrEmpty then B end do - (21) S -> . do then B end do + (21) S -> . do then action_21 B action_22 end do (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit + (23) S -> . exit action_23 (24) Dimensional -> . id DimensionsOrEmpty elif reduce using rule 36 (Relif -> Relif elif action_18 openParen EL closedParen action_17 then B .) @@ -2568,7 +2617,7 @@ state 152 S shift and go to state 15 Dimensional shift and go to state 16 -state 153 +state 156 (20) S -> do id equals EA coma EA IntOrEmpty then B end do . @@ -2586,6 +2635,6 @@ state 153 WARNING: WARNING: Conflicts: WARNING: -WARNING: shift/reduce conflict for and in state 85 resolved as shift -WARNING: shift/reduce conflict for or in state 115 resolved as shift -WARNING: shift/reduce conflict for and in state 136 resolved as shift +WARNING: shift/reduce conflict for and in state 86 resolved as shift +WARNING: shift/reduce conflict for or in state 116 resolved as shift +WARNING: shift/reduce conflict for and in state 138 resolved as shift diff --git a/final_lang/parsetab.py b/final_lang/parsetab.py index 851f987..90ae55f 100644 --- a/final_lang/parsetab.py +++ b/final_lang/parsetab.py @@ -6,9 +6,9 @@ _tabversion = '3.10' _lr_method = 'LALR' -_lr_signature = 'and closedBra closedParen coma div do doubleColon doubleEquals elif else end equals exit id if int integer less lessEquals minus more moreEquals mul not notEquals openBra openParen or parens plus print program rea read real string subroutine swap then\n programa : program id V F B end program\n \n V : V Tipo Dim doubleColon Rid\n |\n \n Rid : id\n | Rid coma id\n \n Tipo : integer\n | real\n \n Dim : openBra int closedBra\n | openBra int closedBra openBra int closedBra\n |\n \n F : F subroutine id B end subroutine\n |\n \n B : B S\n |\n \n S : Dimensional action_7 equals EA action_8\n | id parens\n | read RDimensional\n | print RDimOrString\n | if action_16 Relif ElseOrEmpty end if action_20\n | do id equals EA coma EA IntOrEmpty then B end do\n | do then B end do\n | swap Dimensional coma Dimensional\n | exit\n \n Dimensional : id DimensionsOrEmpty\n \n DimensionsOrEmpty : openParen EA ComaEAOrEmpty closedParen\n |\n \n ComaEAOrEmpty : coma EA\n |\n \n RDimensional : Dimensional\n | RDimensional coma Dimensional\n \n RDimOrString : DimOrString\n | RDimOrString coma DimOrString\n \n DimOrString : Dimensional\n | string\n \n Relif : openParen EL closedParen action_17 then B\n | Relif elif action_18 openParen EL closedParen action_17 then B\n \n ElseOrEmpty : else action_19 B\n |\n \n IntOrEmpty : coma int\n |\n \n EA : MultDiv\n | EA SumOrSub action_3 MultDiv action_4\n \n SumOrSub : plus\n | minus\n \n MultDiv : EAParens\n | MultDiv MDSymbols action_5 EAParens action_6\n \n MDSymbols : mul\n | div\n \n EAParens : EItem\n | openParen EA closedParen\n \n EL : AND\n | EL or action_10 AND action_9\n \n AND : Equality\n | AND and action_12 Equality action_11\n \n Equality : EItem EQSymbols action_13 EItem action_14\n | openParen EL closedParen\n | not EL action_15\n \n EItem : Dimensional action_1\n | int action_2\n | rea action_2_rea\n \n EQSymbols : less\n | more\n | doubleEquals\n | notEquals\n | lessEquals\n | moreEquals\n action_1 :action_2 :action_2_rea :action_3 :action_4 :action_5 :action_6 :action_7 :action_8 :action_9 :action_10 :action_11 :action_12 :action_13 :action_14 :action_15 :action_16 :action_17 :action_18 :action_19 :action_20 :' +_lr_signature = 'and closedBra closedParen coma div do doubleColon doubleEquals elif else end equals exit id if int integer less lessEquals minus more moreEquals mul not notEquals openBra openParen or parens plus print program rea read real string subroutine swap then\n programa : program id V F B end program\n \n V : V Tipo Dim doubleColon Rid\n |\n \n Rid : id\n | Rid coma id\n \n Tipo : integer\n | real\n \n Dim : openBra int closedBra\n | openBra int closedBra openBra int closedBra\n |\n \n F : F subroutine id B end subroutine\n |\n \n B : B S\n |\n \n S : Dimensional action_7 equals EA action_8\n | id parens\n | read RDimensional\n | print RDimOrString\n | if action_16 Relif ElseOrEmpty end if action_20\n | do id equals EA coma EA IntOrEmpty then B end do\n | do then action_21 B action_22 end do\n | swap Dimensional coma Dimensional\n | exit action_23\n \n Dimensional : id DimensionsOrEmpty\n \n DimensionsOrEmpty : openParen EA ComaEAOrEmpty closedParen\n |\n \n ComaEAOrEmpty : coma EA\n |\n \n RDimensional : Dimensional\n | RDimensional coma Dimensional\n \n RDimOrString : DimOrString\n | RDimOrString coma DimOrString\n \n DimOrString : Dimensional\n | string\n \n Relif : openParen EL closedParen action_17 then B\n | Relif elif action_18 openParen EL closedParen action_17 then B\n \n ElseOrEmpty : else action_19 B\n |\n \n IntOrEmpty : coma int\n |\n \n EA : MultDiv\n | EA SumOrSub action_3 MultDiv action_4\n \n SumOrSub : plus\n | minus\n \n MultDiv : EAParens\n | MultDiv MDSymbols action_5 EAParens action_6\n \n MDSymbols : mul\n | div\n \n EAParens : EItem\n | openParen EA closedParen\n \n EL : AND\n | EL or action_10 AND action_9\n \n AND : Equality\n | AND and action_12 Equality action_11\n \n Equality : EItem EQSymbols action_13 EItem action_14\n | openParen EL closedParen\n | not EL action_15\n \n EItem : Dimensional action_1\n | int action_2\n | rea action_2_rea\n \n EQSymbols : less\n | more\n | doubleEquals\n | notEquals\n | lessEquals\n | moreEquals\n action_1 :action_2 :action_2_rea :action_3 :action_4 :action_5 :action_6 :action_7 :action_8 :action_9 :action_10 :action_11 :action_12 :action_13 :action_14 :action_15 :action_16 :action_17 :action_18 :action_19 :action_20 :action_21 :action_22 :action_23 :' -_lr_action_items = {'program':([0,14,],[2,29,]),'$end':([1,29,],[0,-1,]),'id':([2,3,4,5,9,10,15,17,18,20,21,22,23,24,26,27,28,31,32,33,34,35,36,37,40,42,43,44,46,48,49,50,51,52,53,54,55,56,58,59,60,61,63,67,68,69,70,71,72,73,74,75,76,77,78,79,82,83,88,91,92,93,95,96,97,99,100,103,106,107,108,109,110,111,112,113,114,116,117,119,120,121,122,123,126,127,128,131,132,133,135,142,147,149,150,152,153,],[3,-3,-12,-14,13,23,-13,33,33,39,33,-23,-14,44,-16,-24,33,-17,-29,-26,-18,-31,-33,-34,-14,13,-2,-4,33,-41,-45,-49,-67,-68,-69,33,33,33,33,33,13,33,93,-70,33,-43,-44,-72,-47,-48,-58,-59,-60,-75,-30,-32,-86,33,33,-22,-11,-5,-50,-25,33,33,-15,-14,-77,-79,-80,-61,-62,-63,-64,-65,-66,33,-21,-71,-73,-87,33,13,33,33,33,-42,-46,-19,-14,13,-14,13,-14,13,-20,]),'integer':([3,4,43,44,93,],[-3,7,-2,-4,-5,]),'real':([3,4,43,44,93,],[-3,8,-2,-4,-5,]),'subroutine':([3,4,5,43,44,62,92,93,],[-3,-12,10,-2,-4,92,-11,-5,]),'end':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,48,49,50,51,52,53,57,60,74,75,76,77,78,79,80,82,91,92,93,95,96,100,103,117,119,120,121,123,131,132,133,135,142,147,149,150,152,153,],[-3,-12,-14,14,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,62,-2,-4,-41,-45,-49,-67,-68,-69,-38,90,-58,-59,-60,-75,-30,-32,101,-86,-22,-11,-5,-50,-25,-15,-14,-21,-71,-73,-87,-37,-42,-46,-19,-14,-35,-14,151,-14,-36,-20,]),'read':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,48,49,50,51,52,53,60,74,75,76,77,78,79,82,91,92,93,95,96,100,103,117,119,120,121,123,131,132,133,135,142,147,149,150,152,153,],[-3,-12,-14,17,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,17,-2,-4,-41,-45,-49,-67,-68,-69,17,-58,-59,-60,-75,-30,-32,-86,-22,-11,-5,-50,-25,-15,-14,-21,-71,-73,-87,17,-42,-46,-19,-14,17,-14,17,-14,17,-20,]),'print':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,48,49,50,51,52,53,60,74,75,76,77,78,79,82,91,92,93,95,96,100,103,117,119,120,121,123,131,132,133,135,142,147,149,150,152,153,],[-3,-12,-14,18,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,18,-2,-4,-41,-45,-49,-67,-68,-69,18,-58,-59,-60,-75,-30,-32,-86,-22,-11,-5,-50,-25,-15,-14,-21,-71,-73,-87,18,-42,-46,-19,-14,18,-14,18,-14,18,-20,]),'if':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,48,49,50,51,52,53,60,74,75,76,77,78,79,82,91,92,93,95,96,100,101,103,117,119,120,121,123,131,132,133,135,142,147,149,150,152,153,],[-3,-12,-14,19,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,19,-2,-4,-41,-45,-49,-67,-68,-69,19,-58,-59,-60,-75,-30,-32,-86,-22,-11,-5,-50,-25,-15,121,-14,-21,-71,-73,-87,19,-42,-46,-19,-14,19,-14,19,-14,19,-20,]),'do':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,48,49,50,51,52,53,60,74,75,76,77,78,79,82,90,91,92,93,95,96,100,103,117,119,120,121,123,131,132,133,135,142,147,149,150,151,152,153,],[-3,-12,-14,20,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,20,-2,-4,-41,-45,-49,-67,-68,-69,20,-58,-59,-60,-75,-30,-32,-86,117,-22,-11,-5,-50,-25,-15,-14,-21,-71,-73,-87,20,-42,-46,-19,-14,20,-14,20,-14,153,20,-20,]),'swap':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,48,49,50,51,52,53,60,74,75,76,77,78,79,82,91,92,93,95,96,100,103,117,119,120,121,123,131,132,133,135,142,147,149,150,152,153,],[-3,-12,-14,21,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,21,-2,-4,-41,-45,-49,-67,-68,-69,21,-58,-59,-60,-75,-30,-32,-86,-22,-11,-5,-50,-25,-15,-14,-21,-71,-73,-87,21,-42,-46,-19,-14,21,-14,21,-14,21,-20,]),'exit':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,48,49,50,51,52,53,60,74,75,76,77,78,79,82,91,92,93,95,96,100,103,117,119,120,121,123,131,132,133,135,142,147,149,150,152,153,],[-3,-12,-14,22,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,22,-2,-4,-41,-45,-49,-67,-68,-69,22,-58,-59,-60,-75,-30,-32,-86,-22,-11,-5,-50,-25,-15,-14,-21,-71,-73,-87,22,-42,-46,-19,-14,22,-14,22,-14,22,-20,]),'openBra':([6,7,8,45,],[12,-6,-7,64,]),'doubleColon':([6,7,8,11,45,118,],[-10,-6,-7,24,-8,-9,]),'int':([12,28,46,54,58,59,64,67,68,69,70,71,72,73,83,88,97,99,106,107,108,109,110,111,112,113,114,116,122,126,127,128,139,],[25,52,52,52,52,52,94,-70,52,-43,-44,-72,-47,-48,52,52,52,52,-77,-79,-80,-61,-62,-63,-64,-65,-66,52,52,52,52,52,146,]),'parens':([13,],[26,]),'openParen':([13,19,28,33,38,46,54,58,59,67,68,69,70,71,72,73,81,83,88,97,99,102,106,107,116,122,126,127,],[28,-83,46,28,58,46,46,83,46,-70,46,-43,-44,-72,-47,-48,-85,83,83,46,46,122,-77,-79,46,83,83,83,]),'equals':([13,16,27,30,39,96,],[-26,-74,-24,54,59,-25,]),'elif':([15,22,26,27,31,32,33,34,35,36,37,48,49,50,51,52,53,57,74,75,76,77,78,79,91,95,96,100,117,119,120,121,131,132,133,135,142,150,152,153,],[-13,-23,-16,-24,-17,-29,-26,-18,-31,-33,-34,-41,-45,-49,-67,-68,-69,81,-58,-59,-60,-75,-30,-32,-22,-50,-25,-15,-21,-71,-73,-87,-42,-46,-19,-14,-35,-14,-36,-20,]),'else':([15,22,26,27,31,32,33,34,35,36,37,48,49,50,51,52,53,57,74,75,76,77,78,79,91,95,96,100,117,119,120,121,131,132,133,135,142,150,152,153,],[-13,-23,-16,-24,-17,-29,-26,-18,-31,-33,-34,-41,-45,-49,-67,-68,-69,82,-58,-59,-60,-75,-30,-32,-22,-50,-25,-15,-21,-71,-73,-87,-42,-46,-19,-14,-35,-14,-36,-20,]),'string':([18,56,],[37,37,]),'then':([20,27,33,48,49,50,51,52,53,74,75,76,95,96,105,119,120,125,130,131,132,140,141,146,148,],[40,-24,-26,-41,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,-84,-71,-73,135,-40,-42,-46,147,-84,-39,150,]),'closedBra':([25,94,],[45,118,]),'coma':([27,31,32,33,34,35,36,37,41,43,44,47,48,49,50,51,52,53,74,75,76,78,79,89,93,95,96,119,120,130,131,132,],[-24,55,-29,-26,56,-31,-33,-34,61,63,-4,68,-41,-45,-49,-67,-68,-69,-58,-59,-60,-30,-32,116,-5,-50,-25,-71,-73,139,-42,-46,]),'mul':([27,33,48,49,50,51,52,53,74,75,76,95,96,119,120,132,],[-24,-26,72,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,72,-73,-46,]),'div':([27,33,48,49,50,51,52,53,74,75,76,95,96,119,120,132,],[-24,-26,73,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,73,-73,-46,]),'plus':([27,33,47,48,49,50,51,52,53,65,74,75,76,77,89,95,96,98,119,120,130,131,132,],[-24,-26,69,-41,-45,-49,-67,-68,-69,69,-58,-59,-60,69,69,-50,-25,69,-71,-73,69,-42,-46,]),'minus':([27,33,47,48,49,50,51,52,53,65,74,75,76,77,89,95,96,98,119,120,130,131,132,],[-24,-26,70,-41,-45,-49,-67,-68,-69,70,-58,-59,-60,70,70,-50,-25,70,-71,-73,70,-42,-46,]),'closedParen':([27,33,47,48,49,50,51,52,53,65,66,74,75,76,84,85,86,95,96,98,104,115,119,120,124,129,131,132,134,136,137,138,143,144,145,],[-24,-26,-28,-41,-45,-49,-67,-68,-69,95,96,-58,-59,-60,105,-51,-53,-50,-25,-27,124,-82,-71,-73,-56,-57,-42,-46,141,-76,-78,-81,-52,-54,-55,]),'less':([27,33,51,52,53,74,75,76,87,96,],[-24,-26,-67,-68,-69,-58,-59,-60,109,-25,]),'more':([27,33,51,52,53,74,75,76,87,96,],[-24,-26,-67,-68,-69,-58,-59,-60,110,-25,]),'doubleEquals':([27,33,51,52,53,74,75,76,87,96,],[-24,-26,-67,-68,-69,-58,-59,-60,111,-25,]),'notEquals':([27,33,51,52,53,74,75,76,87,96,],[-24,-26,-67,-68,-69,-58,-59,-60,112,-25,]),'lessEquals':([27,33,51,52,53,74,75,76,87,96,],[-24,-26,-67,-68,-69,-58,-59,-60,113,-25,]),'moreEquals':([27,33,51,52,53,74,75,76,87,96,],[-24,-26,-67,-68,-69,-58,-59,-60,114,-25,]),'and':([27,33,51,52,53,74,75,76,85,86,96,115,124,129,136,137,138,143,144,145,],[-24,-26,-67,-68,-69,-58,-59,-60,107,-53,-25,-82,-56,-57,107,-78,-81,-52,-54,-55,]),'or':([27,33,51,52,53,74,75,76,84,85,86,96,104,115,124,129,134,136,137,138,143,144,145,],[-24,-26,-67,-68,-69,-58,-59,-60,106,-51,-53,-25,106,106,-56,-57,106,-76,-78,-81,-52,-54,-55,]),'rea':([28,46,54,58,59,67,68,69,70,71,72,73,83,88,97,99,106,107,108,109,110,111,112,113,114,116,122,126,127,128,],[53,53,53,53,53,-70,53,-43,-44,-72,-47,-48,53,53,53,53,-77,-79,-80,-61,-62,-63,-64,-65,-66,53,53,53,53,53,]),'not':([58,83,88,106,107,122,126,127,],[88,88,88,-77,-79,88,88,88,]),} +_lr_action_items = {'program':([0,14,],[2,29,]),'$end':([1,29,],[0,-1,]),'id':([2,3,4,5,9,10,15,17,18,20,21,22,23,24,26,27,28,31,32,33,34,35,36,37,40,42,43,44,45,47,49,50,51,52,53,54,55,56,57,59,60,61,62,64,68,69,70,71,72,73,74,75,76,77,78,79,80,83,84,89,91,92,93,94,96,97,98,100,101,104,107,108,109,110,111,112,113,114,115,117,120,121,122,123,124,127,128,129,133,134,135,137,143,145,150,152,153,155,156,],[3,-3,-12,-14,13,23,-13,33,33,39,33,-90,-14,45,-16,-24,33,-17,-29,-26,-18,-31,-33,-34,-88,-23,13,-2,-4,33,-41,-45,-49,-67,-68,-69,33,33,33,33,33,-14,33,94,-70,33,-43,-44,-72,-47,-48,-58,-59,-60,-75,-30,-32,-86,33,33,13,-22,-11,-5,-50,-25,33,33,-15,-14,-77,-79,-80,-61,-62,-63,-64,-65,-66,33,-71,-73,-87,33,13,33,33,33,-42,-46,-19,-14,-21,13,-14,13,-14,13,-20,]),'integer':([3,4,44,45,94,],[-3,7,-2,-4,-5,]),'real':([3,4,44,45,94,],[-3,8,-2,-4,-5,]),'subroutine':([3,4,5,44,45,63,93,94,],[-3,-12,10,-2,-4,93,-11,-5,]),'end':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,45,49,50,51,52,53,54,58,61,75,76,77,78,79,80,81,83,91,92,93,94,96,97,101,104,118,120,121,122,124,133,134,135,137,143,145,150,152,153,155,156,],[-3,-12,-14,14,-13,-90,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-88,-23,63,-2,-4,-41,-45,-49,-67,-68,-69,-38,-14,-58,-59,-60,-75,-30,-32,102,-86,-89,-22,-11,-5,-50,-25,-15,-14,132,-71,-73,-87,-37,-42,-46,-19,-14,-21,-35,-14,154,-14,-36,-20,]),'read':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,45,49,50,51,52,53,54,61,75,76,77,78,79,80,83,91,92,93,94,96,97,101,104,120,121,122,124,133,134,135,137,143,145,150,152,153,155,156,],[-3,-12,-14,17,-13,-90,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-88,-23,17,-2,-4,-41,-45,-49,-67,-68,-69,-14,-58,-59,-60,-75,-30,-32,-86,17,-22,-11,-5,-50,-25,-15,-14,-71,-73,-87,17,-42,-46,-19,-14,-21,17,-14,17,-14,17,-20,]),'print':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,45,49,50,51,52,53,54,61,75,76,77,78,79,80,83,91,92,93,94,96,97,101,104,120,121,122,124,133,134,135,137,143,145,150,152,153,155,156,],[-3,-12,-14,18,-13,-90,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-88,-23,18,-2,-4,-41,-45,-49,-67,-68,-69,-14,-58,-59,-60,-75,-30,-32,-86,18,-22,-11,-5,-50,-25,-15,-14,-71,-73,-87,18,-42,-46,-19,-14,-21,18,-14,18,-14,18,-20,]),'if':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,45,49,50,51,52,53,54,61,75,76,77,78,79,80,83,91,92,93,94,96,97,101,102,104,120,121,122,124,133,134,135,137,143,145,150,152,153,155,156,],[-3,-12,-14,19,-13,-90,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-88,-23,19,-2,-4,-41,-45,-49,-67,-68,-69,-14,-58,-59,-60,-75,-30,-32,-86,19,-22,-11,-5,-50,-25,-15,122,-14,-71,-73,-87,19,-42,-46,-19,-14,-21,19,-14,19,-14,19,-20,]),'do':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,45,49,50,51,52,53,54,61,75,76,77,78,79,80,83,91,92,93,94,96,97,101,104,120,121,122,124,132,133,134,135,137,143,145,150,152,153,154,155,156,],[-3,-12,-14,20,-13,-90,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-88,-23,20,-2,-4,-41,-45,-49,-67,-68,-69,-14,-58,-59,-60,-75,-30,-32,-86,20,-22,-11,-5,-50,-25,-15,-14,-71,-73,-87,20,143,-42,-46,-19,-14,-21,20,-14,20,-14,156,20,-20,]),'swap':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,45,49,50,51,52,53,54,61,75,76,77,78,79,80,83,91,92,93,94,96,97,101,104,120,121,122,124,133,134,135,137,143,145,150,152,153,155,156,],[-3,-12,-14,21,-13,-90,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-88,-23,21,-2,-4,-41,-45,-49,-67,-68,-69,-14,-58,-59,-60,-75,-30,-32,-86,21,-22,-11,-5,-50,-25,-15,-14,-71,-73,-87,21,-42,-46,-19,-14,-21,21,-14,21,-14,21,-20,]),'exit':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,40,42,43,44,45,49,50,51,52,53,54,61,75,76,77,78,79,80,83,91,92,93,94,96,97,101,104,120,121,122,124,133,134,135,137,143,145,150,152,153,155,156,],[-3,-12,-14,22,-13,-90,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-88,-23,22,-2,-4,-41,-45,-49,-67,-68,-69,-14,-58,-59,-60,-75,-30,-32,-86,22,-22,-11,-5,-50,-25,-15,-14,-71,-73,-87,22,-42,-46,-19,-14,-21,22,-14,22,-14,22,-20,]),'openBra':([6,7,8,46,],[12,-6,-7,65,]),'doubleColon':([6,7,8,11,46,119,],[-10,-6,-7,24,-8,-9,]),'int':([12,28,47,55,59,60,65,68,69,70,71,72,73,74,84,89,98,100,107,108,109,110,111,112,113,114,115,117,123,127,128,129,141,],[25,53,53,53,53,53,95,-70,53,-43,-44,-72,-47,-48,53,53,53,53,-77,-79,-80,-61,-62,-63,-64,-65,-66,53,53,53,53,53,149,]),'parens':([13,],[26,]),'openParen':([13,19,28,33,38,47,55,59,60,68,69,70,71,72,73,74,82,84,89,98,100,103,107,108,117,123,127,128,],[28,-83,47,28,59,47,47,84,47,-70,47,-43,-44,-72,-47,-48,-85,84,84,47,47,123,-77,-79,47,84,84,84,]),'equals':([13,16,27,30,39,97,],[-26,-74,-24,55,60,-25,]),'elif':([15,22,26,27,31,32,33,34,35,36,37,42,49,50,51,52,53,54,58,75,76,77,78,79,80,92,96,97,101,120,121,122,133,134,135,137,143,145,153,155,156,],[-13,-90,-16,-24,-17,-29,-26,-18,-31,-33,-34,-23,-41,-45,-49,-67,-68,-69,82,-58,-59,-60,-75,-30,-32,-22,-50,-25,-15,-71,-73,-87,-42,-46,-19,-14,-21,-35,-14,-36,-20,]),'else':([15,22,26,27,31,32,33,34,35,36,37,42,49,50,51,52,53,54,58,75,76,77,78,79,80,92,96,97,101,120,121,122,133,134,135,137,143,145,153,155,156,],[-13,-90,-16,-24,-17,-29,-26,-18,-31,-33,-34,-23,-41,-45,-49,-67,-68,-69,83,-58,-59,-60,-75,-30,-32,-22,-50,-25,-15,-71,-73,-87,-42,-46,-19,-14,-21,-35,-14,-36,-20,]),'string':([18,57,],[37,37,]),'then':([20,27,33,49,50,51,52,53,54,75,76,77,96,97,106,120,121,126,131,133,134,142,144,149,151,],[40,-24,-26,-41,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,-84,-71,-73,137,-40,-42,-46,150,-84,-39,153,]),'closedBra':([25,95,],[46,119,]),'coma':([27,31,32,33,34,35,36,37,41,44,45,48,49,50,51,52,53,54,75,76,77,79,80,90,94,96,97,120,121,131,133,134,],[-24,56,-29,-26,57,-31,-33,-34,62,64,-4,69,-41,-45,-49,-67,-68,-69,-58,-59,-60,-30,-32,117,-5,-50,-25,-71,-73,141,-42,-46,]),'mul':([27,33,49,50,51,52,53,54,75,76,77,96,97,120,121,134,],[-24,-26,73,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,73,-73,-46,]),'div':([27,33,49,50,51,52,53,54,75,76,77,96,97,120,121,134,],[-24,-26,74,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,74,-73,-46,]),'plus':([27,33,48,49,50,51,52,53,54,66,75,76,77,78,90,96,97,99,120,121,131,133,134,],[-24,-26,70,-41,-45,-49,-67,-68,-69,70,-58,-59,-60,70,70,-50,-25,70,-71,-73,70,-42,-46,]),'minus':([27,33,48,49,50,51,52,53,54,66,75,76,77,78,90,96,97,99,120,121,131,133,134,],[-24,-26,71,-41,-45,-49,-67,-68,-69,71,-58,-59,-60,71,71,-50,-25,71,-71,-73,71,-42,-46,]),'closedParen':([27,33,48,49,50,51,52,53,54,66,67,75,76,77,85,86,87,96,97,99,105,116,120,121,125,130,133,134,136,138,139,140,146,147,148,],[-24,-26,-28,-41,-45,-49,-67,-68,-69,96,97,-58,-59,-60,106,-51,-53,-50,-25,-27,125,-82,-71,-73,-56,-57,-42,-46,144,-76,-78,-81,-52,-54,-55,]),'less':([27,33,52,53,54,75,76,77,88,97,],[-24,-26,-67,-68,-69,-58,-59,-60,110,-25,]),'more':([27,33,52,53,54,75,76,77,88,97,],[-24,-26,-67,-68,-69,-58,-59,-60,111,-25,]),'doubleEquals':([27,33,52,53,54,75,76,77,88,97,],[-24,-26,-67,-68,-69,-58,-59,-60,112,-25,]),'notEquals':([27,33,52,53,54,75,76,77,88,97,],[-24,-26,-67,-68,-69,-58,-59,-60,113,-25,]),'lessEquals':([27,33,52,53,54,75,76,77,88,97,],[-24,-26,-67,-68,-69,-58,-59,-60,114,-25,]),'moreEquals':([27,33,52,53,54,75,76,77,88,97,],[-24,-26,-67,-68,-69,-58,-59,-60,115,-25,]),'and':([27,33,52,53,54,75,76,77,86,87,97,116,125,130,138,139,140,146,147,148,],[-24,-26,-67,-68,-69,-58,-59,-60,108,-53,-25,-82,-56,-57,108,-78,-81,-52,-54,-55,]),'or':([27,33,52,53,54,75,76,77,85,86,87,97,105,116,125,130,136,138,139,140,146,147,148,],[-24,-26,-67,-68,-69,-58,-59,-60,107,-51,-53,-25,107,107,-56,-57,107,-76,-78,-81,-52,-54,-55,]),'rea':([28,47,55,59,60,68,69,70,71,72,73,74,84,89,98,100,107,108,109,110,111,112,113,114,115,117,123,127,128,129,],[54,54,54,54,54,-70,54,-43,-44,-72,-47,-48,54,54,54,54,-77,-79,-80,-61,-62,-63,-64,-65,-66,54,54,54,54,54,]),'not':([59,84,89,107,108,123,127,128,],[89,89,89,-77,-79,89,89,89,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): @@ -17,7 +17,7 @@ for _k, _v in _lr_action_items.items(): _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'programa':([0,],[1,]),'V':([3,],[4,]),'F':([4,],[5,]),'Tipo':([4,],[6,]),'B':([5,23,40,103,135,147,150,],[9,42,60,123,142,149,152,]),'Dim':([6,],[11,]),'S':([9,42,60,123,142,149,152,],[15,15,15,15,15,15,15,]),'Dimensional':([9,17,18,21,28,42,46,54,55,56,58,59,60,61,68,83,88,97,99,116,122,123,126,127,128,142,149,152,],[16,32,36,41,51,16,51,51,78,36,51,51,16,91,51,51,51,51,51,51,51,16,51,51,51,16,16,16,]),'DimensionsOrEmpty':([13,33,],[27,27,]),'action_7':([16,],[30,]),'RDimensional':([17,],[31,]),'RDimOrString':([18,],[34,]),'DimOrString':([18,56,],[35,79,]),'action_16':([19,],[38,]),'Rid':([24,],[43,]),'EA':([28,46,54,59,68,116,],[47,65,77,89,98,130,]),'MultDiv':([28,46,54,59,68,97,116,],[48,48,48,48,48,119,48,]),'EAParens':([28,46,54,59,68,97,99,116,],[49,49,49,49,49,49,120,49,]),'EItem':([28,46,54,58,59,68,83,88,97,99,116,122,126,127,128,],[50,50,50,87,50,50,87,87,50,50,50,87,87,87,138,]),'Relif':([38,],[57,]),'ComaEAOrEmpty':([47,],[66,]),'SumOrSub':([47,65,77,89,98,130,],[67,67,67,67,67,67,]),'MDSymbols':([48,119,],[71,71,]),'action_1':([51,],[74,]),'action_2':([52,],[75,]),'action_2_rea':([53,],[76,]),'ElseOrEmpty':([57,],[80,]),'EL':([58,83,88,122,],[84,104,115,134,]),'AND':([58,83,88,122,126,],[85,85,85,85,136,]),'Equality':([58,83,88,122,126,127,],[86,86,86,86,86,137,]),'action_3':([67,],[97,]),'action_5':([71,],[99,]),'action_8':([77,],[100,]),'action_18':([81,],[102,]),'action_19':([82,],[103,]),'EQSymbols':([87,],[108,]),'action_17':([105,141,],[125,148,]),'action_10':([106,],[126,]),'action_12':([107,],[127,]),'action_13':([108,],[128,]),'action_15':([115,],[129,]),'action_4':([119,],[131,]),'action_6':([120,],[132,]),'action_20':([121,],[133,]),'IntOrEmpty':([130,],[140,]),'action_9':([136,],[143,]),'action_11':([137,],[144,]),'action_14':([138,],[145,]),} +_lr_goto_items = {'programa':([0,],[1,]),'V':([3,],[4,]),'F':([4,],[5,]),'Tipo':([4,],[6,]),'B':([5,23,61,104,137,150,153,],[9,43,91,124,145,152,155,]),'Dim':([6,],[11,]),'S':([9,43,91,124,145,152,155,],[15,15,15,15,15,15,15,]),'Dimensional':([9,17,18,21,28,43,47,55,56,57,59,60,62,69,84,89,91,98,100,117,123,124,127,128,129,145,152,155,],[16,32,36,41,52,16,52,52,79,36,52,52,92,52,52,52,16,52,52,52,52,16,52,52,52,16,16,16,]),'DimensionsOrEmpty':([13,33,],[27,27,]),'action_7':([16,],[30,]),'RDimensional':([17,],[31,]),'RDimOrString':([18,],[34,]),'DimOrString':([18,57,],[35,80,]),'action_16':([19,],[38,]),'action_23':([22,],[42,]),'Rid':([24,],[44,]),'EA':([28,47,55,60,69,117,],[48,66,78,90,99,131,]),'MultDiv':([28,47,55,60,69,98,117,],[49,49,49,49,49,120,49,]),'EAParens':([28,47,55,60,69,98,100,117,],[50,50,50,50,50,50,121,50,]),'EItem':([28,47,55,59,60,69,84,89,98,100,117,123,127,128,129,],[51,51,51,88,51,51,88,88,51,51,51,88,88,88,140,]),'Relif':([38,],[58,]),'action_21':([40,],[61,]),'ComaEAOrEmpty':([48,],[67,]),'SumOrSub':([48,66,78,90,99,131,],[68,68,68,68,68,68,]),'MDSymbols':([49,120,],[72,72,]),'action_1':([52,],[75,]),'action_2':([53,],[76,]),'action_2_rea':([54,],[77,]),'ElseOrEmpty':([58,],[81,]),'EL':([59,84,89,123,],[85,105,116,136,]),'AND':([59,84,89,123,127,],[86,86,86,86,138,]),'Equality':([59,84,89,123,127,128,],[87,87,87,87,87,139,]),'action_3':([68,],[98,]),'action_5':([72,],[100,]),'action_8':([78,],[101,]),'action_18':([82,],[103,]),'action_19':([83,],[104,]),'EQSymbols':([88,],[109,]),'action_22':([91,],[118,]),'action_17':([106,144,],[126,151,]),'action_10':([107,],[127,]),'action_12':([108,],[128,]),'action_13':([109,],[129,]),'action_15':([116,],[130,]),'action_4':([120,],[133,]),'action_6':([121,],[134,]),'action_20':([122,],[135,]),'IntOrEmpty':([131,],[142,]),'action_9':([138,],[146,]),'action_11':([139,],[147,]),'action_14':([140,],[148,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): @@ -27,91 +27,94 @@ for _k, _v in _lr_goto_items.items(): del _lr_goto_items _lr_productions = [ ("S' -> programa","S'",1,None,None,None), - ('programa -> program id V F B end program','programa',7,'p_programa','fort.py',189), - ('V -> V Tipo Dim doubleColon Rid','V',5,'p_V','fort.py',195), - ('V -> ','V',0,'p_V','fort.py',196), - ('Rid -> id','Rid',1,'p_Rid','fort.py',207), - ('Rid -> Rid coma id','Rid',3,'p_Rid','fort.py',208), - ('Tipo -> integer','Tipo',1,'p_Tipo','fort.py',219), - ('Tipo -> real','Tipo',1,'p_Tipo','fort.py',220), - ('Dim -> openBra int closedBra','Dim',3,'p_Dim','fort.py',227), - ('Dim -> openBra int closedBra openBra int closedBra','Dim',6,'p_Dim','fort.py',228), - ('Dim -> ','Dim',0,'p_Dim','fort.py',229), - ('F -> F subroutine id B end subroutine','F',6,'p_F','fort.py',234), - ('F -> ','F',0,'p_F','fort.py',235), - ('B -> B S','B',2,'p_B','fort.py',240), - ('B -> ','B',0,'p_B','fort.py',241), - ('S -> Dimensional action_7 equals EA action_8','S',5,'p_S','fort.py',246), - ('S -> id parens','S',2,'p_S','fort.py',247), - ('S -> read RDimensional','S',2,'p_S','fort.py',248), - ('S -> print RDimOrString','S',2,'p_S','fort.py',249), - ('S -> if action_16 Relif ElseOrEmpty end if action_20','S',7,'p_S','fort.py',250), - ('S -> do id equals EA coma EA IntOrEmpty then B end do','S',11,'p_S','fort.py',251), - ('S -> do then B end do','S',5,'p_S','fort.py',252), - ('S -> swap Dimensional coma Dimensional','S',4,'p_S','fort.py',253), - ('S -> exit','S',1,'p_S','fort.py',254), - ('Dimensional -> id DimensionsOrEmpty','Dimensional',2,'p_Dimensional','fort.py',260), - ('DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen','DimensionsOrEmpty',4,'p_DimensionsOrEmpty','fort.py',267), - ('DimensionsOrEmpty -> ','DimensionsOrEmpty',0,'p_DimensionsOrEmpty','fort.py',268), - ('ComaEAOrEmpty -> coma EA','ComaEAOrEmpty',2,'p_ComaEAOrEmpty','fort.py',273), - ('ComaEAOrEmpty -> ','ComaEAOrEmpty',0,'p_ComaEAOrEmpty','fort.py',274), - ('RDimensional -> Dimensional','RDimensional',1,'p_RDimensional','fort.py',279), - ('RDimensional -> RDimensional coma Dimensional','RDimensional',3,'p_RDimensional','fort.py',280), - ('RDimOrString -> DimOrString','RDimOrString',1,'p_RDimOrString','fort.py',285), - ('RDimOrString -> RDimOrString coma DimOrString','RDimOrString',3,'p_RDimOrString','fort.py',286), - ('DimOrString -> Dimensional','DimOrString',1,'p_DimOrString','fort.py',291), - ('DimOrString -> string','DimOrString',1,'p_DimOrString','fort.py',292), - ('Relif -> openParen EL closedParen action_17 then B','Relif',6,'p_Relif','fort.py',297), - ('Relif -> Relif elif action_18 openParen EL closedParen action_17 then B','Relif',9,'p_Relif','fort.py',298), - ('ElseOrEmpty -> else action_19 B','ElseOrEmpty',3,'p_ElseOrEmpty','fort.py',303), - ('ElseOrEmpty -> ','ElseOrEmpty',0,'p_ElseOrEmpty','fort.py',304), - ('IntOrEmpty -> coma int','IntOrEmpty',2,'p_IntOrEmpty','fort.py',309), - ('IntOrEmpty -> ','IntOrEmpty',0,'p_IntOrEmpty','fort.py',310), - ('EA -> MultDiv','EA',1,'p_EA','fort.py',315), - ('EA -> EA SumOrSub action_3 MultDiv action_4','EA',5,'p_EA','fort.py',316), - ('SumOrSub -> plus','SumOrSub',1,'p_SumOrSub','fort.py',322), - ('SumOrSub -> minus','SumOrSub',1,'p_SumOrSub','fort.py',323), - ('MultDiv -> EAParens','MultDiv',1,'p_MultDiv','fort.py',329), - ('MultDiv -> MultDiv MDSymbols action_5 EAParens action_6','MultDiv',5,'p_MultDiv','fort.py',330), - ('MDSymbols -> mul','MDSymbols',1,'p_MDSymbols','fort.py',335), - ('MDSymbols -> div','MDSymbols',1,'p_MDSymbols','fort.py',336), - ('EAParens -> EItem','EAParens',1,'p_EAParens','fort.py',342), - ('EAParens -> openParen EA closedParen','EAParens',3,'p_EAParens','fort.py',343), - ('EL -> AND','EL',1,'p_EL','fort.py',348), - ('EL -> EL or action_10 AND action_9','EL',5,'p_EL','fort.py',349), - ('AND -> Equality','AND',1,'p_AND','fort.py',354), - ('AND -> AND and action_12 Equality action_11','AND',5,'p_AND','fort.py',355), - ('Equality -> EItem EQSymbols action_13 EItem action_14','Equality',5,'p_Equality','fort.py',360), - ('Equality -> openParen EL closedParen','Equality',3,'p_Equality','fort.py',361), - ('Equality -> not EL action_15','Equality',3,'p_Equality','fort.py',362), - ('EItem -> Dimensional action_1','EItem',2,'p_EItem','fort.py',367), - ('EItem -> int action_2','EItem',2,'p_EItem','fort.py',368), - ('EItem -> rea action_2_rea','EItem',2,'p_EItem','fort.py',369), - ('EQSymbols -> less','EQSymbols',1,'p_EQSymbols','fort.py',374), - ('EQSymbols -> more','EQSymbols',1,'p_EQSymbols','fort.py',375), - ('EQSymbols -> doubleEquals','EQSymbols',1,'p_EQSymbols','fort.py',376), - ('EQSymbols -> notEquals','EQSymbols',1,'p_EQSymbols','fort.py',377), - ('EQSymbols -> lessEquals','EQSymbols',1,'p_EQSymbols','fort.py',378), - ('EQSymbols -> moreEquals','EQSymbols',1,'p_EQSymbols','fort.py',379), - ('action_1 -> ','action_1',0,'p_action_1','fort.py',388), - ('action_2 -> ','action_2',0,'p_action_2','fort.py',398), - ('action_2_rea -> ','action_2_rea',0,'p_action_2_rea','fort.py',403), - ('action_3 -> ','action_3',0,'p_action_3','fort.py',408), - ('action_4 -> ','action_4',0,'p_action_4','fort.py',412), - ('action_5 -> ','action_5',0,'p_action_5','fort.py',434), - ('action_6 -> ','action_6',0,'p_action_6','fort.py',439), - ('action_7 -> ','action_7',0,'p_action_7','fort.py',462), - ('action_8 -> ','action_8',0,'p_action_8','fort.py',472), - ('action_9 -> ','action_9',0,'p_action_9','fort.py',488), - ('action_10 -> ','action_10',0,'p_action_10','fort.py',511), - ('action_11 -> ','action_11',0,'p_action_11','fort.py',516), - ('action_12 -> ','action_12',0,'p_action_12','fort.py',538), - ('action_13 -> ','action_13',0,'p_action_13','fort.py',543), - ('action_14 -> ','action_14',0,'p_action_14','fort.py',548), - ('action_15 -> ','action_15',0,'p_action_15','fort.py',570), - ('action_16 -> ','action_16',0,'p_action_16','fort.py',579), - ('action_17 -> ','action_17',0,'p_action_17','fort.py',583), - ('action_18 -> ','action_18',0,'p_action_18','fort.py',597), - ('action_19 -> ','action_19',0,'p_action_19','fort.py',607), - ('action_20 -> ','action_20',0,'p_action_20','fort.py',617), + ('programa -> program id V F B end program','programa',7,'p_programa','fort.py',190), + ('V -> V Tipo Dim doubleColon Rid','V',5,'p_V','fort.py',196), + ('V -> ','V',0,'p_V','fort.py',197), + ('Rid -> id','Rid',1,'p_Rid','fort.py',208), + ('Rid -> Rid coma id','Rid',3,'p_Rid','fort.py',209), + ('Tipo -> integer','Tipo',1,'p_Tipo','fort.py',220), + ('Tipo -> real','Tipo',1,'p_Tipo','fort.py',221), + ('Dim -> openBra int closedBra','Dim',3,'p_Dim','fort.py',228), + ('Dim -> openBra int closedBra openBra int closedBra','Dim',6,'p_Dim','fort.py',229), + ('Dim -> ','Dim',0,'p_Dim','fort.py',230), + ('F -> F subroutine id B end subroutine','F',6,'p_F','fort.py',235), + ('F -> ','F',0,'p_F','fort.py',236), + ('B -> B S','B',2,'p_B','fort.py',241), + ('B -> ','B',0,'p_B','fort.py',242), + ('S -> Dimensional action_7 equals EA action_8','S',5,'p_S','fort.py',247), + ('S -> id parens','S',2,'p_S','fort.py',248), + ('S -> read RDimensional','S',2,'p_S','fort.py',249), + ('S -> print RDimOrString','S',2,'p_S','fort.py',250), + ('S -> if action_16 Relif ElseOrEmpty end if action_20','S',7,'p_S','fort.py',251), + ('S -> do id equals EA coma EA IntOrEmpty then B end do','S',11,'p_S','fort.py',252), + ('S -> do then action_21 B action_22 end do','S',7,'p_S','fort.py',253), + ('S -> swap Dimensional coma Dimensional','S',4,'p_S','fort.py',254), + ('S -> exit action_23','S',2,'p_S','fort.py',255), + ('Dimensional -> id DimensionsOrEmpty','Dimensional',2,'p_Dimensional','fort.py',261), + ('DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen','DimensionsOrEmpty',4,'p_DimensionsOrEmpty','fort.py',268), + ('DimensionsOrEmpty -> ','DimensionsOrEmpty',0,'p_DimensionsOrEmpty','fort.py',269), + ('ComaEAOrEmpty -> coma EA','ComaEAOrEmpty',2,'p_ComaEAOrEmpty','fort.py',274), + ('ComaEAOrEmpty -> ','ComaEAOrEmpty',0,'p_ComaEAOrEmpty','fort.py',275), + ('RDimensional -> Dimensional','RDimensional',1,'p_RDimensional','fort.py',280), + ('RDimensional -> RDimensional coma Dimensional','RDimensional',3,'p_RDimensional','fort.py',281), + ('RDimOrString -> DimOrString','RDimOrString',1,'p_RDimOrString','fort.py',286), + ('RDimOrString -> RDimOrString coma DimOrString','RDimOrString',3,'p_RDimOrString','fort.py',287), + ('DimOrString -> Dimensional','DimOrString',1,'p_DimOrString','fort.py',292), + ('DimOrString -> string','DimOrString',1,'p_DimOrString','fort.py',293), + ('Relif -> openParen EL closedParen action_17 then B','Relif',6,'p_Relif','fort.py',298), + ('Relif -> Relif elif action_18 openParen EL closedParen action_17 then B','Relif',9,'p_Relif','fort.py',299), + ('ElseOrEmpty -> else action_19 B','ElseOrEmpty',3,'p_ElseOrEmpty','fort.py',304), + ('ElseOrEmpty -> ','ElseOrEmpty',0,'p_ElseOrEmpty','fort.py',305), + ('IntOrEmpty -> coma int','IntOrEmpty',2,'p_IntOrEmpty','fort.py',310), + ('IntOrEmpty -> ','IntOrEmpty',0,'p_IntOrEmpty','fort.py',311), + ('EA -> MultDiv','EA',1,'p_EA','fort.py',316), + ('EA -> EA SumOrSub action_3 MultDiv action_4','EA',5,'p_EA','fort.py',317), + ('SumOrSub -> plus','SumOrSub',1,'p_SumOrSub','fort.py',323), + ('SumOrSub -> minus','SumOrSub',1,'p_SumOrSub','fort.py',324), + ('MultDiv -> EAParens','MultDiv',1,'p_MultDiv','fort.py',330), + ('MultDiv -> MultDiv MDSymbols action_5 EAParens action_6','MultDiv',5,'p_MultDiv','fort.py',331), + ('MDSymbols -> mul','MDSymbols',1,'p_MDSymbols','fort.py',336), + ('MDSymbols -> div','MDSymbols',1,'p_MDSymbols','fort.py',337), + ('EAParens -> EItem','EAParens',1,'p_EAParens','fort.py',343), + ('EAParens -> openParen EA closedParen','EAParens',3,'p_EAParens','fort.py',344), + ('EL -> AND','EL',1,'p_EL','fort.py',349), + ('EL -> EL or action_10 AND action_9','EL',5,'p_EL','fort.py',350), + ('AND -> Equality','AND',1,'p_AND','fort.py',355), + ('AND -> AND and action_12 Equality action_11','AND',5,'p_AND','fort.py',356), + ('Equality -> EItem EQSymbols action_13 EItem action_14','Equality',5,'p_Equality','fort.py',361), + ('Equality -> openParen EL closedParen','Equality',3,'p_Equality','fort.py',362), + ('Equality -> not EL action_15','Equality',3,'p_Equality','fort.py',363), + ('EItem -> Dimensional action_1','EItem',2,'p_EItem','fort.py',368), + ('EItem -> int action_2','EItem',2,'p_EItem','fort.py',369), + ('EItem -> rea action_2_rea','EItem',2,'p_EItem','fort.py',370), + ('EQSymbols -> less','EQSymbols',1,'p_EQSymbols','fort.py',375), + ('EQSymbols -> more','EQSymbols',1,'p_EQSymbols','fort.py',376), + ('EQSymbols -> doubleEquals','EQSymbols',1,'p_EQSymbols','fort.py',377), + ('EQSymbols -> notEquals','EQSymbols',1,'p_EQSymbols','fort.py',378), + ('EQSymbols -> lessEquals','EQSymbols',1,'p_EQSymbols','fort.py',379), + ('EQSymbols -> moreEquals','EQSymbols',1,'p_EQSymbols','fort.py',380), + ('action_1 -> ','action_1',0,'p_action_1','fort.py',389), + ('action_2 -> ','action_2',0,'p_action_2','fort.py',399), + ('action_2_rea -> ','action_2_rea',0,'p_action_2_rea','fort.py',404), + ('action_3 -> ','action_3',0,'p_action_3','fort.py',409), + ('action_4 -> ','action_4',0,'p_action_4','fort.py',413), + ('action_5 -> ','action_5',0,'p_action_5','fort.py',435), + ('action_6 -> ','action_6',0,'p_action_6','fort.py',440), + ('action_7 -> ','action_7',0,'p_action_7','fort.py',463), + ('action_8 -> ','action_8',0,'p_action_8','fort.py',473), + ('action_9 -> ','action_9',0,'p_action_9','fort.py',489), + ('action_10 -> ','action_10',0,'p_action_10','fort.py',512), + ('action_11 -> ','action_11',0,'p_action_11','fort.py',517), + ('action_12 -> ','action_12',0,'p_action_12','fort.py',539), + ('action_13 -> ','action_13',0,'p_action_13','fort.py',544), + ('action_14 -> ','action_14',0,'p_action_14','fort.py',549), + ('action_15 -> ','action_15',0,'p_action_15','fort.py',571), + ('action_16 -> ','action_16',0,'p_action_16','fort.py',580), + ('action_17 -> ','action_17',0,'p_action_17','fort.py',584), + ('action_18 -> ','action_18',0,'p_action_18','fort.py',599), + ('action_19 -> ','action_19',0,'p_action_19','fort.py',609), + ('action_20 -> ','action_20',0,'p_action_20','fort.py',619), + ('action_21 -> ','action_21',0,'p_action_21','fort.py',627), + ('action_22 -> ','action_22',0,'p_action_22','fort.py',633), + ('action_23 -> ','action_23',0,'p_action_23','fort.py',646), ] diff --git a/final_lang/test2.fort b/final_lang/test2.fort index cf47372..02000e7 100644 --- a/final_lang/test2.fort +++ b/final_lang/test2.fort @@ -1,5 +1,6 @@ program test integer :: a, b, c, d, x, y, z, w +real :: e, f a = 2 + 4 * (2 + 1) / 3 * b b = a if (a > b) then @@ -11,4 +12,10 @@ elif (a > d) then else a = w end if +do then + if (a > b .or. c > b) then + exit + end if + a = a + 1 +end do end program \ No newline at end of file diff --git a/final_lang/test2.fort.out b/final_lang/test2.fort.out index bda7795..f612676 100644 --- a/final_lang/test2.fort.out +++ b/final_lang/test2.fort.out @@ -18,3 +18,11 @@ gotoF $0 20 = $56 $50 goto 21 = $57 $50 +> $50 $51 $0 +> $52 $51 $1 +.or. $0 $1 $2 +gotoF $2 26 +goto 29 ++ $50 1 $2 += $2 $50 +goto 21