diff --git a/final_lang/fort.py b/final_lang/fort.py index 2f16486..864ce8b 100644 --- a/final_lang/fort.py +++ b/final_lang/fort.py @@ -10,6 +10,8 @@ from typeValidation import resultingType kEqualityOperators = ['>', '<', '>=', '<=', '==', '/=',] resultQuadruplets = [] +# The first quadruplet will be line 1, that way it will match the lines in +# the editor and will be easier to analyze. quadrupletIndex = 1 # Auxiliary stacks. @@ -59,7 +61,8 @@ def isTemp(operand): def fillGoto(position, fillValue): global resultQuadruplets - resultQuadruplets[position] = resultQuadruplets[position].replace('_', str(fillValue)) + # Using position - 1 because the quadruplets start at 1 and not 0. + resultQuadruplets[position-1] = resultQuadruplets[position-1].replace('_', str(fillValue)) return #---------------------------------------------------------------------------- @@ -245,7 +248,7 @@ def p_S(p): | id parens | read RDimensional | print RDimOrString - | if Relif ElseOrEmpty end if + | 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 | swap Dimensional coma Dimensional @@ -292,13 +295,13 @@ def p_DimOrString(p): def p_Relif(p): ''' - Relif : openParen EL closedParen then B - | Relif elif openParen EL closedParen then B + Relif : openParen EL closedParen action_17 then B + | Relif elif action_18 openParen EL closedParen action_17 then B ''' def p_ElseOrEmpty(p): ''' - ElseOrEmpty : else B + ElseOrEmpty : else action_19 B | ''' @@ -573,6 +576,52 @@ def p_action_15(p): resultQuadruplets.append('.not. ' + str(operand1) + ' ' + str(operand1) + '\n') +def p_action_16(p): + "action_16 :" + jumpsStack.append('$') + +def p_action_17(p): + "action_17 :" + global quadrupletIndex + global avail + operand1 = operandsStack.pop() + type1 = typesStack.pop() + if (type1 is not 'bool'): + raise Exception('Can\'t use non logical expression as conditional for if') + jumpsStack.append(quadrupletIndex) + resultQuadruplets.append('gotoF ' + str(operand1) + ' _\n') + quadrupletIndex += 1 + if (isTemp(operand1)): + avail = [operand1] + avail + + +def p_action_18(p): + "action_18 :" + global quadrupletIndex + resultQuadruplets.append('goto _\n') + quadrupletIndex += 1 + Dir = jumpsStack.pop() + fillGoto(Dir, quadrupletIndex) + jumpsStack.append(quadrupletIndex - 1) + + +def p_action_19(p): + "action_19 :" + global quadrupletIndex + resultQuadruplets.append('goto _\n') + quadrupletIndex += 1 + Dir = jumpsStack.pop() + fillGoto(Dir, quadrupletIndex) + jumpsStack.append(quadrupletIndex - 1) + + +def p_action_20(p): + "action_20 :" + while(peek(jumpsStack) is not '$'): + Dir = jumpsStack.pop() + fillGoto(Dir, quadrupletIndex) + jumpsStack.pop() + def p_error(p): print('XXX Invalid program') print(p) diff --git a/final_lang/parser.out b/final_lang/parser.out index 1c10fd3..9c46fda 100644 --- a/final_lang/parser.out +++ b/final_lang/parser.out @@ -21,7 +21,7 @@ Rule 15 S -> Dimensional action_7 equals EA action_8 Rule 16 S -> id parens Rule 17 S -> read RDimensional Rule 18 S -> print RDimOrString -Rule 19 S -> if Relif ElseOrEmpty end if +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 22 S -> swap Dimensional coma Dimensional @@ -37,9 +37,9 @@ Rule 31 RDimOrString -> DimOrString Rule 32 RDimOrString -> RDimOrString coma DimOrString Rule 33 DimOrString -> Dimensional Rule 34 DimOrString -> string -Rule 35 Relif -> openParen EL closedParen then B -Rule 36 Relif -> Relif elif openParen EL closedParen then B -Rule 37 ElseOrEmpty -> else B +Rule 35 Relif -> openParen EL closedParen action_17 then B +Rule 36 Relif -> Relif elif action_18 openParen EL closedParen action_17 then B +Rule 37 ElseOrEmpty -> else action_19 B Rule 38 ElseOrEmpty -> Rule 39 IntOrEmpty -> coma int Rule 40 IntOrEmpty -> @@ -85,6 +85,11 @@ Rule 79 action_12 -> Rule 80 action_13 -> Rule 81 action_14 -> Rule 82 action_15 -> +Rule 83 action_16 -> +Rule 84 action_17 -> +Rule 85 action_18 -> +Rule 86 action_19 -> +Rule 87 action_20 -> Terminals, with rules where they appear @@ -164,7 +169,12 @@ action_12 : 54 action_13 : 55 action_14 : 55 action_15 : 57 +action_16 : 19 +action_17 : 35 36 +action_18 : 36 +action_19 : 37 action_2 : 59 +action_20 : 19 action_2_rea : 60 action_3 : 42 action_4 : 42 @@ -298,7 +308,7 @@ state 9 (16) S -> . id parens (17) S -> . read RDimensional (18) S -> . print RDimOrString - (19) S -> . if Relif ElseOrEmpty end if + (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 @@ -414,21 +424,20 @@ state 18 state 19 - (19) S -> if . Relif ElseOrEmpty end if - (35) Relif -> . openParen EL closedParen then B - (36) Relif -> . Relif elif openParen EL closedParen then B + (19) S -> if . action_16 Relif ElseOrEmpty end if action_20 + (83) action_16 -> . - openParen shift and go to state 39 + openParen reduce using rule 83 (action_16 -> .) - Relif shift and go to state 38 + action_16 shift and go to state 38 state 20 (20) S -> do . id equals EA coma EA IntOrEmpty then B end do (21) S -> do . then B end do - id shift and go to state 40 - then shift and go to state 41 + id shift and go to state 39 + then shift and go to state 40 state 21 @@ -438,7 +447,7 @@ state 21 id shift and go to state 33 - Dimensional shift and go to state 42 + Dimensional shift and go to state 41 state 22 @@ -471,7 +480,7 @@ state 23 swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - B shift and go to state 43 + B shift and go to state 42 state 24 @@ -479,16 +488,16 @@ state 24 (4) Rid -> . id (5) Rid -> . Rid coma id - id shift and go to state 45 + id shift and go to state 44 - Rid shift and go to state 44 + Rid shift and go to state 43 state 25 (8) Dim -> openBra int . closedBra (9) Dim -> openBra int . closedBra openBra int closedBra - closedBra shift and go to state 46 + closedBra shift and go to state 45 state 26 @@ -553,16 +562,16 @@ state 28 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - 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 + 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 state 29 @@ -575,7 +584,7 @@ state 30 (15) S -> Dimensional action_7 . equals EA action_8 - equals shift and go to state 55 + equals shift and go to state 54 state 31 @@ -593,7 +602,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 56 + coma shift and go to state 55 state 32 @@ -663,7 +672,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 57 + coma shift and go to state 56 state 35 @@ -719,52 +728,22 @@ state 37 state 38 - (19) S -> if Relif . ElseOrEmpty end if - (36) Relif -> Relif . elif openParen EL closedParen then B - (37) ElseOrEmpty -> . else B - (38) ElseOrEmpty -> . + (19) S -> if action_16 . Relif ElseOrEmpty end if action_20 + (35) Relif -> . openParen EL closedParen action_17 then B + (36) Relif -> . Relif elif action_18 openParen EL closedParen action_17 then B - elif shift and go to state 59 - else shift and go to state 60 - end reduce using rule 38 (ElseOrEmpty -> .) + openParen shift and go to state 58 - ElseOrEmpty shift and go to state 58 + Relif shift and go to state 57 state 39 - (35) Relif -> openParen . EL closedParen then B - (51) EL -> . AND - (52) EL -> . EL or action_10 AND action_9 - (53) AND -> . Equality - (54) AND -> . AND and action_12 Equality action_11 - (55) Equality -> . EItem EQSymbols action_13 EItem action_14 - (56) Equality -> . openParen EL closedParen - (57) Equality -> . not EL action_15 - (58) EItem -> . Dimensional action_1 - (59) EItem -> . int action_2 - (60) EItem -> . rea action_2_rea - (24) Dimensional -> . id DimensionsOrEmpty - - openParen shift and go to state 61 - not shift and go to state 66 - 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 62 - AND shift and go to state 63 - Equality shift and go to state 64 - EItem shift and go to state 65 - Dimensional shift and go to state 52 - -state 40 - (20) S -> do id . equals EA coma EA IntOrEmpty then B end do - equals shift and go to state 67 + equals shift and go to state 59 -state 41 +state 40 (21) S -> do then . B end do (13) B -> . B S @@ -779,16 +758,16 @@ state 41 swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - B shift and go to state 68 + B shift and go to state 60 -state 42 +state 41 (22) S -> swap Dimensional . coma Dimensional - coma shift and go to state 69 + coma shift and go to state 61 -state 43 +state 42 (11) F -> F subroutine id B . end subroutine (13) B -> B . S @@ -796,14 +775,14 @@ state 43 (16) S -> . id parens (17) S -> . read RDimensional (18) S -> . print RDimOrString - (19) S -> . if Relif ElseOrEmpty end if + (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 70 + end shift and go to state 62 id shift and go to state 13 read shift and go to state 17 print shift and go to state 18 @@ -815,7 +794,7 @@ state 43 S shift and go to state 15 Dimensional shift and go to state 16 -state 44 +state 43 (2) V -> V Tipo Dim doubleColon Rid . (5) Rid -> Rid . coma id @@ -831,10 +810,10 @@ state 44 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 71 + coma shift and go to state 63 -state 45 +state 44 (4) Rid -> id . @@ -852,16 +831,16 @@ state 45 exit reduce using rule 4 (Rid -> id .) -state 46 +state 45 (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 72 + openBra shift and go to state 64 -state 47 +state 46 (50) EAParens -> openParen . EA closedParen (41) EA -> . MultDiv @@ -875,18 +854,18 @@ state 47 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - EA shift and go to state 73 - 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 + 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 -state 48 +state 47 (25) DimensionsOrEmpty -> openParen EA . ComaEAOrEmpty closedParen (42) EA -> EA . SumOrSub action_3 MultDiv action_4 @@ -895,15 +874,15 @@ state 48 (43) SumOrSub -> . plus (44) SumOrSub -> . minus - coma shift and go to state 76 + coma shift and go to state 68 closedParen reduce using rule 28 (ComaEAOrEmpty -> .) - plus shift and go to state 77 - minus shift and go to state 78 + plus shift and go to state 69 + minus shift and go to state 70 - ComaEAOrEmpty shift and go to state 74 - SumOrSub shift and go to state 75 + ComaEAOrEmpty shift and go to state 66 + SumOrSub shift and go to state 67 -state 49 +state 48 (41) EA -> MultDiv . (46) MultDiv -> MultDiv . MDSymbols action_5 EAParens action_6 @@ -925,12 +904,12 @@ state 49 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 80 - div shift and go to state 81 + mul shift and go to state 72 + div shift and go to state 73 - MDSymbols shift and go to state 79 + MDSymbols shift and go to state 71 -state 50 +state 49 (45) MultDiv -> EAParens . @@ -953,7 +932,7 @@ state 50 then reduce using rule 45 (MultDiv -> EAParens .) -state 51 +state 50 (49) EAParens -> EItem . @@ -976,7 +955,7 @@ state 51 then reduce using rule 49 (EAParens -> EItem .) -state 52 +state 51 (58) EItem -> Dimensional . action_1 (67) action_1 -> . @@ -987,12 +966,6 @@ state 52 plus reduce using rule 67 (action_1 -> .) minus reduce using rule 67 (action_1 -> .) closedParen reduce using rule 67 (action_1 -> .) - less reduce using rule 67 (action_1 -> .) - more reduce using rule 67 (action_1 -> .) - doubleEquals reduce using rule 67 (action_1 -> .) - notEquals reduce using rule 67 (action_1 -> .) - lessEquals reduce using rule 67 (action_1 -> .) - moreEquals reduce using rule 67 (action_1 -> .) end reduce using rule 67 (action_1 -> .) id reduce using rule 67 (action_1 -> .) read reduce using rule 67 (action_1 -> .) @@ -1003,13 +976,19 @@ state 52 exit reduce using rule 67 (action_1 -> .) elif reduce using rule 67 (action_1 -> .) else reduce using rule 67 (action_1 -> .) + less reduce using rule 67 (action_1 -> .) + more reduce using rule 67 (action_1 -> .) + doubleEquals reduce using rule 67 (action_1 -> .) + notEquals reduce using rule 67 (action_1 -> .) + lessEquals reduce using rule 67 (action_1 -> .) + moreEquals reduce using rule 67 (action_1 -> .) then reduce using rule 67 (action_1 -> .) and reduce using rule 67 (action_1 -> .) or reduce using rule 67 (action_1 -> .) - action_1 shift and go to state 82 + action_1 shift and go to state 74 -state 53 +state 52 (59) EItem -> int . action_2 (68) action_2 -> . @@ -1020,12 +999,6 @@ state 53 plus reduce using rule 68 (action_2 -> .) minus reduce using rule 68 (action_2 -> .) closedParen reduce using rule 68 (action_2 -> .) - less reduce using rule 68 (action_2 -> .) - more reduce using rule 68 (action_2 -> .) - doubleEquals reduce using rule 68 (action_2 -> .) - notEquals reduce using rule 68 (action_2 -> .) - lessEquals reduce using rule 68 (action_2 -> .) - moreEquals reduce using rule 68 (action_2 -> .) end reduce using rule 68 (action_2 -> .) id reduce using rule 68 (action_2 -> .) read reduce using rule 68 (action_2 -> .) @@ -1036,13 +1009,19 @@ state 53 exit reduce using rule 68 (action_2 -> .) elif reduce using rule 68 (action_2 -> .) else reduce using rule 68 (action_2 -> .) + less reduce using rule 68 (action_2 -> .) + more reduce using rule 68 (action_2 -> .) + doubleEquals reduce using rule 68 (action_2 -> .) + notEquals reduce using rule 68 (action_2 -> .) + lessEquals reduce using rule 68 (action_2 -> .) + moreEquals reduce using rule 68 (action_2 -> .) then reduce using rule 68 (action_2 -> .) and reduce using rule 68 (action_2 -> .) or reduce using rule 68 (action_2 -> .) - action_2 shift and go to state 83 + action_2 shift and go to state 75 -state 54 +state 53 (60) EItem -> rea . action_2_rea (69) action_2_rea -> . @@ -1053,12 +1032,6 @@ state 54 plus reduce using rule 69 (action_2_rea -> .) minus reduce using rule 69 (action_2_rea -> .) closedParen reduce using rule 69 (action_2_rea -> .) - less reduce using rule 69 (action_2_rea -> .) - more reduce using rule 69 (action_2_rea -> .) - doubleEquals reduce using rule 69 (action_2_rea -> .) - notEquals reduce using rule 69 (action_2_rea -> .) - lessEquals reduce using rule 69 (action_2_rea -> .) - moreEquals reduce using rule 69 (action_2_rea -> .) end reduce using rule 69 (action_2_rea -> .) id reduce using rule 69 (action_2_rea -> .) read reduce using rule 69 (action_2_rea -> .) @@ -1069,13 +1042,19 @@ state 54 exit reduce using rule 69 (action_2_rea -> .) elif reduce using rule 69 (action_2_rea -> .) else reduce using rule 69 (action_2_rea -> .) + less reduce using rule 69 (action_2_rea -> .) + more reduce using rule 69 (action_2_rea -> .) + doubleEquals reduce using rule 69 (action_2_rea -> .) + notEquals reduce using rule 69 (action_2_rea -> .) + lessEquals reduce using rule 69 (action_2_rea -> .) + moreEquals reduce using rule 69 (action_2_rea -> .) then reduce using rule 69 (action_2_rea -> .) and reduce using rule 69 (action_2_rea -> .) or reduce using rule 69 (action_2_rea -> .) - action_2_rea shift and go to state 84 + action_2_rea shift and go to state 76 -state 55 +state 54 (15) S -> Dimensional action_7 equals . EA action_8 (41) EA -> . MultDiv @@ -1089,27 +1068,27 @@ state 55 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - Dimensional shift and go to state 52 - EA shift and go to state 85 - 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 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 -state 56 +state 55 (30) RDimensional -> RDimensional coma . Dimensional (24) Dimensional -> . id DimensionsOrEmpty id shift and go to state 33 - Dimensional shift and go to state 86 + Dimensional shift and go to state 78 -state 57 +state 56 (32) RDimOrString -> RDimOrString coma . DimOrString (33) DimOrString -> . Dimensional @@ -1119,146 +1098,51 @@ state 57 string shift and go to state 37 id shift and go to state 33 - DimOrString shift and go to state 87 + DimOrString shift and go to state 79 Dimensional shift and go to state 36 +state 57 + + (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 + end reduce using rule 38 (ElseOrEmpty -> .) + + ElseOrEmpty shift and go to state 80 + state 58 - (19) S -> if Relif ElseOrEmpty . end if + (35) Relif -> openParen . EL closedParen action_17 then B + (51) EL -> . AND + (52) EL -> . EL or action_10 AND action_9 + (53) AND -> . Equality + (54) AND -> . AND and action_12 Equality action_11 + (55) Equality -> . EItem EQSymbols action_13 EItem action_14 + (56) Equality -> . openParen EL closedParen + (57) Equality -> . not EL action_15 + (58) EItem -> . Dimensional action_1 + (59) EItem -> . int action_2 + (60) EItem -> . rea action_2_rea + (24) Dimensional -> . id DimensionsOrEmpty - end shift and go to state 88 + 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 + 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 state 59 - (36) Relif -> Relif elif . openParen EL closedParen then B - - openParen shift and go to state 89 - - -state 60 - - (37) ElseOrEmpty -> else . B - (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 90 - -state 61 - - (56) Equality -> openParen . EL closedParen - (51) EL -> . AND - (52) EL -> . EL or action_10 AND action_9 - (53) AND -> . Equality - (54) AND -> . AND and action_12 Equality action_11 - (55) Equality -> . EItem EQSymbols action_13 EItem action_14 - (56) Equality -> . openParen EL closedParen - (57) Equality -> . not EL action_15 - (58) EItem -> . Dimensional action_1 - (59) EItem -> . int action_2 - (60) EItem -> . rea action_2_rea - (24) Dimensional -> . id DimensionsOrEmpty - - openParen shift and go to state 61 - not shift and go to state 66 - 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 91 - AND shift and go to state 63 - Equality shift and go to state 64 - EItem shift and go to state 65 - Dimensional shift and go to state 52 - -state 62 - - (35) Relif -> openParen EL . closedParen then B - (52) EL -> EL . or action_10 AND action_9 - - closedParen shift and go to state 92 - or shift and go to state 93 - - -state 63 - - (51) EL -> AND . - (54) AND -> AND . and action_12 Equality action_11 - - ! 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 94 - - ! and [ reduce using rule 51 (EL -> AND .) ] - - -state 64 - - (53) AND -> Equality . - - and reduce using rule 53 (AND -> Equality .) - closedParen reduce using rule 53 (AND -> Equality .) - or reduce using rule 53 (AND -> Equality .) - - -state 65 - - (55) Equality -> EItem . EQSymbols action_13 EItem action_14 - (61) EQSymbols -> . less - (62) EQSymbols -> . more - (63) EQSymbols -> . doubleEquals - (64) EQSymbols -> . notEquals - (65) EQSymbols -> . lessEquals - (66) EQSymbols -> . moreEquals - - less shift and go to state 96 - more shift and go to state 97 - doubleEquals shift and go to state 98 - notEquals shift and go to state 99 - lessEquals shift and go to state 100 - moreEquals shift and go to state 101 - - EQSymbols shift and go to state 95 - -state 66 - - (57) Equality -> not . EL action_15 - (51) EL -> . AND - (52) EL -> . EL or action_10 AND action_9 - (53) AND -> . Equality - (54) AND -> . AND and action_12 Equality action_11 - (55) Equality -> . EItem EQSymbols action_13 EItem action_14 - (56) Equality -> . openParen EL closedParen - (57) Equality -> . not EL action_15 - (58) EItem -> . Dimensional action_1 - (59) EItem -> . int action_2 - (60) EItem -> . rea action_2_rea - (24) Dimensional -> . id DimensionsOrEmpty - - openParen shift and go to state 61 - not shift and go to state 66 - 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 102 - AND shift and go to state 63 - Equality shift and go to state 64 - EItem shift and go to state 65 - Dimensional shift and go to state 52 - -state 67 - (20) S -> do id equals . EA coma EA IntOrEmpty then B end do (41) EA -> . MultDiv (42) EA -> . EA SumOrSub action_3 MultDiv action_4 @@ -1271,18 +1155,18 @@ state 67 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - EA shift and go to state 103 - 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 + 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 68 +state 60 (21) S -> do then B . end do (13) B -> B . S @@ -1290,14 +1174,14 @@ state 68 (16) S -> . id parens (17) S -> . read RDimensional (18) S -> . print RDimOrString - (19) S -> . if Relif ElseOrEmpty end if + (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 104 + 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 @@ -1309,57 +1193,57 @@ state 68 S shift and go to state 15 Dimensional shift and go to state 16 -state 69 +state 61 (22) S -> swap Dimensional coma . Dimensional (24) Dimensional -> . id DimensionsOrEmpty id shift and go to state 33 - Dimensional shift and go to state 105 + Dimensional shift and go to state 91 -state 70 +state 62 (11) F -> F subroutine id B end . subroutine - subroutine shift and go to state 106 + subroutine shift and go to state 92 -state 71 +state 63 (5) Rid -> Rid coma . id - id shift and go to state 107 + id shift and go to state 93 -state 72 +state 64 (9) Dim -> openBra int closedBra openBra . int closedBra - int shift and go to state 108 + int shift and go to state 94 -state 73 +state 65 (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 109 - plus shift and go to state 77 - minus shift and go to state 78 + closedParen shift and go to state 95 + plus shift and go to state 69 + minus shift and go to state 70 - SumOrSub shift and go to state 75 + SumOrSub shift and go to state 67 -state 74 +state 66 (25) DimensionsOrEmpty -> openParen EA ComaEAOrEmpty . closedParen - closedParen shift and go to state 110 + closedParen shift and go to state 96 -state 75 +state 67 (42) EA -> EA SumOrSub . action_3 MultDiv action_4 (70) action_3 -> . @@ -1369,9 +1253,9 @@ state 75 rea reduce using rule 70 (action_3 -> .) id reduce using rule 70 (action_3 -> .) - action_3 shift and go to state 111 + action_3 shift and go to state 97 -state 76 +state 68 (27) ComaEAOrEmpty -> coma . EA (41) EA -> . MultDiv @@ -1385,18 +1269,18 @@ state 76 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - EA shift and go to state 112 - 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 + 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 -state 77 +state 69 (43) SumOrSub -> plus . @@ -1406,7 +1290,7 @@ state 77 id reduce using rule 43 (SumOrSub -> plus .) -state 78 +state 70 (44) SumOrSub -> minus . @@ -1416,7 +1300,7 @@ state 78 id reduce using rule 44 (SumOrSub -> minus .) -state 79 +state 71 (46) MultDiv -> MultDiv MDSymbols . action_5 EAParens action_6 (72) action_5 -> . @@ -1426,9 +1310,9 @@ state 79 rea reduce using rule 72 (action_5 -> .) id reduce using rule 72 (action_5 -> .) - action_5 shift and go to state 113 + action_5 shift and go to state 99 -state 80 +state 72 (47) MDSymbols -> mul . @@ -1438,7 +1322,7 @@ state 80 id reduce using rule 47 (MDSymbols -> mul .) -state 81 +state 73 (48) MDSymbols -> div . @@ -1448,7 +1332,7 @@ state 81 id reduce using rule 48 (MDSymbols -> div .) -state 82 +state 74 (58) EItem -> Dimensional action_1 . @@ -1458,12 +1342,6 @@ state 82 plus reduce using rule 58 (EItem -> Dimensional action_1 .) minus reduce using rule 58 (EItem -> Dimensional action_1 .) closedParen reduce using rule 58 (EItem -> Dimensional action_1 .) - less reduce using rule 58 (EItem -> Dimensional action_1 .) - more reduce using rule 58 (EItem -> Dimensional action_1 .) - doubleEquals reduce using rule 58 (EItem -> Dimensional action_1 .) - notEquals reduce using rule 58 (EItem -> Dimensional action_1 .) - lessEquals reduce using rule 58 (EItem -> Dimensional action_1 .) - moreEquals reduce using rule 58 (EItem -> Dimensional action_1 .) end reduce using rule 58 (EItem -> Dimensional action_1 .) id reduce using rule 58 (EItem -> Dimensional action_1 .) read reduce using rule 58 (EItem -> Dimensional action_1 .) @@ -1474,12 +1352,18 @@ state 82 exit reduce using rule 58 (EItem -> Dimensional action_1 .) elif reduce using rule 58 (EItem -> Dimensional action_1 .) else reduce using rule 58 (EItem -> Dimensional action_1 .) + less reduce using rule 58 (EItem -> Dimensional action_1 .) + more reduce using rule 58 (EItem -> Dimensional action_1 .) + doubleEquals reduce using rule 58 (EItem -> Dimensional action_1 .) + notEquals reduce using rule 58 (EItem -> Dimensional action_1 .) + lessEquals reduce using rule 58 (EItem -> Dimensional action_1 .) + moreEquals reduce using rule 58 (EItem -> Dimensional action_1 .) then reduce using rule 58 (EItem -> Dimensional action_1 .) and reduce using rule 58 (EItem -> Dimensional action_1 .) or reduce using rule 58 (EItem -> Dimensional action_1 .) -state 83 +state 75 (59) EItem -> int action_2 . @@ -1489,12 +1373,6 @@ state 83 plus reduce using rule 59 (EItem -> int action_2 .) minus reduce using rule 59 (EItem -> int action_2 .) closedParen reduce using rule 59 (EItem -> int action_2 .) - less reduce using rule 59 (EItem -> int action_2 .) - more reduce using rule 59 (EItem -> int action_2 .) - doubleEquals reduce using rule 59 (EItem -> int action_2 .) - notEquals reduce using rule 59 (EItem -> int action_2 .) - lessEquals reduce using rule 59 (EItem -> int action_2 .) - moreEquals reduce using rule 59 (EItem -> int action_2 .) end reduce using rule 59 (EItem -> int action_2 .) id reduce using rule 59 (EItem -> int action_2 .) read reduce using rule 59 (EItem -> int action_2 .) @@ -1505,12 +1383,18 @@ state 83 exit reduce using rule 59 (EItem -> int action_2 .) elif reduce using rule 59 (EItem -> int action_2 .) else reduce using rule 59 (EItem -> int action_2 .) + less reduce using rule 59 (EItem -> int action_2 .) + more reduce using rule 59 (EItem -> int action_2 .) + doubleEquals reduce using rule 59 (EItem -> int action_2 .) + notEquals reduce using rule 59 (EItem -> int action_2 .) + lessEquals reduce using rule 59 (EItem -> int action_2 .) + moreEquals reduce using rule 59 (EItem -> int action_2 .) then reduce using rule 59 (EItem -> int action_2 .) and reduce using rule 59 (EItem -> int action_2 .) or reduce using rule 59 (EItem -> int action_2 .) -state 84 +state 76 (60) EItem -> rea action_2_rea . @@ -1520,12 +1404,6 @@ state 84 plus reduce using rule 60 (EItem -> rea action_2_rea .) minus reduce using rule 60 (EItem -> rea action_2_rea .) closedParen reduce using rule 60 (EItem -> rea action_2_rea .) - less reduce using rule 60 (EItem -> rea action_2_rea .) - more reduce using rule 60 (EItem -> rea action_2_rea .) - doubleEquals reduce using rule 60 (EItem -> rea action_2_rea .) - notEquals reduce using rule 60 (EItem -> rea action_2_rea .) - lessEquals reduce using rule 60 (EItem -> rea action_2_rea .) - moreEquals reduce using rule 60 (EItem -> rea action_2_rea .) end reduce using rule 60 (EItem -> rea action_2_rea .) id reduce using rule 60 (EItem -> rea action_2_rea .) read reduce using rule 60 (EItem -> rea action_2_rea .) @@ -1536,12 +1414,18 @@ state 84 exit reduce using rule 60 (EItem -> rea action_2_rea .) elif reduce using rule 60 (EItem -> rea action_2_rea .) else reduce using rule 60 (EItem -> rea action_2_rea .) + less reduce using rule 60 (EItem -> rea action_2_rea .) + more reduce using rule 60 (EItem -> rea action_2_rea .) + doubleEquals reduce using rule 60 (EItem -> rea action_2_rea .) + notEquals reduce using rule 60 (EItem -> rea action_2_rea .) + lessEquals reduce using rule 60 (EItem -> rea action_2_rea .) + moreEquals reduce using rule 60 (EItem -> rea action_2_rea .) then reduce using rule 60 (EItem -> rea action_2_rea .) and reduce using rule 60 (EItem -> rea action_2_rea .) or reduce using rule 60 (EItem -> rea action_2_rea .) -state 85 +state 77 (15) S -> Dimensional action_7 equals EA . action_8 (42) EA -> EA . SumOrSub action_3 MultDiv action_4 @@ -1559,13 +1443,13 @@ state 85 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 77 - minus shift and go to state 78 + plus shift and go to state 69 + minus shift and go to state 70 - action_8 shift and go to state 114 - SumOrSub shift and go to state 75 + action_8 shift and go to state 100 + SumOrSub shift and go to state 67 -state 86 +state 78 (30) RDimensional -> RDimensional coma Dimensional . @@ -1582,7 +1466,7 @@ state 86 else reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) -state 87 +state 79 (32) RDimOrString -> RDimOrString coma DimOrString . @@ -1599,16 +1483,41 @@ state 87 else reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) -state 88 +state 80 - (19) S -> if Relif ElseOrEmpty end . if + (19) S -> if action_16 Relif ElseOrEmpty . end if action_20 - if shift and go to state 115 + end shift and go to state 101 -state 89 +state 81 - (36) Relif -> Relif elif openParen . EL closedParen then B + (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 + +state 82 + + (37) ElseOrEmpty -> else . action_19 B + (86) action_19 -> . + + id reduce using rule 86 (action_19 -> .) + read reduce using rule 86 (action_19 -> .) + print reduce using rule 86 (action_19 -> .) + if reduce using rule 86 (action_19 -> .) + do reduce using rule 86 (action_19 -> .) + swap reduce using rule 86 (action_19 -> .) + exit reduce using rule 86 (action_19 -> .) + end reduce using rule 86 (action_19 -> .) + + action_19 shift and go to state 103 + +state 83 + + (56) Equality -> openParen . EL closedParen (51) EL -> . AND (52) EL -> . EL or action_10 AND action_9 (53) AND -> . Equality @@ -1621,188 +1530,116 @@ state 89 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 61 - not shift and go to state 66 - int shift and go to state 53 - rea shift and go to state 54 + 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 id shift and go to state 33 - EL shift and go to state 116 - AND shift and go to state 63 - Equality shift and go to state 64 - EItem shift and go to state 65 - Dimensional shift and go to state 52 + 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 -state 90 +state 84 - (37) ElseOrEmpty -> else B . - (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 Relif ElseOrEmpty end if - (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 + (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 + + +state 85 + + (51) EL -> AND . + (54) AND -> AND . and action_12 Equality action_11 + + ! 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 [ reduce using rule 51 (EL -> AND .) ] + + +state 86 + + (53) AND -> Equality . + + and reduce using rule 53 (AND -> Equality .) + closedParen reduce using rule 53 (AND -> Equality .) + or reduce using rule 53 (AND -> Equality .) + + +state 87 + + (55) Equality -> EItem . EQSymbols action_13 EItem action_14 + (61) EQSymbols -> . less + (62) EQSymbols -> . more + (63) EQSymbols -> . doubleEquals + (64) EQSymbols -> . notEquals + (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 + + EQSymbols shift and go to state 108 + +state 88 + + (57) Equality -> not . EL action_15 + (51) EL -> . AND + (52) EL -> . EL or action_10 AND action_9 + (53) AND -> . Equality + (54) AND -> . AND and action_12 Equality action_11 + (55) Equality -> . EItem EQSymbols action_13 EItem action_14 + (56) Equality -> . openParen EL closedParen + (57) Equality -> . not EL action_15 + (58) EItem -> . Dimensional action_1 + (59) EItem -> . int action_2 + (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - end reduce using rule 37 (ElseOrEmpty -> else B .) - 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 + 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 + id shift and go to state 33 - S shift and go to state 15 - Dimensional shift and go to state 16 + 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 -state 91 - - (56) Equality -> openParen EL . closedParen - (52) EL -> EL . or action_10 AND action_9 - - closedParen shift and go to state 117 - or shift and go to state 93 - - -state 92 - - (35) Relif -> openParen EL closedParen . then B - - then shift and go to state 118 - - -state 93 - - (52) EL -> EL or . action_10 AND action_9 - (77) action_10 -> . - - openParen reduce using rule 77 (action_10 -> .) - not reduce using rule 77 (action_10 -> .) - int reduce using rule 77 (action_10 -> .) - rea reduce using rule 77 (action_10 -> .) - id reduce using rule 77 (action_10 -> .) - - action_10 shift and go to state 119 - -state 94 - - (54) AND -> AND and . action_12 Equality action_11 - (79) action_12 -> . - - openParen reduce using rule 79 (action_12 -> .) - not reduce using rule 79 (action_12 -> .) - int reduce using rule 79 (action_12 -> .) - rea reduce using rule 79 (action_12 -> .) - id reduce using rule 79 (action_12 -> .) - - action_12 shift and go to state 120 - -state 95 - - (55) Equality -> EItem EQSymbols . action_13 EItem action_14 - (80) action_13 -> . - - int reduce using rule 80 (action_13 -> .) - rea reduce using rule 80 (action_13 -> .) - id reduce using rule 80 (action_13 -> .) - - action_13 shift and go to state 121 - -state 96 - - (61) EQSymbols -> less . - - int reduce using rule 61 (EQSymbols -> less .) - rea reduce using rule 61 (EQSymbols -> less .) - id reduce using rule 61 (EQSymbols -> less .) - - -state 97 - - (62) EQSymbols -> more . - - int reduce using rule 62 (EQSymbols -> more .) - rea reduce using rule 62 (EQSymbols -> more .) - id reduce using rule 62 (EQSymbols -> more .) - - -state 98 - - (63) EQSymbols -> doubleEquals . - - int reduce using rule 63 (EQSymbols -> doubleEquals .) - rea reduce using rule 63 (EQSymbols -> doubleEquals .) - id reduce using rule 63 (EQSymbols -> doubleEquals .) - - -state 99 - - (64) EQSymbols -> notEquals . - - int reduce using rule 64 (EQSymbols -> notEquals .) - rea reduce using rule 64 (EQSymbols -> notEquals .) - id reduce using rule 64 (EQSymbols -> notEquals .) - - -state 100 - - (65) EQSymbols -> lessEquals . - - int reduce using rule 65 (EQSymbols -> lessEquals .) - rea reduce using rule 65 (EQSymbols -> lessEquals .) - id reduce using rule 65 (EQSymbols -> lessEquals .) - - -state 101 - - (66) EQSymbols -> moreEquals . - - int reduce using rule 66 (EQSymbols -> moreEquals .) - rea reduce using rule 66 (EQSymbols -> moreEquals .) - id reduce using rule 66 (EQSymbols -> moreEquals .) - - -state 102 - - (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 93 - 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 122 - -state 103 +state 89 (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 123 - plus shift and go to state 77 - minus shift and go to state 78 + 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 75 + SumOrSub shift and go to state 67 -state 104 +state 90 (21) S -> do then B end . do - do shift and go to state 124 + do shift and go to state 117 -state 105 +state 91 (22) S -> swap Dimensional coma Dimensional . @@ -1818,7 +1655,7 @@ state 105 else reduce using rule 22 (S -> swap Dimensional coma Dimensional .) -state 106 +state 92 (11) F -> F subroutine id B end subroutine . @@ -1833,7 +1670,7 @@ state 106 exit reduce using rule 11 (F -> F subroutine id B end subroutine .) -state 107 +state 93 (5) Rid -> Rid coma id . @@ -1851,14 +1688,14 @@ state 107 exit reduce using rule 5 (Rid -> Rid coma id .) -state 108 +state 94 (9) Dim -> openBra int closedBra openBra int . closedBra - closedBra shift and go to state 125 + closedBra shift and go to state 118 -state 109 +state 95 (50) EAParens -> openParen EA closedParen . @@ -1881,7 +1718,7 @@ state 109 then reduce using rule 50 (EAParens -> openParen EA closedParen .) -state 110 +state 96 (25) DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen . @@ -1913,7 +1750,7 @@ state 110 or reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) -state 111 +state 97 (42) EA -> EA SumOrSub action_3 . MultDiv action_4 (45) MultDiv -> . EAParens @@ -1925,17 +1762,17 @@ state 111 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - MultDiv shift and go to state 126 - EAParens shift and go to state 50 - EItem shift and go to state 51 - Dimensional shift and go to state 52 + 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 -state 112 +state 98 (27) ComaEAOrEmpty -> coma EA . (42) EA -> EA . SumOrSub action_3 MultDiv action_4 @@ -1943,12 +1780,12 @@ state 112 (44) SumOrSub -> . minus closedParen reduce using rule 27 (ComaEAOrEmpty -> coma EA .) - plus shift and go to state 77 - minus shift and go to state 78 + plus shift and go to state 69 + minus shift and go to state 70 - SumOrSub shift and go to state 75 + SumOrSub shift and go to state 67 -state 113 +state 99 (46) MultDiv -> MultDiv MDSymbols action_5 . EAParens action_6 (49) EAParens -> . EItem @@ -1958,16 +1795,16 @@ state 113 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - EAParens shift and go to state 127 - EItem shift and go to state 51 - Dimensional shift and go to state 52 + EAParens shift and go to state 120 + EItem shift and go to state 50 + Dimensional shift and go to state 51 -state 114 +state 100 (15) S -> Dimensional action_7 equals EA action_8 . @@ -1983,43 +1820,23 @@ state 114 else reduce using rule 15 (S -> Dimensional action_7 equals EA action_8 .) -state 115 +state 101 - (19) S -> if Relif ElseOrEmpty end if . + (19) S -> if action_16 Relif ElseOrEmpty end . if action_20 - end reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - id reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - read reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - print reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - if reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - do reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - swap reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - exit reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - elif reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - else reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) + if shift and go to state 121 -state 116 +state 102 - (36) Relif -> Relif elif openParen EL . closedParen then B - (52) EL -> EL . or action_10 AND action_9 + (36) Relif -> Relif elif action_18 . openParen EL closedParen action_17 then B - closedParen shift and go to state 128 - or shift and go to state 93 + openParen shift and go to state 122 -state 117 +state 103 - (56) Equality -> openParen EL closedParen . - - and reduce using rule 56 (Equality -> openParen EL closedParen .) - closedParen reduce using rule 56 (Equality -> openParen EL closedParen .) - or reduce using rule 56 (Equality -> openParen EL closedParen .) - - -state 118 - - (35) Relif -> openParen EL closedParen then . B + (37) ElseOrEmpty -> else action_19 . B (13) B -> . B S (14) B -> . @@ -2030,82 +1847,135 @@ state 118 do reduce using rule 14 (B -> .) swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - elif reduce using rule 14 (B -> .) - else reduce using rule 14 (B -> .) end reduce using rule 14 (B -> .) - B shift and go to state 129 + B shift and go to state 123 -state 119 +state 104 - (52) EL -> EL or action_10 . AND action_9 - (53) AND -> . Equality - (54) AND -> . AND and action_12 Equality action_11 - (55) Equality -> . EItem EQSymbols action_13 EItem action_14 - (56) Equality -> . openParen EL closedParen - (57) Equality -> . not EL action_15 - (58) EItem -> . Dimensional action_1 - (59) EItem -> . int action_2 - (60) EItem -> . rea action_2_rea - (24) Dimensional -> . id DimensionsOrEmpty + (56) Equality -> openParen EL . closedParen + (52) EL -> EL . or action_10 AND action_9 - openParen shift and go to state 61 - not shift and go to state 66 - 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 130 - Equality shift and go to state 64 - EItem shift and go to state 65 - Dimensional shift and go to state 52 - -state 120 - - (54) AND -> AND and action_12 . Equality action_11 - (55) Equality -> . EItem EQSymbols action_13 EItem action_14 - (56) Equality -> . openParen EL closedParen - (57) Equality -> . not EL action_15 - (58) EItem -> . Dimensional action_1 - (59) EItem -> . int action_2 - (60) EItem -> . rea action_2_rea - (24) Dimensional -> . id DimensionsOrEmpty - - openParen shift and go to state 61 - not shift and go to state 66 - 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 131 - EItem shift and go to state 65 - Dimensional shift and go to state 52 - -state 121 - - (55) Equality -> EItem EQSymbols action_13 . EItem action_14 - (58) EItem -> . Dimensional action_1 - (59) EItem -> . int action_2 - (60) EItem -> . rea action_2_rea - (24) Dimensional -> . id DimensionsOrEmpty - - 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 132 - Dimensional shift and go to state 52 - -state 122 - - (57) Equality -> not EL action_15 . - - and reduce using rule 57 (Equality -> not EL action_15 .) - closedParen reduce using rule 57 (Equality -> not EL action_15 .) - or reduce using rule 57 (Equality -> not EL action_15 .) + closedParen shift and go to state 124 + or shift and go to state 106 -state 123 +state 105 + + (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 + +state 106 + + (52) EL -> EL or . action_10 AND action_9 + (77) action_10 -> . + + openParen reduce using rule 77 (action_10 -> .) + not reduce using rule 77 (action_10 -> .) + int reduce using rule 77 (action_10 -> .) + rea reduce using rule 77 (action_10 -> .) + id reduce using rule 77 (action_10 -> .) + + action_10 shift and go to state 126 + +state 107 + + (54) AND -> AND and . action_12 Equality action_11 + (79) action_12 -> . + + openParen reduce using rule 79 (action_12 -> .) + not reduce using rule 79 (action_12 -> .) + int reduce using rule 79 (action_12 -> .) + rea reduce using rule 79 (action_12 -> .) + id reduce using rule 79 (action_12 -> .) + + action_12 shift and go to state 127 + +state 108 + + (55) Equality -> EItem EQSymbols . action_13 EItem action_14 + (80) action_13 -> . + + int reduce using rule 80 (action_13 -> .) + rea reduce using rule 80 (action_13 -> .) + id reduce using rule 80 (action_13 -> .) + + action_13 shift and go to state 128 + +state 109 + + (61) EQSymbols -> less . + + int reduce using rule 61 (EQSymbols -> less .) + rea reduce using rule 61 (EQSymbols -> less .) + id reduce using rule 61 (EQSymbols -> less .) + + +state 110 + + (62) EQSymbols -> more . + + int reduce using rule 62 (EQSymbols -> more .) + rea reduce using rule 62 (EQSymbols -> more .) + id reduce using rule 62 (EQSymbols -> more .) + + +state 111 + + (63) EQSymbols -> doubleEquals . + + int reduce using rule 63 (EQSymbols -> doubleEquals .) + rea reduce using rule 63 (EQSymbols -> doubleEquals .) + id reduce using rule 63 (EQSymbols -> doubleEquals .) + + +state 112 + + (64) EQSymbols -> notEquals . + + int reduce using rule 64 (EQSymbols -> notEquals .) + rea reduce using rule 64 (EQSymbols -> notEquals .) + id reduce using rule 64 (EQSymbols -> notEquals .) + + +state 113 + + (65) EQSymbols -> lessEquals . + + int reduce using rule 65 (EQSymbols -> lessEquals .) + rea reduce using rule 65 (EQSymbols -> lessEquals .) + id reduce using rule 65 (EQSymbols -> lessEquals .) + + +state 114 + + (66) EQSymbols -> moreEquals . + + int reduce using rule 66 (EQSymbols -> moreEquals .) + rea reduce using rule 66 (EQSymbols -> moreEquals .) + id reduce using rule 66 (EQSymbols -> moreEquals .) + + +state 115 + + (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 + 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 + +state 116 (20) S -> do id equals EA coma . EA IntOrEmpty then B end do (41) EA -> . MultDiv @@ -2119,18 +1989,18 @@ state 123 (60) EItem -> . rea action_2_rea (24) Dimensional -> . id DimensionsOrEmpty - openParen shift and go to state 47 - int shift and go to state 53 - rea shift and go to state 54 + openParen shift and go to state 46 + int shift and go to state 52 + rea shift and go to state 53 id shift and go to state 33 - EA shift and go to state 133 - 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 + 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 124 +state 117 (21) S -> do then B end do . @@ -2146,14 +2016,14 @@ state 124 else reduce using rule 21 (S -> do then B end do .) -state 125 +state 118 (9) Dim -> openBra int closedBra openBra int closedBra . doubleColon reduce using rule 9 (Dim -> openBra int closedBra openBra int closedBra .) -state 126 +state 119 (42) EA -> EA SumOrSub action_3 MultDiv . action_4 (46) MultDiv -> MultDiv . MDSymbols action_5 EAParens action_6 @@ -2176,13 +2046,13 @@ state 126 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 80 - div shift and go to state 81 + mul shift and go to state 72 + div shift and go to state 73 - action_4 shift and go to state 134 - MDSymbols shift and go to state 79 + action_4 shift and go to state 131 + MDSymbols shift and go to state 71 -state 127 +state 120 (46) MultDiv -> MultDiv MDSymbols action_5 EAParens . action_6 (73) action_6 -> . @@ -2205,33 +2075,69 @@ state 127 else reduce using rule 73 (action_6 -> .) then reduce using rule 73 (action_6 -> .) - action_6 shift and go to state 135 + action_6 shift and go to state 132 -state 128 +state 121 - (36) Relif -> Relif elif openParen EL closedParen . then B + (19) S -> if action_16 Relif ElseOrEmpty end if . action_20 + (87) action_20 -> . - then shift and go to state 136 + end reduce using rule 87 (action_20 -> .) + id reduce using rule 87 (action_20 -> .) + read reduce using rule 87 (action_20 -> .) + print reduce using rule 87 (action_20 -> .) + if reduce using rule 87 (action_20 -> .) + do reduce using rule 87 (action_20 -> .) + swap reduce using rule 87 (action_20 -> .) + exit reduce using rule 87 (action_20 -> .) + elif reduce using rule 87 (action_20 -> .) + else reduce using rule 87 (action_20 -> .) + action_20 shift and go to state 133 -state 129 +state 122 - (35) Relif -> openParen EL closedParen then B . + (36) Relif -> Relif elif action_18 openParen . EL closedParen action_17 then B + (51) EL -> . AND + (52) EL -> . EL or action_10 AND action_9 + (53) AND -> . Equality + (54) AND -> . AND and action_12 Equality action_11 + (55) Equality -> . EItem EQSymbols action_13 EItem action_14 + (56) Equality -> . openParen EL closedParen + (57) Equality -> . not EL action_15 + (58) EItem -> . Dimensional action_1 + (59) EItem -> . int action_2 + (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 + 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 + +state 123 + + (37) ElseOrEmpty -> else action_19 B . (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 Relif ElseOrEmpty end if + (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 - elif reduce using rule 35 (Relif -> openParen EL closedParen then B .) - else reduce using rule 35 (Relif -> openParen EL closedParen then B .) - end reduce using rule 35 (Relif -> openParen EL closedParen then B .) + end reduce using rule 37 (ElseOrEmpty -> else action_19 B .) id shift and go to state 13 read shift and go to state 17 print shift and go to state 18 @@ -2243,45 +2149,93 @@ state 129 S shift and go to state 15 Dimensional shift and go to state 16 +state 124 + + (56) Equality -> openParen EL closedParen . + + and reduce using rule 56 (Equality -> openParen EL closedParen .) + closedParen reduce using rule 56 (Equality -> openParen EL closedParen .) + or reduce using rule 56 (Equality -> openParen EL closedParen .) + + +state 125 + + (35) Relif -> openParen EL closedParen action_17 . then B + + then shift and go to state 135 + + +state 126 + + (52) EL -> EL or action_10 . AND action_9 + (53) AND -> . Equality + (54) AND -> . AND and action_12 Equality action_11 + (55) Equality -> . EItem EQSymbols action_13 EItem action_14 + (56) Equality -> . openParen EL closedParen + (57) Equality -> . not EL action_15 + (58) EItem -> . Dimensional action_1 + (59) EItem -> . int action_2 + (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 + 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 + +state 127 + + (54) AND -> AND and action_12 . Equality action_11 + (55) Equality -> . EItem EQSymbols action_13 EItem action_14 + (56) Equality -> . openParen EL closedParen + (57) Equality -> . not EL action_15 + (58) EItem -> . Dimensional action_1 + (59) EItem -> . int action_2 + (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 + 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 + +state 128 + + (55) Equality -> EItem EQSymbols action_13 . EItem action_14 + (58) EItem -> . Dimensional action_1 + (59) EItem -> . int action_2 + (60) EItem -> . rea action_2_rea + (24) Dimensional -> . id DimensionsOrEmpty + + int shift and go to state 52 + rea shift and go to state 53 + id shift and go to state 33 + + EItem shift and go to state 138 + Dimensional shift and go to state 51 + +state 129 + + (57) Equality -> not EL action_15 . + + and reduce using rule 57 (Equality -> not EL action_15 .) + closedParen reduce using rule 57 (Equality -> not EL action_15 .) + or reduce using rule 57 (Equality -> not EL action_15 .) + + state 130 - (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 94 - 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 137 - -state 131 - - (54) AND -> AND and action_12 Equality . action_11 - (78) action_11 -> . - - and reduce using rule 78 (action_11 -> .) - closedParen reduce using rule 78 (action_11 -> .) - or reduce using rule 78 (action_11 -> .) - - action_11 shift and go to state 138 - -state 132 - - (55) Equality -> EItem EQSymbols action_13 EItem . action_14 - (81) action_14 -> . - - and reduce using rule 81 (action_14 -> .) - closedParen reduce using rule 81 (action_14 -> .) - or reduce using rule 81 (action_14 -> .) - - action_14 shift and go to state 139 - -state 133 - (20) S -> do id equals EA coma EA . IntOrEmpty then B end do (42) EA -> EA . SumOrSub action_3 MultDiv action_4 (39) IntOrEmpty -> . coma int @@ -2289,15 +2243,15 @@ state 133 (43) SumOrSub -> . plus (44) SumOrSub -> . minus - coma shift and go to state 140 + coma shift and go to state 139 then reduce using rule 40 (IntOrEmpty -> .) - plus shift and go to state 77 - minus shift and go to state 78 + plus shift and go to state 69 + minus shift and go to state 70 - IntOrEmpty shift and go to state 141 - SumOrSub shift and go to state 75 + IntOrEmpty shift and go to state 140 + SumOrSub shift and go to state 67 -state 134 +state 131 (42) EA -> EA SumOrSub action_3 MultDiv action_4 . @@ -2318,7 +2272,7 @@ state 134 then reduce using rule 42 (EA -> EA SumOrSub action_3 MultDiv action_4 .) -state 135 +state 132 (46) MultDiv -> MultDiv MDSymbols action_5 EAParens action_6 . @@ -2341,9 +2295,34 @@ state 135 then reduce using rule 46 (MultDiv -> MultDiv MDSymbols action_5 EAParens action_6 .) -state 136 +state 133 - (36) Relif -> Relif elif openParen EL closedParen then . B + (19) S -> if action_16 Relif ElseOrEmpty end if action_20 . + + end reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + id reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + read reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + print reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + if reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + do reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + swap reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + exit reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + elif reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + else reduce using rule 19 (S -> if action_16 Relif ElseOrEmpty end if action_20 .) + + +state 134 + + (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 + + +state 135 + + (35) Relif -> openParen EL closedParen action_17 then . B (13) B -> . B S (14) B -> . @@ -2360,65 +2339,84 @@ state 136 B shift and go to state 142 +state 136 + + (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 + 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 + state 137 - (52) EL -> EL or action_10 AND action_9 . + (54) AND -> AND and action_12 Equality . action_11 + (78) action_11 -> . - closedParen reduce using rule 52 (EL -> EL or action_10 AND action_9 .) - or reduce using rule 52 (EL -> EL or action_10 AND action_9 .) - and reduce using rule 52 (EL -> EL or action_10 AND action_9 .) + and reduce using rule 78 (action_11 -> .) + closedParen reduce using rule 78 (action_11 -> .) + or reduce using rule 78 (action_11 -> .) + action_11 shift and go to state 144 state 138 - (54) AND -> AND and action_12 Equality action_11 . + (55) Equality -> EItem EQSymbols action_13 EItem . action_14 + (81) action_14 -> . - and reduce using rule 54 (AND -> AND and action_12 Equality action_11 .) - closedParen reduce using rule 54 (AND -> AND and action_12 Equality action_11 .) - or reduce using rule 54 (AND -> AND and action_12 Equality action_11 .) + and reduce using rule 81 (action_14 -> .) + closedParen reduce using rule 81 (action_14 -> .) + or reduce using rule 81 (action_14 -> .) + action_14 shift and go to state 145 state 139 - (55) Equality -> EItem EQSymbols action_13 EItem action_14 . + (39) IntOrEmpty -> coma . int - and reduce using rule 55 (Equality -> EItem EQSymbols action_13 EItem action_14 .) - closedParen reduce using rule 55 (Equality -> EItem EQSymbols action_13 EItem action_14 .) - or reduce using rule 55 (Equality -> EItem EQSymbols action_13 EItem action_14 .) + int shift and go to state 146 state 140 - (39) IntOrEmpty -> coma . int + (20) S -> do id equals EA coma EA IntOrEmpty . then B end do - int shift and go to state 143 + then shift and go to state 147 state 141 - (20) S -> do id equals EA coma EA IntOrEmpty . then B end do + (36) Relif -> Relif elif action_18 openParen EL closedParen . action_17 then B + (84) action_17 -> . - then shift and go to state 144 + then reduce using rule 84 (action_17 -> .) + action_17 shift and go to state 148 state 142 - (36) Relif -> Relif elif openParen EL closedParen then B . + (35) Relif -> openParen EL closedParen action_17 then B . (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 Relif ElseOrEmpty end if + (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 - elif reduce using rule 36 (Relif -> Relif elif openParen EL closedParen then B .) - else reduce using rule 36 (Relif -> Relif elif openParen EL closedParen then B .) - end reduce using rule 36 (Relif -> Relif elif openParen EL closedParen then B .) + elif reduce using rule 35 (Relif -> openParen EL closedParen action_17 then B .) + else reduce using rule 35 (Relif -> openParen EL closedParen action_17 then B .) + end reduce using rule 35 (Relif -> openParen EL closedParen action_17 then B .) id shift and go to state 13 read shift and go to state 17 print shift and go to state 18 @@ -2432,12 +2430,39 @@ state 142 state 143 + (52) EL -> EL or action_10 AND action_9 . + + closedParen reduce using rule 52 (EL -> EL or action_10 AND action_9 .) + or reduce using rule 52 (EL -> EL or action_10 AND action_9 .) + and reduce using rule 52 (EL -> EL or action_10 AND action_9 .) + + +state 144 + + (54) AND -> AND and action_12 Equality action_11 . + + and reduce using rule 54 (AND -> AND and action_12 Equality action_11 .) + closedParen reduce using rule 54 (AND -> AND and action_12 Equality action_11 .) + or reduce using rule 54 (AND -> AND and action_12 Equality action_11 .) + + +state 145 + + (55) Equality -> EItem EQSymbols action_13 EItem action_14 . + + and reduce using rule 55 (Equality -> EItem EQSymbols action_13 EItem action_14 .) + closedParen reduce using rule 55 (Equality -> EItem EQSymbols action_13 EItem action_14 .) + or reduce using rule 55 (Equality -> EItem EQSymbols action_13 EItem action_14 .) + + +state 146 + (39) IntOrEmpty -> coma int . then reduce using rule 39 (IntOrEmpty -> coma int .) -state 144 +state 147 (20) S -> do id equals EA coma EA IntOrEmpty then . B end do (13) B -> . B S @@ -2452,9 +2477,16 @@ state 144 swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - B shift and go to state 145 + B shift and go to state 149 -state 145 +state 148 + + (36) Relif -> Relif elif action_18 openParen EL closedParen action_17 . then B + + then shift and go to state 150 + + +state 149 (20) S -> do id equals EA coma EA IntOrEmpty then B . end do (13) B -> B . S @@ -2462,14 +2494,14 @@ state 145 (16) S -> . id parens (17) S -> . read RDimensional (18) S -> . print RDimOrString - (19) S -> . if Relif ElseOrEmpty end if + (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 146 + end shift and go to state 151 id shift and go to state 13 read shift and go to state 17 print shift and go to state 18 @@ -2481,14 +2513,62 @@ state 145 S shift and go to state 15 Dimensional shift and go to state 16 -state 146 +state 150 + + (36) Relif -> Relif elif action_18 openParen EL closedParen action_17 then . B + (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 -> .) + elif reduce using rule 14 (B -> .) + else reduce using rule 14 (B -> .) + end reduce using rule 14 (B -> .) + + B shift and go to state 152 + +state 151 (20) S -> do id equals EA coma EA IntOrEmpty then B end . do - do shift and go to state 147 + do shift and go to state 153 -state 147 +state 152 + + (36) Relif -> Relif elif action_18 openParen EL closedParen action_17 then B . + (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 + + elif reduce using rule 36 (Relif -> Relif elif action_18 openParen EL closedParen action_17 then B .) + else reduce using rule 36 (Relif -> Relif elif action_18 openParen EL closedParen action_17 then B .) + end reduce using rule 36 (Relif -> Relif elif action_18 openParen EL closedParen action_17 then B .) + 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 + +state 153 (20) S -> do id equals EA coma EA IntOrEmpty then B end do . @@ -2506,6 +2586,6 @@ state 147 WARNING: WARNING: Conflicts: WARNING: -WARNING: shift/reduce conflict for and in state 63 resolved as shift -WARNING: shift/reduce conflict for or in state 102 resolved as shift -WARNING: shift/reduce conflict for and in state 130 resolved as shift +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 diff --git a/final_lang/parsetab.py b/final_lang/parsetab.py index 4706e4f..851f987 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 Relif ElseOrEmpty end if\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 then B\n | Relif elif openParen EL closedParen then B\n \n ElseOrEmpty : else 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 :' +_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_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,39,41,43,44,45,47,49,50,51,52,53,54,55,56,57,60,61,66,67,68,69,71,75,76,77,78,79,80,81,82,83,84,85,86,87,89,90,93,94,95,96,97,98,99,100,101,105,106,107,109,110,111,113,114,115,118,119,120,121,123,124,126,127,129,134,135,136,142,144,145,147,],[3,-3,-12,-14,13,23,-13,33,33,40,33,-23,-14,45,-16,-24,33,-17,-29,-26,-18,-31,-33,-34,33,-14,13,-2,-4,33,-41,-45,-49,-67,-68,-69,33,33,33,-14,33,33,33,13,33,107,-70,33,-43,-44,-72,-47,-48,-58,-59,-60,-75,-30,-32,33,13,-77,-79,-80,-61,-62,-63,-64,-65,-66,-22,-11,-5,-50,-25,33,33,-15,-19,-14,33,33,33,33,-21,-71,-73,13,-42,-46,-14,13,-14,13,-20,]),'integer':([3,4,44,45,107,],[-3,7,-2,-4,-5,]),'real':([3,4,44,45,107,],[-3,8,-2,-4,-5,]),'subroutine':([3,4,5,44,45,70,106,107,],[-3,-12,10,-2,-4,106,-11,-5,]),'end':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,38,41,43,44,45,49,50,51,52,53,54,58,60,68,82,83,84,85,86,87,90,105,106,107,109,110,114,115,118,124,126,127,129,134,135,136,142,144,145,147,],[-3,-12,-14,14,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-38,-14,70,-2,-4,-41,-45,-49,-67,-68,-69,88,-14,104,-58,-59,-60,-75,-30,-32,-37,-22,-11,-5,-50,-25,-15,-19,-14,-21,-71,-73,-35,-42,-46,-14,-36,-14,146,-20,]),'read':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,60,68,82,83,84,85,86,87,90,105,106,107,109,110,114,115,118,124,126,127,129,134,135,136,142,144,145,147,],[-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,-14,17,-58,-59,-60,-75,-30,-32,17,-22,-11,-5,-50,-25,-15,-19,-14,-21,-71,-73,17,-42,-46,-14,17,-14,17,-20,]),'print':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,60,68,82,83,84,85,86,87,90,105,106,107,109,110,114,115,118,124,126,127,129,134,135,136,142,144,145,147,],[-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,-14,18,-58,-59,-60,-75,-30,-32,18,-22,-11,-5,-50,-25,-15,-19,-14,-21,-71,-73,18,-42,-46,-14,18,-14,18,-20,]),'if':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,60,68,82,83,84,85,86,87,88,90,105,106,107,109,110,114,115,118,124,126,127,129,134,135,136,142,144,145,147,],[-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,-14,19,-58,-59,-60,-75,-30,-32,115,19,-22,-11,-5,-50,-25,-15,-19,-14,-21,-71,-73,19,-42,-46,-14,19,-14,19,-20,]),'do':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,60,68,82,83,84,85,86,87,90,104,105,106,107,109,110,114,115,118,124,126,127,129,134,135,136,142,144,145,146,147,],[-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,-14,20,-58,-59,-60,-75,-30,-32,20,124,-22,-11,-5,-50,-25,-15,-19,-14,-21,-71,-73,20,-42,-46,-14,20,-14,20,147,-20,]),'swap':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,60,68,82,83,84,85,86,87,90,105,106,107,109,110,114,115,118,124,126,127,129,134,135,136,142,144,145,147,],[-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,-14,21,-58,-59,-60,-75,-30,-32,21,-22,-11,-5,-50,-25,-15,-19,-14,-21,-71,-73,21,-42,-46,-14,21,-14,21,-20,]),'exit':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,60,68,82,83,84,85,86,87,90,105,106,107,109,110,114,115,118,124,126,127,129,134,135,136,142,144,145,147,],[-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,-14,22,-58,-59,-60,-75,-30,-32,22,-22,-11,-5,-50,-25,-15,-19,-14,-21,-71,-73,22,-42,-46,-14,22,-14,22,-20,]),'openBra':([6,7,8,46,],[12,-6,-7,72,]),'doubleColon':([6,7,8,11,46,125,],[-10,-6,-7,24,-8,-9,]),'int':([12,28,39,47,55,61,66,67,72,75,76,77,78,79,80,81,89,93,94,95,96,97,98,99,100,101,111,113,119,120,121,123,140,],[25,53,53,53,53,53,53,53,108,-70,53,-43,-44,-72,-47,-48,53,-77,-79,-80,-61,-62,-63,-64,-65,-66,53,53,53,53,53,53,143,]),'parens':([13,],[26,]),'openParen':([13,19,28,33,39,47,55,59,61,66,67,75,76,77,78,79,80,81,89,93,94,111,113,119,120,123,],[28,39,47,28,61,47,47,89,61,61,47,-70,47,-43,-44,-72,-47,-48,61,-77,-79,47,47,61,61,47,]),'equals':([13,16,27,30,40,110,],[-26,-74,-24,55,67,-25,]),'elif':([15,22,26,27,31,32,33,34,35,36,37,38,49,50,51,52,53,54,82,83,84,85,86,87,105,109,110,114,115,118,124,126,127,129,134,135,136,142,147,],[-13,-23,-16,-24,-17,-29,-26,-18,-31,-33,-34,59,-41,-45,-49,-67,-68,-69,-58,-59,-60,-75,-30,-32,-22,-50,-25,-15,-19,-14,-21,-71,-73,-35,-42,-46,-14,-36,-20,]),'else':([15,22,26,27,31,32,33,34,35,36,37,38,49,50,51,52,53,54,82,83,84,85,86,87,105,109,110,114,115,118,124,126,127,129,134,135,136,142,147,],[-13,-23,-16,-24,-17,-29,-26,-18,-31,-33,-34,60,-41,-45,-49,-67,-68,-69,-58,-59,-60,-75,-30,-32,-22,-50,-25,-15,-19,-14,-21,-71,-73,-35,-42,-46,-14,-36,-20,]),'string':([18,57,],[37,37,]),'then':([20,27,33,49,50,51,52,53,54,82,83,84,92,109,110,126,127,128,133,134,135,141,143,],[41,-24,-26,-41,-45,-49,-67,-68,-69,-58,-59,-60,118,-50,-25,-71,-73,136,-40,-42,-46,144,-39,]),'closedBra':([25,108,],[46,125,]),'coma':([27,31,32,33,34,35,36,37,42,44,45,48,49,50,51,52,53,54,82,83,84,86,87,103,107,109,110,126,127,133,134,135,],[-24,56,-29,-26,57,-31,-33,-34,69,71,-4,76,-41,-45,-49,-67,-68,-69,-58,-59,-60,-30,-32,123,-5,-50,-25,-71,-73,140,-42,-46,]),'mul':([27,33,49,50,51,52,53,54,82,83,84,109,110,126,127,135,],[-24,-26,80,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,80,-73,-46,]),'div':([27,33,49,50,51,52,53,54,82,83,84,109,110,126,127,135,],[-24,-26,81,-45,-49,-67,-68,-69,-58,-59,-60,-50,-25,81,-73,-46,]),'plus':([27,33,48,49,50,51,52,53,54,73,82,83,84,85,103,109,110,112,126,127,133,134,135,],[-24,-26,77,-41,-45,-49,-67,-68,-69,77,-58,-59,-60,77,77,-50,-25,77,-71,-73,77,-42,-46,]),'minus':([27,33,48,49,50,51,52,53,54,73,82,83,84,85,103,109,110,112,126,127,133,134,135,],[-24,-26,78,-41,-45,-49,-67,-68,-69,78,-58,-59,-60,78,78,-50,-25,78,-71,-73,78,-42,-46,]),'closedParen':([27,33,48,49,50,51,52,53,54,62,63,64,73,74,82,83,84,91,102,109,110,112,116,117,122,126,127,130,131,132,134,135,137,138,139,],[-24,-26,-28,-41,-45,-49,-67,-68,-69,92,-51,-53,109,110,-58,-59,-60,117,-82,-50,-25,-27,128,-56,-57,-71,-73,-76,-78,-81,-42,-46,-52,-54,-55,]),'less':([27,33,52,53,54,65,82,83,84,110,],[-24,-26,-67,-68,-69,96,-58,-59,-60,-25,]),'more':([27,33,52,53,54,65,82,83,84,110,],[-24,-26,-67,-68,-69,97,-58,-59,-60,-25,]),'doubleEquals':([27,33,52,53,54,65,82,83,84,110,],[-24,-26,-67,-68,-69,98,-58,-59,-60,-25,]),'notEquals':([27,33,52,53,54,65,82,83,84,110,],[-24,-26,-67,-68,-69,99,-58,-59,-60,-25,]),'lessEquals':([27,33,52,53,54,65,82,83,84,110,],[-24,-26,-67,-68,-69,100,-58,-59,-60,-25,]),'moreEquals':([27,33,52,53,54,65,82,83,84,110,],[-24,-26,-67,-68,-69,101,-58,-59,-60,-25,]),'and':([27,33,52,53,54,63,64,82,83,84,102,110,117,122,130,131,132,137,138,139,],[-24,-26,-67,-68,-69,94,-53,-58,-59,-60,-82,-25,-56,-57,94,-78,-81,-52,-54,-55,]),'or':([27,33,52,53,54,62,63,64,82,83,84,91,102,110,116,117,122,130,131,132,137,138,139,],[-24,-26,-67,-68,-69,93,-51,-53,-58,-59,-60,93,93,-25,93,-56,-57,-76,-78,-81,-52,-54,-55,]),'rea':([28,39,47,55,61,66,67,75,76,77,78,79,80,81,89,93,94,95,96,97,98,99,100,101,111,113,119,120,121,123,],[54,54,54,54,54,54,54,-70,54,-43,-44,-72,-47,-48,54,-77,-79,-80,-61,-62,-63,-64,-65,-66,54,54,54,54,54,54,]),'not':([39,61,66,89,93,94,119,120,],[66,66,66,66,-77,-79,66,66,]),} +_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 = {} 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,41,60,118,136,144,],[9,43,68,90,129,142,145,]),'Dim':([6,],[11,]),'S':([9,43,68,90,129,142,145,],[15,15,15,15,15,15,15,]),'Dimensional':([9,17,18,21,28,39,43,47,55,56,57,61,66,67,68,69,76,89,90,111,113,119,120,121,123,129,142,145,],[16,32,36,42,52,52,16,52,52,86,36,52,52,52,16,105,52,52,16,52,52,52,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,87,]),'Relif':([19,],[38,]),'Rid':([24,],[44,]),'EA':([28,47,55,67,76,123,],[48,73,85,103,112,133,]),'MultDiv':([28,47,55,67,76,111,123,],[49,49,49,49,49,126,49,]),'EAParens':([28,47,55,67,76,111,113,123,],[50,50,50,50,50,50,127,50,]),'EItem':([28,39,47,55,61,66,67,76,89,111,113,119,120,121,123,],[51,65,51,51,65,65,51,51,65,51,51,65,65,132,51,]),'ElseOrEmpty':([38,],[58,]),'EL':([39,61,66,89,],[62,91,102,116,]),'AND':([39,61,66,89,119,],[63,63,63,63,130,]),'Equality':([39,61,66,89,119,120,],[64,64,64,64,64,131,]),'ComaEAOrEmpty':([48,],[74,]),'SumOrSub':([48,73,85,103,112,133,],[75,75,75,75,75,75,]),'MDSymbols':([49,126,],[79,79,]),'action_1':([52,],[82,]),'action_2':([53,],[83,]),'action_2_rea':([54,],[84,]),'EQSymbols':([65,],[95,]),'action_3':([75,],[111,]),'action_5':([79,],[113,]),'action_8':([85,],[114,]),'action_10':([93,],[119,]),'action_12':([94,],[120,]),'action_13':([95,],[121,]),'action_15':([102,],[122,]),'action_4':([126,],[134,]),'action_6':([127,],[135,]),'action_9':([130,],[137,]),'action_11':([131,],[138,]),'action_14':([132,],[139,]),'IntOrEmpty':([133,],[141,]),} +_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 = {} for _k, _v in _lr_goto_items.items(): @@ -27,86 +27,91 @@ 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',165), - ('V -> V Tipo Dim doubleColon Rid','V',5,'p_V','fort.py',171), - ('V -> ','V',0,'p_V','fort.py',172), - ('Rid -> id','Rid',1,'p_Rid','fort.py',183), - ('Rid -> Rid coma id','Rid',3,'p_Rid','fort.py',184), - ('Tipo -> integer','Tipo',1,'p_Tipo','fort.py',195), - ('Tipo -> real','Tipo',1,'p_Tipo','fort.py',196), - ('Dim -> openBra int closedBra','Dim',3,'p_Dim','fort.py',203), - ('Dim -> openBra int closedBra openBra int closedBra','Dim',6,'p_Dim','fort.py',204), - ('Dim -> ','Dim',0,'p_Dim','fort.py',205), - ('F -> F subroutine id B end subroutine','F',6,'p_F','fort.py',210), - ('F -> ','F',0,'p_F','fort.py',211), - ('B -> B S','B',2,'p_B','fort.py',216), - ('B -> ','B',0,'p_B','fort.py',217), - ('S -> Dimensional action_7 equals EA action_8','S',5,'p_S','fort.py',222), - ('S -> id parens','S',2,'p_S','fort.py',223), - ('S -> read RDimensional','S',2,'p_S','fort.py',224), - ('S -> print RDimOrString','S',2,'p_S','fort.py',225), - ('S -> if Relif ElseOrEmpty end if','S',5,'p_S','fort.py',226), - ('S -> do id equals EA coma EA IntOrEmpty then B end do','S',11,'p_S','fort.py',227), - ('S -> do then B end do','S',5,'p_S','fort.py',228), - ('S -> swap Dimensional coma Dimensional','S',4,'p_S','fort.py',229), - ('S -> exit','S',1,'p_S','fort.py',230), - ('Dimensional -> id DimensionsOrEmpty','Dimensional',2,'p_Dimensional','fort.py',236), - ('DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen','DimensionsOrEmpty',4,'p_DimensionsOrEmpty','fort.py',243), - ('DimensionsOrEmpty -> ','DimensionsOrEmpty',0,'p_DimensionsOrEmpty','fort.py',244), - ('ComaEAOrEmpty -> coma EA','ComaEAOrEmpty',2,'p_ComaEAOrEmpty','fort.py',249), - ('ComaEAOrEmpty -> ','ComaEAOrEmpty',0,'p_ComaEAOrEmpty','fort.py',250), - ('RDimensional -> Dimensional','RDimensional',1,'p_RDimensional','fort.py',255), - ('RDimensional -> RDimensional coma Dimensional','RDimensional',3,'p_RDimensional','fort.py',256), - ('RDimOrString -> DimOrString','RDimOrString',1,'p_RDimOrString','fort.py',261), - ('RDimOrString -> RDimOrString coma DimOrString','RDimOrString',3,'p_RDimOrString','fort.py',262), - ('DimOrString -> Dimensional','DimOrString',1,'p_DimOrString','fort.py',267), - ('DimOrString -> string','DimOrString',1,'p_DimOrString','fort.py',268), - ('Relif -> openParen EL closedParen then B','Relif',5,'p_Relif','fort.py',273), - ('Relif -> Relif elif openParen EL closedParen then B','Relif',7,'p_Relif','fort.py',274), - ('ElseOrEmpty -> else B','ElseOrEmpty',2,'p_ElseOrEmpty','fort.py',279), - ('ElseOrEmpty -> ','ElseOrEmpty',0,'p_ElseOrEmpty','fort.py',280), - ('IntOrEmpty -> coma int','IntOrEmpty',2,'p_IntOrEmpty','fort.py',285), - ('IntOrEmpty -> ','IntOrEmpty',0,'p_IntOrEmpty','fort.py',286), - ('EA -> MultDiv','EA',1,'p_EA','fort.py',291), - ('EA -> EA SumOrSub action_3 MultDiv action_4','EA',5,'p_EA','fort.py',292), - ('SumOrSub -> plus','SumOrSub',1,'p_SumOrSub','fort.py',298), - ('SumOrSub -> minus','SumOrSub',1,'p_SumOrSub','fort.py',299), - ('MultDiv -> EAParens','MultDiv',1,'p_MultDiv','fort.py',305), - ('MultDiv -> MultDiv MDSymbols action_5 EAParens action_6','MultDiv',5,'p_MultDiv','fort.py',306), - ('MDSymbols -> mul','MDSymbols',1,'p_MDSymbols','fort.py',311), - ('MDSymbols -> div','MDSymbols',1,'p_MDSymbols','fort.py',312), - ('EAParens -> EItem','EAParens',1,'p_EAParens','fort.py',318), - ('EAParens -> openParen EA closedParen','EAParens',3,'p_EAParens','fort.py',319), - ('EL -> AND','EL',1,'p_EL','fort.py',324), - ('EL -> EL or action_10 AND action_9','EL',5,'p_EL','fort.py',325), - ('AND -> Equality','AND',1,'p_AND','fort.py',330), - ('AND -> AND and action_12 Equality action_11','AND',5,'p_AND','fort.py',331), - ('Equality -> EItem EQSymbols action_13 EItem action_14','Equality',5,'p_Equality','fort.py',336), - ('Equality -> openParen EL closedParen','Equality',3,'p_Equality','fort.py',337), - ('Equality -> not EL action_15','Equality',3,'p_Equality','fort.py',338), - ('EItem -> Dimensional action_1','EItem',2,'p_EItem','fort.py',343), - ('EItem -> int action_2','EItem',2,'p_EItem','fort.py',344), - ('EItem -> rea action_2_rea','EItem',2,'p_EItem','fort.py',345), - ('EQSymbols -> less','EQSymbols',1,'p_EQSymbols','fort.py',350), - ('EQSymbols -> more','EQSymbols',1,'p_EQSymbols','fort.py',351), - ('EQSymbols -> doubleEquals','EQSymbols',1,'p_EQSymbols','fort.py',352), - ('EQSymbols -> notEquals','EQSymbols',1,'p_EQSymbols','fort.py',353), - ('EQSymbols -> lessEquals','EQSymbols',1,'p_EQSymbols','fort.py',354), - ('EQSymbols -> moreEquals','EQSymbols',1,'p_EQSymbols','fort.py',355), - ('action_1 -> ','action_1',0,'p_action_1','fort.py',361), - ('action_2 -> ','action_2',0,'p_action_2','fort.py',371), - ('action_2_rea -> ','action_2_rea',0,'p_action_2_rea','fort.py',376), - ('action_3 -> ','action_3',0,'p_action_3','fort.py',381), - ('action_4 -> ','action_4',0,'p_action_4','fort.py',385), - ('action_5 -> ','action_5',0,'p_action_5','fort.py',407), - ('action_6 -> ','action_6',0,'p_action_6','fort.py',412), - ('action_7 -> ','action_7',0,'p_action_7','fort.py',435), - ('action_8 -> ','action_8',0,'p_action_8','fort.py',445), - ('action_9 -> ','action_9',0,'p_action_9','fort.py',461), - ('action_10 -> ','action_10',0,'p_action_10','fort.py',484), - ('action_11 -> ','action_11',0,'p_action_11','fort.py',489), - ('action_12 -> ','action_12',0,'p_action_12','fort.py',511), - ('action_13 -> ','action_13',0,'p_action_13','fort.py',516), - ('action_14 -> ','action_14',0,'p_action_14','fort.py',521), - ('action_15 -> ','action_15',0,'p_action_15','fort.py',543), + ('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), ] diff --git a/final_lang/test2.fort b/final_lang/test2.fort index a8ebf6f..cf47372 100644 --- a/final_lang/test2.fort +++ b/final_lang/test2.fort @@ -1,9 +1,14 @@ program test -integer :: a, b -real :: c +integer :: a, b, c, d, x, y, z, w a = 2 + 4 * (2 + 1) / 3 * b b = a -if (a == b .and. c > b) then - b = b + 1 +if (a > b) then + a = x +elif (a > c) then + a = y +elif (a > d) then + a = z +else + a = w end if end program \ No newline at end of file diff --git a/final_lang/test2.fort.out b/final_lang/test2.fort.out index b9e7b27..bda7795 100644 --- a/final_lang/test2.fort.out +++ b/final_lang/test2.fort.out @@ -5,8 +5,16 @@ + 2 $1 $0 = $0 $50 = $50 $51 -== $50 $51 $0 -> $52 $51 $1 -.and. $0 $1 $2 -+ $51 1 $0 -= $0 $51 +> $50 $51 $0 +gotoF $0 12 += $54 $50 +goto 21 +> $50 $52 $0 +gotoF $0 16 += $55 $50 +goto 21 +> $50 $53 $0 +gotoF $0 20 += $56 $50 +goto 21 += $57 $50