diff --git a/final_lang/lex_yacc.py b/final_lang/lex_yacc.py index 407b955..68aa1d4 100644 --- a/final_lang/lex_yacc.py +++ b/final_lang/lex_yacc.py @@ -156,12 +156,12 @@ def p_B(p): def p_S(p): ''' S : Dimensional equals EA - | parens id + | id parens | read RDimensional | print RDimOrString | if Relif ElseOrEmpty end if - | do id equals EA coma EA IntOrEmpty B end do - | do B end do + | do id equals EA coma EA IntOrEmpty then B end do + | do then B end do | swap Dimensional coma Dimensional | exit ''' @@ -296,32 +296,32 @@ program matrix integer [100][100] :: matrix1, matrix2, resultMatrix integer :: m1Rows, m1Columns, m2Rows, m2Columns, temp, temp2 subroutine sumMatrices - do temp = 1, m1Rows - do temp2 = 1, m1Columns + do temp = 1, m1Rows then + do temp2 = 1, m1Columns then resultMatrix(temp,temp2) = matrix(temp,temp2) + matrix(temp,temp2) resultMatrix(1,1) = 2 end do end do end subroutine subroutine printResultMatrix - do temp = 1, m1Rows - do temp2 = 1, m1Columns + do temp = 1, m1Rows then + do temp2 = 1, m1Columns then print resultMatrix(temp,temp2) , ' ' end do print '\n' end do end subroutine subroutine readMatrix1 - do temp = 1, m1Rows - do temp2 = 1, m1Columns + do temp = 1, m1Rows then + do temp2 = 1, m1Columns then print 'Enter value (', temp, ',', temp2, ') For matrix1\n' read matrix1(temp,temp2) end do end do end subroutine subroutine readMatrix2 - do temp = 1, m1Rows - do temp2 = 1, m1Columns + do temp = 1, m1Rows then + do temp2 = 1, m1Columns then print 'Enter value (', temp, ',', temp2, ') For matrix2\n' read matrix2(temp,temp2) end do @@ -339,17 +339,17 @@ subroutine readM2Dimensions print 'Enter the columns for the second matrix' read m2Columns end subroutine -do - ()readM1Dimensions - ()readM2Dimensions +do then + readM1Dimensions() + readM2Dimensions() if (m1Rows == m2Rows) then exit end if end do -()readMatrix1 -()readMatrix2 -()sumMatrices -()printResultMatrix +readMatrix1() +readMatrix2() +sumMatrices() +printResultMatrix() end program ''' diff --git a/final_lang/parser.out b/final_lang/parser.out index 206612b..fe8884f 100644 --- a/final_lang/parser.out +++ b/final_lang/parser.out @@ -18,12 +18,12 @@ Rule 12 F -> Rule 13 B -> B S Rule 14 B -> Rule 15 S -> Dimensional equals EA -Rule 16 S -> parens id +Rule 16 S -> id parens Rule 17 S -> read RDimensional Rule 18 S -> print RDimOrString Rule 19 S -> if Relif ElseOrEmpty end if -Rule 20 S -> do id equals EA coma EA IntOrEmpty B end do -Rule 21 S -> do B end do +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 Rule 23 S -> exit Rule 24 Dimensional -> id DimensionsOrEmpty @@ -111,7 +111,7 @@ real : 7 string : 34 subroutine : 11 11 swap : 22 -then : 35 36 +then : 20 21 35 36 Nonterminals, with rules where they appear @@ -177,14 +177,13 @@ state 3 real reduce using rule 3 (V -> .) subroutine reduce using rule 3 (V -> .) end reduce using rule 3 (V -> .) - parens reduce using rule 3 (V -> .) + id reduce using rule 3 (V -> .) read reduce using rule 3 (V -> .) print reduce using rule 3 (V -> .) if reduce using rule 3 (V -> .) do reduce using rule 3 (V -> .) swap reduce using rule 3 (V -> .) exit reduce using rule 3 (V -> .) - id reduce using rule 3 (V -> .) V shift and go to state 4 @@ -199,14 +198,13 @@ state 4 subroutine reduce using rule 12 (F -> .) end reduce using rule 12 (F -> .) - parens reduce using rule 12 (F -> .) + id reduce using rule 12 (F -> .) read reduce using rule 12 (F -> .) print reduce using rule 12 (F -> .) if reduce using rule 12 (F -> .) do reduce using rule 12 (F -> .) swap reduce using rule 12 (F -> .) exit reduce using rule 12 (F -> .) - id reduce using rule 12 (F -> .) integer shift and go to state 7 real shift and go to state 8 @@ -222,14 +220,13 @@ state 5 subroutine shift and go to state 10 end reduce using rule 14 (B -> .) - parens reduce using rule 14 (B -> .) + id reduce using rule 14 (B -> .) read reduce using rule 14 (B -> .) print reduce using rule 14 (B -> .) if reduce using rule 14 (B -> .) do reduce using rule 14 (B -> .) swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - id reduce using rule 14 (B -> .) B shift and go to state 9 @@ -266,25 +263,24 @@ state 9 (1) programa -> program id V F B . end program (13) B -> B . S (15) S -> . Dimensional equals EA - (16) S -> . parens id + (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 B end do - (21) S -> . do B end do + (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 14 - parens shift and go to state 17 - read shift and go to state 18 - print shift and go to state 19 - if shift and go to state 20 - do shift and go to state 21 - swap shift and go to state 22 - exit shift and go to state 23 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 @@ -293,14 +289,14 @@ state 10 (11) F -> F subroutine . id B end subroutine - id shift and go to state 24 + id shift and go to state 23 state 11 (2) V -> V Tipo Dim . doubleColon Rid - doubleColon shift and go to state 25 + doubleColon shift and go to state 24 state 12 @@ -308,42 +304,19 @@ state 12 (8) Dim -> openBra . int closedBra (9) Dim -> openBra . int closedBra openBra int closedBra - int shift and go to state 26 + int shift and go to state 25 state 13 + (16) S -> id . parens (24) Dimensional -> id . DimensionsOrEmpty (25) DimensionsOrEmpty -> . openParen EA ComaEAOrEmpty closedParen (26) DimensionsOrEmpty -> . + parens shift and go to state 26 openParen shift and go to state 28 equals reduce using rule 26 (DimensionsOrEmpty -> .) - coma reduce using rule 26 (DimensionsOrEmpty -> .) - end reduce using rule 26 (DimensionsOrEmpty -> .) - parens reduce using rule 26 (DimensionsOrEmpty -> .) - read reduce using rule 26 (DimensionsOrEmpty -> .) - print reduce using rule 26 (DimensionsOrEmpty -> .) - if reduce using rule 26 (DimensionsOrEmpty -> .) - do reduce using rule 26 (DimensionsOrEmpty -> .) - swap reduce using rule 26 (DimensionsOrEmpty -> .) - exit reduce using rule 26 (DimensionsOrEmpty -> .) - id reduce using rule 26 (DimensionsOrEmpty -> .) - elif reduce using rule 26 (DimensionsOrEmpty -> .) - else reduce using rule 26 (DimensionsOrEmpty -> .) - mul reduce using rule 26 (DimensionsOrEmpty -> .) - div reduce using rule 26 (DimensionsOrEmpty -> .) - plus reduce using rule 26 (DimensionsOrEmpty -> .) - minus reduce using rule 26 (DimensionsOrEmpty -> .) - closedParen reduce using rule 26 (DimensionsOrEmpty -> .) - less reduce using rule 26 (DimensionsOrEmpty -> .) - more reduce using rule 26 (DimensionsOrEmpty -> .) - doubleEquals reduce using rule 26 (DimensionsOrEmpty -> .) - notEquals reduce using rule 26 (DimensionsOrEmpty -> .) - lessEquals reduce using rule 26 (DimensionsOrEmpty -> .) - moreEquals reduce using rule 26 (DimensionsOrEmpty -> .) - and reduce using rule 26 (DimensionsOrEmpty -> .) - or reduce using rule 26 (DimensionsOrEmpty -> .) DimensionsOrEmpty shift and go to state 27 @@ -359,14 +332,13 @@ state 15 (13) B -> B S . end reduce using rule 13 (B -> B S .) - parens reduce using rule 13 (B -> B S .) + id reduce using rule 13 (B -> B S .) read reduce using rule 13 (B -> B S .) print reduce using rule 13 (B -> B S .) if reduce using rule 13 (B -> B S .) do reduce using rule 13 (B -> B S .) swap reduce using rule 13 (B -> B S .) exit reduce using rule 13 (B -> B S .) - id reduce using rule 13 (B -> B S .) elif reduce using rule 13 (B -> B S .) else reduce using rule 13 (B -> B S .) @@ -380,24 +352,17 @@ state 16 state 17 - (16) S -> parens . id - - id shift and go to state 31 - - -state 18 - (17) S -> read . RDimensional (29) RDimensional -> . Dimensional (30) RDimensional -> . RDimensional coma Dimensional (24) Dimensional -> . id DimensionsOrEmpty - id shift and go to state 13 + id shift and go to state 33 - RDimensional shift and go to state 32 - Dimensional shift and go to state 33 + RDimensional shift and go to state 31 + Dimensional shift and go to state 32 -state 19 +state 18 (18) S -> print . RDimOrString (31) RDimOrString -> . DimOrString @@ -407,13 +372,13 @@ state 19 (24) Dimensional -> . id DimensionsOrEmpty string shift and go to state 37 - id shift and go to state 13 + id shift and go to state 33 RDimOrString shift and go to state 34 DimOrString shift and go to state 35 Dimensional shift and go to state 36 -state 20 +state 19 (19) S -> if . Relif ElseOrEmpty end if (35) Relif -> . openParen EL closedParen then B @@ -423,73 +388,58 @@ state 20 Relif shift and go to state 38 -state 21 +state 20 - (20) S -> do . id equals EA coma EA IntOrEmpty B end do - (21) S -> do . B end do - (13) B -> . B S - (14) B -> . + (20) S -> do . id equals EA coma EA IntOrEmpty then B end do + (21) S -> do . then B end do - ! shift/reduce conflict for id resolved as shift id shift and go to state 40 - end reduce using rule 14 (B -> .) - parens 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 -> .) + then shift and go to state 41 - ! id [ reduce using rule 14 (B -> .) ] - B shift and go to state 41 - -state 22 +state 21 (22) S -> swap . Dimensional coma Dimensional (24) Dimensional -> . id DimensionsOrEmpty - id shift and go to state 13 + id shift and go to state 33 Dimensional shift and go to state 42 -state 23 +state 22 (23) S -> exit . end reduce using rule 23 (S -> exit .) - parens reduce using rule 23 (S -> exit .) + id reduce using rule 23 (S -> exit .) read reduce using rule 23 (S -> exit .) print reduce using rule 23 (S -> exit .) if reduce using rule 23 (S -> exit .) do reduce using rule 23 (S -> exit .) swap reduce using rule 23 (S -> exit .) exit reduce using rule 23 (S -> exit .) - id reduce using rule 23 (S -> exit .) elif reduce using rule 23 (S -> exit .) else reduce using rule 23 (S -> exit .) -state 24 +state 23 (11) F -> F subroutine id . B end subroutine (13) B -> . B S (14) B -> . end reduce using rule 14 (B -> .) - parens reduce using rule 14 (B -> .) + id reduce using rule 14 (B -> .) read reduce using rule 14 (B -> .) print reduce using rule 14 (B -> .) if reduce using rule 14 (B -> .) do reduce using rule 14 (B -> .) swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - id reduce using rule 14 (B -> .) B shift and go to state 43 -state 25 +state 24 (2) V -> V Tipo Dim doubleColon . Rid (4) Rid -> . id @@ -499,7 +449,7 @@ state 25 Rid shift and go to state 44 -state 26 +state 25 (8) Dim -> openBra int . closedBra (9) Dim -> openBra int . closedBra openBra int closedBra @@ -507,6 +457,22 @@ state 26 closedBra shift and go to state 46 +state 26 + + (16) S -> id parens . + + end reduce using rule 16 (S -> id parens .) + id reduce using rule 16 (S -> id parens .) + read reduce using rule 16 (S -> id parens .) + print reduce using rule 16 (S -> id parens .) + if reduce using rule 16 (S -> id parens .) + do reduce using rule 16 (S -> id parens .) + swap reduce using rule 16 (S -> id parens .) + exit reduce using rule 16 (S -> id parens .) + elif reduce using rule 16 (S -> id parens .) + else reduce using rule 16 (S -> id parens .) + + state 27 (24) Dimensional -> id DimensionsOrEmpty . @@ -514,14 +480,13 @@ state 27 equals reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) coma reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) end reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) - parens reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) + id reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) read reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) print reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) if reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) do reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) swap reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) exit reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) - id reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) elif reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) else reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) mul reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) @@ -535,6 +500,7 @@ state 27 notEquals reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) lessEquals reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) moreEquals reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) + then reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) and reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) or reduce using rule 24 (Dimensional -> id DimensionsOrEmpty .) @@ -556,7 +522,7 @@ state 28 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 EA shift and go to state 48 MultDiv shift and go to state 49 @@ -588,7 +554,7 @@ state 30 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 Dimensional shift and go to state 52 EA shift and go to state 55 @@ -598,72 +564,87 @@ state 30 state 31 - (16) S -> parens id . - - end reduce using rule 16 (S -> parens id .) - parens reduce using rule 16 (S -> parens id .) - read reduce using rule 16 (S -> parens id .) - print reduce using rule 16 (S -> parens id .) - if reduce using rule 16 (S -> parens id .) - do reduce using rule 16 (S -> parens id .) - swap reduce using rule 16 (S -> parens id .) - exit reduce using rule 16 (S -> parens id .) - id reduce using rule 16 (S -> parens id .) - elif reduce using rule 16 (S -> parens id .) - else reduce using rule 16 (S -> parens id .) - - -state 32 - (17) S -> read RDimensional . (30) RDimensional -> RDimensional . coma Dimensional end reduce using rule 17 (S -> read RDimensional .) - parens reduce using rule 17 (S -> read RDimensional .) + id reduce using rule 17 (S -> read RDimensional .) read reduce using rule 17 (S -> read RDimensional .) print reduce using rule 17 (S -> read RDimensional .) if reduce using rule 17 (S -> read RDimensional .) do reduce using rule 17 (S -> read RDimensional .) swap reduce using rule 17 (S -> read RDimensional .) exit reduce using rule 17 (S -> read RDimensional .) - id 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 -state 33 +state 32 (29) RDimensional -> Dimensional . coma reduce using rule 29 (RDimensional -> Dimensional .) end reduce using rule 29 (RDimensional -> Dimensional .) - parens reduce using rule 29 (RDimensional -> Dimensional .) + id reduce using rule 29 (RDimensional -> Dimensional .) read reduce using rule 29 (RDimensional -> Dimensional .) print reduce using rule 29 (RDimensional -> Dimensional .) if reduce using rule 29 (RDimensional -> Dimensional .) do reduce using rule 29 (RDimensional -> Dimensional .) swap reduce using rule 29 (RDimensional -> Dimensional .) exit reduce using rule 29 (RDimensional -> Dimensional .) - id reduce using rule 29 (RDimensional -> Dimensional .) elif reduce using rule 29 (RDimensional -> Dimensional .) else reduce using rule 29 (RDimensional -> Dimensional .) +state 33 + + (24) Dimensional -> id . DimensionsOrEmpty + (25) DimensionsOrEmpty -> . openParen EA ComaEAOrEmpty closedParen + (26) DimensionsOrEmpty -> . + + openParen shift and go to state 28 + coma reduce using rule 26 (DimensionsOrEmpty -> .) + end reduce using rule 26 (DimensionsOrEmpty -> .) + id reduce using rule 26 (DimensionsOrEmpty -> .) + read reduce using rule 26 (DimensionsOrEmpty -> .) + print reduce using rule 26 (DimensionsOrEmpty -> .) + if reduce using rule 26 (DimensionsOrEmpty -> .) + do reduce using rule 26 (DimensionsOrEmpty -> .) + swap reduce using rule 26 (DimensionsOrEmpty -> .) + exit reduce using rule 26 (DimensionsOrEmpty -> .) + elif reduce using rule 26 (DimensionsOrEmpty -> .) + else reduce using rule 26 (DimensionsOrEmpty -> .) + mul reduce using rule 26 (DimensionsOrEmpty -> .) + div reduce using rule 26 (DimensionsOrEmpty -> .) + plus reduce using rule 26 (DimensionsOrEmpty -> .) + minus reduce using rule 26 (DimensionsOrEmpty -> .) + closedParen reduce using rule 26 (DimensionsOrEmpty -> .) + less reduce using rule 26 (DimensionsOrEmpty -> .) + more reduce using rule 26 (DimensionsOrEmpty -> .) + doubleEquals reduce using rule 26 (DimensionsOrEmpty -> .) + notEquals reduce using rule 26 (DimensionsOrEmpty -> .) + lessEquals reduce using rule 26 (DimensionsOrEmpty -> .) + moreEquals reduce using rule 26 (DimensionsOrEmpty -> .) + then reduce using rule 26 (DimensionsOrEmpty -> .) + and reduce using rule 26 (DimensionsOrEmpty -> .) + or reduce using rule 26 (DimensionsOrEmpty -> .) + + DimensionsOrEmpty shift and go to state 27 + state 34 (18) S -> print RDimOrString . (32) RDimOrString -> RDimOrString . coma DimOrString end reduce using rule 18 (S -> print RDimOrString .) - parens reduce using rule 18 (S -> print RDimOrString .) + id reduce using rule 18 (S -> print RDimOrString .) read reduce using rule 18 (S -> print RDimOrString .) print reduce using rule 18 (S -> print RDimOrString .) if reduce using rule 18 (S -> print RDimOrString .) do reduce using rule 18 (S -> print RDimOrString .) swap reduce using rule 18 (S -> print RDimOrString .) exit reduce using rule 18 (S -> print RDimOrString .) - id 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 @@ -675,14 +656,13 @@ state 35 coma reduce using rule 31 (RDimOrString -> DimOrString .) end reduce using rule 31 (RDimOrString -> DimOrString .) - parens reduce using rule 31 (RDimOrString -> DimOrString .) + id reduce using rule 31 (RDimOrString -> DimOrString .) read reduce using rule 31 (RDimOrString -> DimOrString .) print reduce using rule 31 (RDimOrString -> DimOrString .) if reduce using rule 31 (RDimOrString -> DimOrString .) do reduce using rule 31 (RDimOrString -> DimOrString .) swap reduce using rule 31 (RDimOrString -> DimOrString .) exit reduce using rule 31 (RDimOrString -> DimOrString .) - id reduce using rule 31 (RDimOrString -> DimOrString .) elif reduce using rule 31 (RDimOrString -> DimOrString .) else reduce using rule 31 (RDimOrString -> DimOrString .) @@ -693,14 +673,13 @@ state 36 coma reduce using rule 33 (DimOrString -> Dimensional .) end reduce using rule 33 (DimOrString -> Dimensional .) - parens reduce using rule 33 (DimOrString -> Dimensional .) + id reduce using rule 33 (DimOrString -> Dimensional .) read reduce using rule 33 (DimOrString -> Dimensional .) print reduce using rule 33 (DimOrString -> Dimensional .) if reduce using rule 33 (DimOrString -> Dimensional .) do reduce using rule 33 (DimOrString -> Dimensional .) swap reduce using rule 33 (DimOrString -> Dimensional .) exit reduce using rule 33 (DimOrString -> Dimensional .) - id reduce using rule 33 (DimOrString -> Dimensional .) elif reduce using rule 33 (DimOrString -> Dimensional .) else reduce using rule 33 (DimOrString -> Dimensional .) @@ -711,14 +690,13 @@ state 37 coma reduce using rule 34 (DimOrString -> string .) end reduce using rule 34 (DimOrString -> string .) - parens reduce using rule 34 (DimOrString -> string .) + id reduce using rule 34 (DimOrString -> string .) read reduce using rule 34 (DimOrString -> string .) print reduce using rule 34 (DimOrString -> string .) if reduce using rule 34 (DimOrString -> string .) do reduce using rule 34 (DimOrString -> string .) swap reduce using rule 34 (DimOrString -> string .) exit reduce using rule 34 (DimOrString -> string .) - id reduce using rule 34 (DimOrString -> string .) elif reduce using rule 34 (DimOrString -> string .) else reduce using rule 34 (DimOrString -> string .) @@ -755,7 +733,7 @@ state 39 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 13 + id shift and go to state 33 EL shift and go to state 62 AND shift and go to state 63 @@ -765,38 +743,27 @@ state 39 state 40 - (20) S -> do id . equals EA coma EA IntOrEmpty B end do + (20) S -> do id . equals EA coma EA IntOrEmpty then B end do equals shift and go to state 67 state 41 - (21) S -> do B . end do - (13) B -> B . S - (15) S -> . Dimensional equals EA - (16) S -> . parens id - (17) S -> . read RDimensional - (18) S -> . print RDimOrString - (19) S -> . if Relif ElseOrEmpty end if - (20) S -> . do id equals EA coma EA IntOrEmpty B end do - (21) S -> . do B end do - (22) S -> . swap Dimensional coma Dimensional - (23) S -> . exit - (24) Dimensional -> . id DimensionsOrEmpty + (21) S -> do then . B end do + (13) B -> . B S + (14) B -> . - end shift and go to state 68 - parens shift and go to state 17 - read shift and go to state 18 - print shift and go to state 19 - if shift and go to state 20 - do shift and go to state 21 - swap shift and go to state 22 - exit shift and go to state 23 - id shift and go to state 13 + end reduce using rule 14 (B -> .) + id reduce using rule 14 (B -> .) + read reduce using rule 14 (B -> .) + print reduce using rule 14 (B -> .) + if reduce using rule 14 (B -> .) + do reduce using rule 14 (B -> .) + swap reduce using rule 14 (B -> .) + exit reduce using rule 14 (B -> .) - S shift and go to state 15 - Dimensional shift and go to state 16 + B shift and go to state 68 state 42 @@ -810,25 +777,24 @@ state 43 (11) F -> F subroutine id B . end subroutine (13) B -> B . S (15) S -> . Dimensional equals EA - (16) S -> . parens id + (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 B end do - (21) S -> . do B end do + (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 - parens shift and go to state 17 - read shift and go to state 18 - print shift and go to state 19 - if shift and go to state 20 - do shift and go to state 21 - swap shift and go to state 22 - exit shift and go to state 23 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 @@ -842,14 +808,13 @@ state 44 real reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) subroutine reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) end reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) - parens reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) + id reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) read reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) print reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) if reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) 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 .) - id reduce using rule 2 (V -> V Tipo Dim doubleColon Rid .) coma shift and go to state 71 @@ -862,14 +827,13 @@ state 45 real reduce using rule 4 (Rid -> id .) subroutine reduce using rule 4 (Rid -> id .) end reduce using rule 4 (Rid -> id .) - parens reduce using rule 4 (Rid -> id .) + id reduce using rule 4 (Rid -> id .) read reduce using rule 4 (Rid -> id .) print reduce using rule 4 (Rid -> id .) if reduce using rule 4 (Rid -> id .) do reduce using rule 4 (Rid -> id .) swap reduce using rule 4 (Rid -> id .) exit reduce using rule 4 (Rid -> id .) - id reduce using rule 4 (Rid -> id .) state 46 @@ -898,7 +862,7 @@ state 47 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 EA shift and go to state 73 MultDiv shift and go to state 49 @@ -935,16 +899,16 @@ state 49 minus reduce using rule 41 (EA -> MultDiv .) closedParen reduce using rule 41 (EA -> MultDiv .) end reduce using rule 41 (EA -> MultDiv .) - parens reduce using rule 41 (EA -> MultDiv .) + id reduce using rule 41 (EA -> MultDiv .) read reduce using rule 41 (EA -> MultDiv .) print reduce using rule 41 (EA -> MultDiv .) if reduce using rule 41 (EA -> MultDiv .) do reduce using rule 41 (EA -> MultDiv .) swap reduce using rule 41 (EA -> MultDiv .) exit reduce using rule 41 (EA -> MultDiv .) - id reduce using rule 41 (EA -> MultDiv .) 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 @@ -961,16 +925,16 @@ state 50 minus reduce using rule 45 (MultDiv -> EAParens .) closedParen reduce using rule 45 (MultDiv -> EAParens .) end reduce using rule 45 (MultDiv -> EAParens .) - parens reduce using rule 45 (MultDiv -> EAParens .) + id reduce using rule 45 (MultDiv -> EAParens .) read reduce using rule 45 (MultDiv -> EAParens .) print reduce using rule 45 (MultDiv -> EAParens .) if reduce using rule 45 (MultDiv -> EAParens .) do reduce using rule 45 (MultDiv -> EAParens .) swap reduce using rule 45 (MultDiv -> EAParens .) exit reduce using rule 45 (MultDiv -> EAParens .) - id reduce using rule 45 (MultDiv -> EAParens .) elif reduce using rule 45 (MultDiv -> EAParens .) else reduce using rule 45 (MultDiv -> EAParens .) + then reduce using rule 45 (MultDiv -> EAParens .) state 51 @@ -984,16 +948,16 @@ state 51 minus reduce using rule 49 (EAParens -> EItem .) closedParen reduce using rule 49 (EAParens -> EItem .) end reduce using rule 49 (EAParens -> EItem .) - parens reduce using rule 49 (EAParens -> EItem .) + id reduce using rule 49 (EAParens -> EItem .) read reduce using rule 49 (EAParens -> EItem .) print reduce using rule 49 (EAParens -> EItem .) if reduce using rule 49 (EAParens -> EItem .) do reduce using rule 49 (EAParens -> EItem .) swap reduce using rule 49 (EAParens -> EItem .) exit reduce using rule 49 (EAParens -> EItem .) - id reduce using rule 49 (EAParens -> EItem .) elif reduce using rule 49 (EAParens -> EItem .) else reduce using rule 49 (EAParens -> EItem .) + then reduce using rule 49 (EAParens -> EItem .) state 52 @@ -1007,14 +971,13 @@ state 52 minus reduce using rule 58 (EItem -> Dimensional .) closedParen reduce using rule 58 (EItem -> Dimensional .) end reduce using rule 58 (EItem -> Dimensional .) - parens reduce using rule 58 (EItem -> Dimensional .) + id reduce using rule 58 (EItem -> Dimensional .) read reduce using rule 58 (EItem -> Dimensional .) print reduce using rule 58 (EItem -> Dimensional .) if reduce using rule 58 (EItem -> Dimensional .) do reduce using rule 58 (EItem -> Dimensional .) swap reduce using rule 58 (EItem -> Dimensional .) exit reduce using rule 58 (EItem -> Dimensional .) - id reduce using rule 58 (EItem -> Dimensional .) elif reduce using rule 58 (EItem -> Dimensional .) else reduce using rule 58 (EItem -> Dimensional .) less reduce using rule 58 (EItem -> Dimensional .) @@ -1023,6 +986,7 @@ state 52 notEquals reduce using rule 58 (EItem -> Dimensional .) lessEquals reduce using rule 58 (EItem -> Dimensional .) moreEquals reduce using rule 58 (EItem -> Dimensional .) + then reduce using rule 58 (EItem -> Dimensional .) and reduce using rule 58 (EItem -> Dimensional .) or reduce using rule 58 (EItem -> Dimensional .) @@ -1038,14 +1002,13 @@ state 53 minus reduce using rule 59 (EItem -> int .) closedParen reduce using rule 59 (EItem -> int .) end reduce using rule 59 (EItem -> int .) - parens reduce using rule 59 (EItem -> int .) + id reduce using rule 59 (EItem -> int .) read reduce using rule 59 (EItem -> int .) print reduce using rule 59 (EItem -> int .) if reduce using rule 59 (EItem -> int .) do reduce using rule 59 (EItem -> int .) swap reduce using rule 59 (EItem -> int .) exit reduce using rule 59 (EItem -> int .) - id reduce using rule 59 (EItem -> int .) elif reduce using rule 59 (EItem -> int .) else reduce using rule 59 (EItem -> int .) less reduce using rule 59 (EItem -> int .) @@ -1054,6 +1017,7 @@ state 53 notEquals reduce using rule 59 (EItem -> int .) lessEquals reduce using rule 59 (EItem -> int .) moreEquals reduce using rule 59 (EItem -> int .) + then reduce using rule 59 (EItem -> int .) and reduce using rule 59 (EItem -> int .) or reduce using rule 59 (EItem -> int .) @@ -1069,14 +1033,13 @@ state 54 minus reduce using rule 60 (EItem -> rea .) closedParen reduce using rule 60 (EItem -> rea .) end reduce using rule 60 (EItem -> rea .) - parens reduce using rule 60 (EItem -> rea .) + id reduce using rule 60 (EItem -> rea .) read reduce using rule 60 (EItem -> rea .) print reduce using rule 60 (EItem -> rea .) if reduce using rule 60 (EItem -> rea .) do reduce using rule 60 (EItem -> rea .) swap reduce using rule 60 (EItem -> rea .) exit reduce using rule 60 (EItem -> rea .) - id reduce using rule 60 (EItem -> rea .) elif reduce using rule 60 (EItem -> rea .) else reduce using rule 60 (EItem -> rea .) less reduce using rule 60 (EItem -> rea .) @@ -1085,6 +1048,7 @@ state 54 notEquals reduce using rule 60 (EItem -> rea .) lessEquals reduce using rule 60 (EItem -> rea .) moreEquals reduce using rule 60 (EItem -> rea .) + then reduce using rule 60 (EItem -> rea .) and reduce using rule 60 (EItem -> rea .) or reduce using rule 60 (EItem -> rea .) @@ -1097,14 +1061,13 @@ state 55 (44) SumOrSub -> . minus end reduce using rule 15 (S -> Dimensional equals EA .) - parens reduce using rule 15 (S -> Dimensional equals EA .) + id reduce using rule 15 (S -> Dimensional equals EA .) read reduce using rule 15 (S -> Dimensional equals EA .) print reduce using rule 15 (S -> Dimensional equals EA .) if reduce using rule 15 (S -> Dimensional equals EA .) do reduce using rule 15 (S -> Dimensional equals EA .) swap reduce using rule 15 (S -> Dimensional equals EA .) exit reduce using rule 15 (S -> Dimensional equals EA .) - id reduce using rule 15 (S -> Dimensional equals EA .) elif reduce using rule 15 (S -> Dimensional equals EA .) else reduce using rule 15 (S -> Dimensional equals EA .) plus shift and go to state 77 @@ -1117,7 +1080,7 @@ state 56 (30) RDimensional -> RDimensional coma . Dimensional (24) Dimensional -> . id DimensionsOrEmpty - id shift and go to state 13 + id shift and go to state 33 Dimensional shift and go to state 82 @@ -1129,7 +1092,7 @@ state 57 (24) Dimensional -> . id DimensionsOrEmpty string shift and go to state 37 - id shift and go to state 13 + id shift and go to state 33 DimOrString shift and go to state 83 Dimensional shift and go to state 36 @@ -1154,14 +1117,13 @@ state 60 (13) B -> . B S (14) B -> . - parens reduce using rule 14 (B -> .) + id reduce using rule 14 (B -> .) read reduce using rule 14 (B -> .) print reduce using rule 14 (B -> .) if reduce using rule 14 (B -> .) do reduce using rule 14 (B -> .) swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - id reduce using rule 14 (B -> .) end reduce using rule 14 (B -> .) B shift and go to state 86 @@ -1185,7 +1147,7 @@ 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 13 + id shift and go to state 33 EL shift and go to state 87 AND shift and go to state 63 @@ -1262,7 +1224,7 @@ state 66 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 13 + id shift and go to state 33 EL shift and go to state 98 AND shift and go to state 63 @@ -1272,7 +1234,7 @@ state 66 state 67 - (20) S -> do id equals . EA coma EA IntOrEmpty B end do + (20) S -> do id equals . EA coma EA IntOrEmpty then B end do (41) EA -> . MultDiv (42) EA -> . EA SumOrSub MultDiv (45) MultDiv -> . EAParens @@ -1287,7 +1249,7 @@ state 67 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 EA shift and go to state 99 MultDiv shift and go to state 49 @@ -1297,17 +1259,37 @@ state 67 state 68 - (21) S -> do B end . do + (21) S -> do then B . end do + (13) B -> B . S + (15) S -> . Dimensional equals EA + (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 + (24) Dimensional -> . id DimensionsOrEmpty - do shift and go to state 100 + end shift and go to state 100 + 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 69 (22) S -> swap Dimensional coma . Dimensional (24) Dimensional -> . id DimensionsOrEmpty - id shift and go to state 13 + id shift and go to state 33 Dimensional shift and go to state 101 @@ -1367,7 +1349,7 @@ state 75 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 MultDiv shift and go to state 107 EAParens shift and go to state 50 @@ -1391,7 +1373,7 @@ state 76 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 EA shift and go to state 108 MultDiv shift and go to state 49 @@ -1432,7 +1414,7 @@ state 79 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 EAParens shift and go to state 109 EItem shift and go to state 51 @@ -1464,14 +1446,13 @@ state 82 coma reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) end reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) - parens reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) + id reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) read reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) print reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) if reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) do reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) swap reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) exit reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) - id reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) elif reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) else reduce using rule 30 (RDimensional -> RDimensional coma Dimensional .) @@ -1482,14 +1463,13 @@ state 83 coma reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) end reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) - parens reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) + id reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) read reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) print reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) if reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) do reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) swap reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) exit reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) - id reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) elif reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) else reduce using rule 32 (RDimOrString -> RDimOrString coma DimOrString .) @@ -1520,7 +1500,7 @@ state 85 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 13 + id shift and go to state 33 EL shift and go to state 111 AND shift and go to state 63 @@ -1533,25 +1513,24 @@ state 86 (37) ElseOrEmpty -> else B . (13) B -> B . S (15) S -> . Dimensional equals EA - (16) S -> . parens id + (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 B end do - (21) S -> . do B end do + (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 reduce using rule 37 (ElseOrEmpty -> else B .) - parens shift and go to state 17 - read shift and go to state 18 - print shift and go to state 19 - if shift and go to state 20 - do shift and go to state 21 - swap shift and go to state 22 - exit shift and go to state 23 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 @@ -1589,7 +1568,7 @@ state 89 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 13 + id shift and go to state 33 AND shift and go to state 114 Equality shift and go to state 64 @@ -1611,7 +1590,7 @@ state 90 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 13 + id shift and go to state 33 Equality shift and go to state 115 EItem shift and go to state 65 @@ -1627,7 +1606,7 @@ state 91 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 EItem shift and go to state 116 Dimensional shift and go to state 52 @@ -1701,7 +1680,7 @@ state 98 state 99 - (20) S -> do id equals EA . coma EA IntOrEmpty B end do + (20) S -> do id equals EA . coma EA IntOrEmpty then B end do (42) EA -> EA . SumOrSub MultDiv (43) SumOrSub -> . plus (44) SumOrSub -> . minus @@ -1714,19 +1693,9 @@ state 99 state 100 - (21) S -> do B end do . + (21) S -> do then B end . do - end reduce using rule 21 (S -> do B end do .) - parens reduce using rule 21 (S -> do B end do .) - read reduce using rule 21 (S -> do B end do .) - print reduce using rule 21 (S -> do B end do .) - if reduce using rule 21 (S -> do B end do .) - do reduce using rule 21 (S -> do B end do .) - swap reduce using rule 21 (S -> do B end do .) - exit reduce using rule 21 (S -> do B end do .) - id reduce using rule 21 (S -> do B end do .) - elif reduce using rule 21 (S -> do B end do .) - else reduce using rule 21 (S -> do B end do .) + do shift and go to state 118 state 101 @@ -1734,14 +1703,13 @@ state 101 (22) S -> swap Dimensional coma Dimensional . end reduce using rule 22 (S -> swap Dimensional coma Dimensional .) - parens reduce using rule 22 (S -> swap Dimensional coma Dimensional .) + id reduce using rule 22 (S -> swap Dimensional coma Dimensional .) read reduce using rule 22 (S -> swap Dimensional coma Dimensional .) print reduce using rule 22 (S -> swap Dimensional coma Dimensional .) if reduce using rule 22 (S -> swap Dimensional coma Dimensional .) do reduce using rule 22 (S -> swap Dimensional coma Dimensional .) swap reduce using rule 22 (S -> swap Dimensional coma Dimensional .) exit reduce using rule 22 (S -> swap Dimensional coma Dimensional .) - id reduce using rule 22 (S -> swap Dimensional coma Dimensional .) elif reduce using rule 22 (S -> swap Dimensional coma Dimensional .) else reduce using rule 22 (S -> swap Dimensional coma Dimensional .) @@ -1752,14 +1720,13 @@ state 102 subroutine reduce using rule 11 (F -> F subroutine id B end subroutine .) end reduce using rule 11 (F -> F subroutine id B end subroutine .) - parens reduce using rule 11 (F -> F subroutine id B end subroutine .) + id reduce using rule 11 (F -> F subroutine id B end subroutine .) read reduce using rule 11 (F -> F subroutine id B end subroutine .) print reduce using rule 11 (F -> F subroutine id B end subroutine .) if reduce using rule 11 (F -> F subroutine id B end subroutine .) do reduce using rule 11 (F -> F subroutine id B end subroutine .) swap reduce using rule 11 (F -> F subroutine id B end subroutine .) exit reduce using rule 11 (F -> F subroutine id B end subroutine .) - id reduce using rule 11 (F -> F subroutine id B end subroutine .) state 103 @@ -1771,21 +1738,20 @@ state 103 real reduce using rule 5 (Rid -> Rid coma id .) subroutine reduce using rule 5 (Rid -> Rid coma id .) end reduce using rule 5 (Rid -> Rid coma id .) - parens reduce using rule 5 (Rid -> Rid coma id .) + id reduce using rule 5 (Rid -> Rid coma id .) read reduce using rule 5 (Rid -> Rid coma id .) print reduce using rule 5 (Rid -> Rid coma id .) if reduce using rule 5 (Rid -> Rid coma id .) do reduce using rule 5 (Rid -> Rid coma id .) swap reduce using rule 5 (Rid -> Rid coma id .) exit reduce using rule 5 (Rid -> Rid coma id .) - id reduce using rule 5 (Rid -> Rid coma id .) state 104 (9) Dim -> openBra int closedBra openBra int . closedBra - closedBra shift and go to state 118 + closedBra shift and go to state 119 state 105 @@ -1799,16 +1765,16 @@ state 105 minus reduce using rule 50 (EAParens -> openParen EA closedParen .) closedParen reduce using rule 50 (EAParens -> openParen EA closedParen .) end reduce using rule 50 (EAParens -> openParen EA closedParen .) - parens reduce using rule 50 (EAParens -> openParen EA closedParen .) + id reduce using rule 50 (EAParens -> openParen EA closedParen .) read reduce using rule 50 (EAParens -> openParen EA closedParen .) print reduce using rule 50 (EAParens -> openParen EA closedParen .) if reduce using rule 50 (EAParens -> openParen EA closedParen .) do reduce using rule 50 (EAParens -> openParen EA closedParen .) swap reduce using rule 50 (EAParens -> openParen EA closedParen .) exit reduce using rule 50 (EAParens -> openParen EA closedParen .) - id reduce using rule 50 (EAParens -> openParen EA closedParen .) elif reduce using rule 50 (EAParens -> openParen EA closedParen .) else reduce using rule 50 (EAParens -> openParen EA closedParen .) + then reduce using rule 50 (EAParens -> openParen EA closedParen .) state 106 @@ -1818,14 +1784,13 @@ state 106 equals reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) coma reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) end reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) - parens reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) + id reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) read reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) print reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) if reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) do reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) swap reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) exit reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) - id reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) elif reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) else reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) mul reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) @@ -1839,6 +1804,7 @@ state 106 notEquals reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) lessEquals reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) moreEquals reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) + then reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) and reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) or reduce using rule 25 (DimensionsOrEmpty -> openParen EA ComaEAOrEmpty closedParen .) @@ -1855,16 +1821,16 @@ state 107 minus reduce using rule 42 (EA -> EA SumOrSub MultDiv .) closedParen reduce using rule 42 (EA -> EA SumOrSub MultDiv .) end reduce using rule 42 (EA -> EA SumOrSub MultDiv .) - parens reduce using rule 42 (EA -> EA SumOrSub MultDiv .) + id reduce using rule 42 (EA -> EA SumOrSub MultDiv .) read reduce using rule 42 (EA -> EA SumOrSub MultDiv .) print reduce using rule 42 (EA -> EA SumOrSub MultDiv .) if reduce using rule 42 (EA -> EA SumOrSub MultDiv .) do reduce using rule 42 (EA -> EA SumOrSub MultDiv .) swap reduce using rule 42 (EA -> EA SumOrSub MultDiv .) exit reduce using rule 42 (EA -> EA SumOrSub MultDiv .) - id reduce using rule 42 (EA -> EA SumOrSub MultDiv .) elif reduce using rule 42 (EA -> EA SumOrSub MultDiv .) else reduce using rule 42 (EA -> EA SumOrSub MultDiv .) + then reduce using rule 42 (EA -> EA SumOrSub MultDiv .) mul shift and go to state 80 div shift and go to state 81 @@ -1894,16 +1860,16 @@ state 109 minus reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) closedParen reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) end reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) - parens reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) + id reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) read reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) print reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) if reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) do reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) swap reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) exit reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) - id reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) elif reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) else reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) + then reduce using rule 46 (MultDiv -> MultDiv MDSymbols EAParens .) state 110 @@ -1911,14 +1877,13 @@ state 110 (19) S -> if Relif ElseOrEmpty end if . end reduce using rule 19 (S -> if Relif ElseOrEmpty end if .) - parens 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 .) - id 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 .) @@ -1928,7 +1893,7 @@ state 111 (36) Relif -> Relif elif openParen EL . closedParen then B (52) EL -> EL . or AND - closedParen shift and go to state 119 + closedParen shift and go to state 120 or shift and go to state 89 @@ -1947,19 +1912,18 @@ state 113 (13) B -> . B S (14) B -> . - parens reduce using rule 14 (B -> .) + id reduce using rule 14 (B -> .) read reduce using rule 14 (B -> .) print reduce using rule 14 (B -> .) if reduce using rule 14 (B -> .) do reduce using rule 14 (B -> .) swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - id reduce using rule 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 120 + B shift and go to state 121 state 114 @@ -1994,7 +1958,7 @@ state 116 state 117 - (20) S -> do id equals EA coma . EA IntOrEmpty B end do + (20) S -> do id equals EA coma . EA IntOrEmpty then B end do (41) EA -> . MultDiv (42) EA -> . EA SumOrSub MultDiv (45) MultDiv -> . EAParens @@ -2009,9 +1973,9 @@ state 117 openParen shift and go to state 47 int shift and go to state 53 rea shift and go to state 54 - id shift and go to state 13 + id shift and go to state 33 - EA shift and go to state 121 + EA shift and go to state 122 MultDiv shift and go to state 49 EAParens shift and go to state 50 EItem shift and go to state 51 @@ -2019,29 +1983,45 @@ state 117 state 118 + (21) S -> do then B end do . + + end reduce using rule 21 (S -> do then B end do .) + id reduce using rule 21 (S -> do then B end do .) + read reduce using rule 21 (S -> do then B end do .) + print reduce using rule 21 (S -> do then B end do .) + if reduce using rule 21 (S -> do then B end do .) + do reduce using rule 21 (S -> do then B end do .) + swap reduce using rule 21 (S -> do then B end do .) + exit reduce using rule 21 (S -> do then B end do .) + elif reduce using rule 21 (S -> do then B end do .) + else reduce using rule 21 (S -> do then B end do .) + + +state 119 + (9) Dim -> openBra int closedBra openBra int closedBra . doubleColon reduce using rule 9 (Dim -> openBra int closedBra openBra int closedBra .) -state 119 +state 120 (36) Relif -> Relif elif openParen EL closedParen . then B - then shift and go to state 122 + then shift and go to state 123 -state 120 +state 121 (35) Relif -> openParen EL closedParen then B . (13) B -> B . S (15) S -> . Dimensional equals EA - (16) S -> . parens id + (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 B end do - (21) S -> . do B end do + (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 @@ -2049,99 +2029,78 @@ state 120 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 .) - parens shift and go to state 17 - read shift and go to state 18 - print shift and go to state 19 - if shift and go to state 20 - do shift and go to state 21 - swap shift and go to state 22 - exit shift and go to state 23 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 121 +state 122 - (20) S -> do id equals EA coma EA . IntOrEmpty B end do + (20) S -> do id equals EA coma EA . IntOrEmpty then B end do (42) EA -> EA . SumOrSub MultDiv (39) IntOrEmpty -> . coma int (40) IntOrEmpty -> . (43) SumOrSub -> . plus (44) SumOrSub -> . minus - coma shift and go to state 123 - end reduce using rule 40 (IntOrEmpty -> .) - parens reduce using rule 40 (IntOrEmpty -> .) - read reduce using rule 40 (IntOrEmpty -> .) - print reduce using rule 40 (IntOrEmpty -> .) - if reduce using rule 40 (IntOrEmpty -> .) - do reduce using rule 40 (IntOrEmpty -> .) - swap reduce using rule 40 (IntOrEmpty -> .) - exit reduce using rule 40 (IntOrEmpty -> .) - id reduce using rule 40 (IntOrEmpty -> .) + coma shift and go to state 124 + then reduce using rule 40 (IntOrEmpty -> .) plus shift and go to state 77 minus shift and go to state 78 - IntOrEmpty shift and go to state 124 + IntOrEmpty shift and go to state 125 SumOrSub shift and go to state 75 -state 122 +state 123 (36) Relif -> Relif elif openParen EL closedParen then . B (13) B -> . B S (14) B -> . - parens reduce using rule 14 (B -> .) + id reduce using rule 14 (B -> .) read reduce using rule 14 (B -> .) print reduce using rule 14 (B -> .) if reduce using rule 14 (B -> .) do reduce using rule 14 (B -> .) swap reduce using rule 14 (B -> .) exit reduce using rule 14 (B -> .) - id reduce using rule 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 125 - -state 123 - - (39) IntOrEmpty -> coma . int - - int shift and go to state 126 - + B shift and go to state 126 state 124 - (20) S -> do id equals EA coma EA IntOrEmpty . B end do - (13) B -> . B S - (14) B -> . + (39) IntOrEmpty -> coma . int - end reduce using rule 14 (B -> .) - parens reduce using rule 14 (B -> .) - read reduce using rule 14 (B -> .) - print reduce using rule 14 (B -> .) - if reduce using rule 14 (B -> .) - do reduce using rule 14 (B -> .) - swap reduce using rule 14 (B -> .) - exit reduce using rule 14 (B -> .) - id reduce using rule 14 (B -> .) + int shift and go to state 127 - B shift and go to state 127 state 125 + (20) S -> do id equals EA coma EA IntOrEmpty . then B end do + + then shift and go to state 128 + + +state 126 + (36) Relif -> Relif elif openParen EL closedParen then B . (13) B -> B . S (15) S -> . Dimensional equals EA - (16) S -> . parens id + (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 B end do - (21) S -> . do B end do + (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 @@ -2149,88 +2108,93 @@ state 125 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 .) - parens shift and go to state 17 - read shift and go to state 18 - print shift and go to state 19 - if shift and go to state 20 - do shift and go to state 21 - swap shift and go to state 22 - exit shift and go to state 23 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 126 +state 127 (39) IntOrEmpty -> coma int . - end reduce using rule 39 (IntOrEmpty -> coma int .) - parens reduce using rule 39 (IntOrEmpty -> coma int .) - read reduce using rule 39 (IntOrEmpty -> coma int .) - print reduce using rule 39 (IntOrEmpty -> coma int .) - if reduce using rule 39 (IntOrEmpty -> coma int .) - do reduce using rule 39 (IntOrEmpty -> coma int .) - swap reduce using rule 39 (IntOrEmpty -> coma int .) - exit reduce using rule 39 (IntOrEmpty -> coma int .) - id reduce using rule 39 (IntOrEmpty -> coma int .) + then reduce using rule 39 (IntOrEmpty -> coma int .) -state 127 +state 128 - (20) S -> do id equals EA coma EA IntOrEmpty B . end do + (20) S -> do id equals EA coma EA IntOrEmpty then . B end do + (13) B -> . B S + (14) B -> . + + end reduce using rule 14 (B -> .) + id reduce using rule 14 (B -> .) + read reduce using rule 14 (B -> .) + print reduce using rule 14 (B -> .) + if reduce using rule 14 (B -> .) + do reduce using rule 14 (B -> .) + swap reduce using rule 14 (B -> .) + exit reduce using rule 14 (B -> .) + + B shift and go to state 129 + +state 129 + + (20) S -> do id equals EA coma EA IntOrEmpty then B . end do (13) B -> B . S (15) S -> . Dimensional equals EA - (16) S -> . parens id + (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 B end do - (21) S -> . do B end do + (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 128 - parens shift and go to state 17 - read shift and go to state 18 - print shift and go to state 19 - if shift and go to state 20 - do shift and go to state 21 - swap shift and go to state 22 - exit shift and go to state 23 + end shift and go to state 130 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 128 +state 130 - (20) S -> do id equals EA coma EA IntOrEmpty B end . do + (20) S -> do id equals EA coma EA IntOrEmpty then B end . do - do shift and go to state 129 + do shift and go to state 131 -state 129 +state 131 - (20) S -> do id equals EA coma EA IntOrEmpty B end do . + (20) S -> do id equals EA coma EA IntOrEmpty then B end do . - end reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - parens reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - read reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - print reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - if reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - do reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - swap reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - exit reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - id reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - elif reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) - else reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty B end do .) + end reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + id reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + read reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + print reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + if reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + do reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + swap reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + exit reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + elif reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) + else reduce using rule 20 (S -> do id equals EA coma EA IntOrEmpty then B end do .) WARNING: WARNING: Conflicts: WARNING: -WARNING: shift/reduce conflict for id in state 21 resolved as shift WARNING: shift/reduce conflict for and in state 63 resolved as shift WARNING: shift/reduce conflict for or in state 98 resolved as shift WARNING: shift/reduce conflict for and in state 114 resolved as shift diff --git a/final_lang/parsetab.py b/final_lang/parsetab.py index 5181beb..16f24e9 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 equals EA\n | parens id\n | read RDimensional\n | print RDimOrString\n | if Relif ElseOrEmpty end if\n | do id equals EA coma EA IntOrEmpty B end do\n | do 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 MultDiv\n \n SumOrSub : plus\n | minus\n \n MultDiv : EAParens\n | MultDiv MDSymbols EAParens\n \n MDSymbols : mul\n | div\n \n EAParens : EItem\n | openParen EA closedParen\n \n EL : AND\n | EL or AND\n \n AND : Equality\n | AND and Equality\n \n Equality : EItem EQSymbols EItem\n | openParen EL closedParen\n | not EL\n \n EItem : Dimensional\n | int\n | rea\n \n EQSymbols : less\n | more\n | doubleEquals\n | notEquals\n | lessEquals\n | moreEquals\n ' +_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 equals EA\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 MultDiv\n \n SumOrSub : plus\n | minus\n \n MultDiv : EAParens\n | MultDiv MDSymbols EAParens\n \n MDSymbols : mul\n | div\n \n EAParens : EItem\n | openParen EA closedParen\n \n EL : AND\n | EL or AND\n \n AND : Equality\n | AND and Equality\n \n Equality : EItem EQSymbols EItem\n | openParen EL closedParen\n | not EL\n \n EItem : Dimensional\n | int\n | rea\n \n EQSymbols : less\n | more\n | doubleEquals\n | notEquals\n | lessEquals\n | moreEquals\n ' -_lr_action_items = {'program':([0,14,],[2,29,]),'$end':([1,29,],[0,-1,]),'id':([2,3,4,5,9,10,13,15,17,18,19,21,22,23,24,25,27,28,30,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,69,71,75,76,77,78,79,80,81,82,83,85,86,89,90,91,92,93,94,95,96,97,100,101,102,103,105,106,107,109,110,113,117,120,121,122,124,125,126,127,129,],[3,-3,-12,-14,13,24,-26,-13,31,13,13,40,13,-23,-14,45,-24,13,13,-16,-17,-29,-18,-31,-33,-34,13,13,13,-2,-4,13,-41,-45,-49,-58,-59,-60,-15,13,13,-14,13,13,13,13,103,13,13,-43,-44,13,-47,-48,-30,-32,13,13,13,13,13,-61,-62,-63,-64,-65,-66,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,13,13,-40,-14,-14,13,-39,13,-20,]),'integer':([3,4,44,45,103,],[-3,7,-2,-4,-5,]),'real':([3,4,44,45,103,],[-3,8,-2,-4,-5,]),'subroutine':([3,4,5,44,45,70,102,103,],[-3,-12,10,-2,-4,102,-11,-5,]),'end':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,38,41,43,44,45,49,50,51,52,53,54,55,58,60,82,83,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,129,],[-3,-12,-14,14,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,-38,68,70,-2,-4,-41,-45,-49,-58,-59,-60,-15,84,-14,-30,-32,-37,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,-35,-40,-14,-14,-36,-39,128,-20,]),'parens':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,82,83,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,129,],[-3,-12,-14,17,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,17,17,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,-30,-32,17,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,17,-40,-14,-14,17,-39,17,-20,]),'read':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,82,83,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,129,],[-3,-12,-14,18,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,18,18,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,-30,-32,18,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,18,-40,-14,-14,18,-39,18,-20,]),'print':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,82,83,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,129,],[-3,-12,-14,19,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,19,19,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,-30,-32,19,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,19,-40,-14,-14,19,-39,19,-20,]),'if':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,82,83,84,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,129,],[-3,-12,-14,20,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,20,20,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,-30,-32,110,20,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,20,-40,-14,-14,20,-39,20,-20,]),'do':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,68,82,83,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,128,129,],[-3,-12,-14,21,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,21,21,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,100,-30,-32,21,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,21,-40,-14,-14,21,-39,21,129,-20,]),'swap':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,82,83,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,129,],[-3,-12,-14,22,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,22,22,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,-30,-32,22,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,22,-40,-14,-14,22,-39,22,-20,]),'exit':([3,4,5,9,13,15,21,23,24,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,82,83,86,100,101,102,103,105,106,107,109,110,113,120,121,122,124,125,126,127,129,],[-3,-12,-14,23,-26,-13,-14,-23,-14,-24,-16,-17,-29,-18,-31,-33,-34,23,23,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,-30,-32,23,-21,-22,-11,-5,-50,-25,-42,-46,-19,-14,23,-40,-14,-14,23,-39,23,-20,]),'openBra':([6,7,8,46,],[12,-6,-7,72,]),'doubleColon':([6,7,8,11,46,118,],[-10,-6,-7,25,-8,-9,]),'int':([12,28,30,39,47,61,66,67,72,75,76,77,78,79,80,81,85,89,90,91,92,93,94,95,96,97,117,123,],[26,53,53,53,53,53,53,53,104,53,53,-43,-44,53,-47,-48,53,53,53,53,-61,-62,-63,-64,-65,-66,53,126,]),'openParen':([13,20,28,30,39,47,59,61,66,67,75,76,77,78,79,80,81,85,89,90,117,],[28,39,47,47,61,47,85,61,61,47,47,47,-43,-44,47,-47,-48,61,61,61,47,]),'equals':([13,16,27,40,106,],[-26,30,-24,67,-25,]),'coma':([13,27,32,33,34,35,36,37,42,44,45,48,49,50,51,52,53,54,82,83,99,103,105,106,107,109,121,],[-26,-24,56,-29,57,-31,-33,-34,69,71,-4,76,-41,-45,-49,-58,-59,-60,-30,-32,117,-5,-50,-25,-42,-46,123,]),'elif':([13,15,23,27,31,32,33,34,35,36,37,38,49,50,51,52,53,54,55,82,83,100,101,105,106,107,109,110,113,120,122,125,129,],[-26,-13,-23,-24,-16,-17,-29,-18,-31,-33,-34,59,-41,-45,-49,-58,-59,-60,-15,-30,-32,-21,-22,-50,-25,-42,-46,-19,-14,-35,-14,-36,-20,]),'else':([13,15,23,27,31,32,33,34,35,36,37,38,49,50,51,52,53,54,55,82,83,100,101,105,106,107,109,110,113,120,122,125,129,],[-26,-13,-23,-24,-16,-17,-29,-18,-31,-33,-34,60,-41,-45,-49,-58,-59,-60,-15,-30,-32,-21,-22,-50,-25,-42,-46,-19,-14,-35,-14,-36,-20,]),'mul':([13,27,49,50,51,52,53,54,105,106,107,109,],[-26,-24,80,-45,-49,-58,-59,-60,-50,-25,80,-46,]),'div':([13,27,49,50,51,52,53,54,105,106,107,109,],[-26,-24,81,-45,-49,-58,-59,-60,-50,-25,81,-46,]),'plus':([13,27,48,49,50,51,52,53,54,55,73,99,105,106,107,108,109,121,],[-26,-24,77,-41,-45,-49,-58,-59,-60,77,77,77,-50,-25,-42,77,-46,77,]),'minus':([13,27,48,49,50,51,52,53,54,55,73,99,105,106,107,108,109,121,],[-26,-24,78,-41,-45,-49,-58,-59,-60,78,78,78,-50,-25,-42,78,-46,78,]),'closedParen':([13,27,48,49,50,51,52,53,54,62,63,64,73,74,87,98,105,106,107,108,109,111,112,114,115,116,],[-26,-24,-28,-41,-45,-49,-58,-59,-60,88,-51,-53,105,106,112,-57,-50,-25,-42,-27,-46,119,-56,-52,-54,-55,]),'less':([13,27,52,53,54,65,106,],[-26,-24,-58,-59,-60,92,-25,]),'more':([13,27,52,53,54,65,106,],[-26,-24,-58,-59,-60,93,-25,]),'doubleEquals':([13,27,52,53,54,65,106,],[-26,-24,-58,-59,-60,94,-25,]),'notEquals':([13,27,52,53,54,65,106,],[-26,-24,-58,-59,-60,95,-25,]),'lessEquals':([13,27,52,53,54,65,106,],[-26,-24,-58,-59,-60,96,-25,]),'moreEquals':([13,27,52,53,54,65,106,],[-26,-24,-58,-59,-60,97,-25,]),'and':([13,27,52,53,54,63,64,98,106,112,114,115,116,],[-26,-24,-58,-59,-60,90,-53,-57,-25,-56,90,-54,-55,]),'or':([13,27,52,53,54,62,63,64,87,98,106,111,112,114,115,116,],[-26,-24,-58,-59,-60,89,-51,-53,89,89,-25,89,-56,-52,-54,-55,]),'string':([19,57,],[37,37,]),'closedBra':([26,104,],[46,118,]),'rea':([28,30,39,47,61,66,67,75,76,77,78,79,80,81,85,89,90,91,92,93,94,95,96,97,117,],[54,54,54,54,54,54,54,54,54,-43,-44,54,-47,-48,54,54,54,54,-61,-62,-63,-64,-65,-66,54,]),'not':([39,61,66,85,89,90,],[66,66,66,66,66,66,]),'then':([88,119,],[113,122,]),} +_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,30,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,85,86,89,90,91,92,93,94,95,96,97,101,102,103,105,106,107,109,110,113,117,118,121,123,126,128,129,131,],[3,-3,-12,-14,13,23,-13,33,33,40,33,-23,-14,45,-16,-24,33,33,-17,-29,-26,-18,-31,-33,-34,33,-14,13,-2,-4,33,-41,-45,-49,-58,-59,-60,-15,33,33,-14,33,33,33,13,33,103,33,33,-43,-44,33,-47,-48,-30,-32,33,13,33,33,33,-61,-62,-63,-64,-65,-66,-22,-11,-5,-50,-25,-42,-46,-19,-14,33,-21,13,-14,13,-14,13,-20,]),'integer':([3,4,44,45,103,],[-3,7,-2,-4,-5,]),'real':([3,4,44,45,103,],[-3,8,-2,-4,-5,]),'subroutine':([3,4,5,44,45,70,102,103,],[-3,-12,10,-2,-4,102,-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,55,58,60,68,82,83,86,101,102,103,105,106,107,109,110,113,118,121,123,126,128,129,131,],[-3,-12,-14,14,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-38,-14,70,-2,-4,-41,-45,-49,-58,-59,-60,-15,84,-14,100,-30,-32,-37,-22,-11,-5,-50,-25,-42,-46,-19,-14,-21,-35,-14,-36,-14,130,-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,55,60,68,82,83,86,101,102,103,105,106,107,109,110,113,118,121,123,126,128,129,131,],[-3,-12,-14,17,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,17,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,17,-30,-32,17,-22,-11,-5,-50,-25,-42,-46,-19,-14,-21,17,-14,17,-14,17,-20,]),'print':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,68,82,83,86,101,102,103,105,106,107,109,110,113,118,121,123,126,128,129,131,],[-3,-12,-14,18,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,18,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,18,-30,-32,18,-22,-11,-5,-50,-25,-42,-46,-19,-14,-21,18,-14,18,-14,18,-20,]),'if':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,68,82,83,84,86,101,102,103,105,106,107,109,110,113,118,121,123,126,128,129,131,],[-3,-12,-14,19,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,19,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,19,-30,-32,110,19,-22,-11,-5,-50,-25,-42,-46,-19,-14,-21,19,-14,19,-14,19,-20,]),'do':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,68,82,83,86,100,101,102,103,105,106,107,109,110,113,118,121,123,126,128,129,130,131,],[-3,-12,-14,20,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,20,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,20,-30,-32,20,118,-22,-11,-5,-50,-25,-42,-46,-19,-14,-21,20,-14,20,-14,20,131,-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,55,60,68,82,83,86,101,102,103,105,106,107,109,110,113,118,121,123,126,128,129,131,],[-3,-12,-14,21,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,21,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,21,-30,-32,21,-22,-11,-5,-50,-25,-42,-46,-19,-14,-21,21,-14,21,-14,21,-20,]),'exit':([3,4,5,9,15,22,23,26,27,31,32,33,34,35,36,37,41,43,44,45,49,50,51,52,53,54,55,60,68,82,83,86,101,102,103,105,106,107,109,110,113,118,121,123,126,128,129,131,],[-3,-12,-14,22,-13,-23,-14,-16,-24,-17,-29,-26,-18,-31,-33,-34,-14,22,-2,-4,-41,-45,-49,-58,-59,-60,-15,-14,22,-30,-32,22,-22,-11,-5,-50,-25,-42,-46,-19,-14,-21,22,-14,22,-14,22,-20,]),'openBra':([6,7,8,46,],[12,-6,-7,72,]),'doubleColon':([6,7,8,11,46,119,],[-10,-6,-7,24,-8,-9,]),'int':([12,28,30,39,47,61,66,67,72,75,76,77,78,79,80,81,85,89,90,91,92,93,94,95,96,97,117,124,],[25,53,53,53,53,53,53,53,104,53,53,-43,-44,53,-47,-48,53,53,53,53,-61,-62,-63,-64,-65,-66,53,127,]),'parens':([13,],[26,]),'openParen':([13,19,28,30,33,39,47,59,61,66,67,75,76,77,78,79,80,81,85,89,90,117,],[28,39,47,47,28,61,47,85,61,61,47,47,47,-43,-44,47,-47,-48,61,61,61,47,]),'equals':([13,16,27,40,106,],[-26,30,-24,67,-25,]),'elif':([15,22,26,27,31,32,33,34,35,36,37,38,49,50,51,52,53,54,55,82,83,101,105,106,107,109,110,113,118,121,123,126,131,],[-13,-23,-16,-24,-17,-29,-26,-18,-31,-33,-34,59,-41,-45,-49,-58,-59,-60,-15,-30,-32,-22,-50,-25,-42,-46,-19,-14,-21,-35,-14,-36,-20,]),'else':([15,22,26,27,31,32,33,34,35,36,37,38,49,50,51,52,53,54,55,82,83,101,105,106,107,109,110,113,118,121,123,126,131,],[-13,-23,-16,-24,-17,-29,-26,-18,-31,-33,-34,60,-41,-45,-49,-58,-59,-60,-15,-30,-32,-22,-50,-25,-42,-46,-19,-14,-21,-35,-14,-36,-20,]),'string':([18,57,],[37,37,]),'then':([20,27,33,49,50,51,52,53,54,88,105,106,107,109,120,122,125,127,],[41,-24,-26,-41,-45,-49,-58,-59,-60,113,-50,-25,-42,-46,123,-40,128,-39,]),'closedBra':([25,104,],[46,119,]),'coma':([27,31,32,33,34,35,36,37,42,44,45,48,49,50,51,52,53,54,82,83,99,103,105,106,107,109,122,],[-24,56,-29,-26,57,-31,-33,-34,69,71,-4,76,-41,-45,-49,-58,-59,-60,-30,-32,117,-5,-50,-25,-42,-46,124,]),'mul':([27,33,49,50,51,52,53,54,105,106,107,109,],[-24,-26,80,-45,-49,-58,-59,-60,-50,-25,80,-46,]),'div':([27,33,49,50,51,52,53,54,105,106,107,109,],[-24,-26,81,-45,-49,-58,-59,-60,-50,-25,81,-46,]),'plus':([27,33,48,49,50,51,52,53,54,55,73,99,105,106,107,108,109,122,],[-24,-26,77,-41,-45,-49,-58,-59,-60,77,77,77,-50,-25,-42,77,-46,77,]),'minus':([27,33,48,49,50,51,52,53,54,55,73,99,105,106,107,108,109,122,],[-24,-26,78,-41,-45,-49,-58,-59,-60,78,78,78,-50,-25,-42,78,-46,78,]),'closedParen':([27,33,48,49,50,51,52,53,54,62,63,64,73,74,87,98,105,106,107,108,109,111,112,114,115,116,],[-24,-26,-28,-41,-45,-49,-58,-59,-60,88,-51,-53,105,106,112,-57,-50,-25,-42,-27,-46,120,-56,-52,-54,-55,]),'less':([27,33,52,53,54,65,106,],[-24,-26,-58,-59,-60,92,-25,]),'more':([27,33,52,53,54,65,106,],[-24,-26,-58,-59,-60,93,-25,]),'doubleEquals':([27,33,52,53,54,65,106,],[-24,-26,-58,-59,-60,94,-25,]),'notEquals':([27,33,52,53,54,65,106,],[-24,-26,-58,-59,-60,95,-25,]),'lessEquals':([27,33,52,53,54,65,106,],[-24,-26,-58,-59,-60,96,-25,]),'moreEquals':([27,33,52,53,54,65,106,],[-24,-26,-58,-59,-60,97,-25,]),'and':([27,33,52,53,54,63,64,98,106,112,114,115,116,],[-24,-26,-58,-59,-60,90,-53,-57,-25,-56,90,-54,-55,]),'or':([27,33,52,53,54,62,63,64,87,98,106,111,112,114,115,116,],[-24,-26,-58,-59,-60,89,-51,-53,89,89,-25,89,-56,-52,-54,-55,]),'rea':([28,30,39,47,61,66,67,75,76,77,78,79,80,81,85,89,90,91,92,93,94,95,96,97,117,],[54,54,54,54,54,54,54,54,54,-43,-44,54,-47,-48,54,54,54,54,-61,-62,-63,-64,-65,-66,54,]),'not':([39,61,66,85,89,90,],[66,66,66,66,66,66,]),} _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,21,24,60,113,122,124,],[9,41,43,86,120,125,127,]),'Dim':([6,],[11,]),'S':([9,41,43,86,120,125,127,],[15,15,15,15,15,15,15,]),'Dimensional':([9,18,19,22,28,30,39,41,43,47,56,57,61,66,67,69,75,76,79,85,86,89,90,91,117,120,125,127,],[16,33,36,42,52,52,52,16,16,52,82,36,52,52,52,101,52,52,52,52,16,52,52,52,52,16,16,16,]),'DimensionsOrEmpty':([13,],[27,]),'RDimensional':([18,],[32,]),'RDimOrString':([19,],[34,]),'DimOrString':([19,57,],[35,83,]),'Relif':([20,],[38,]),'Rid':([25,],[44,]),'EA':([28,30,47,67,76,117,],[48,55,73,99,108,121,]),'MultDiv':([28,30,47,67,75,76,117,],[49,49,49,49,107,49,49,]),'EAParens':([28,30,47,67,75,76,79,117,],[50,50,50,50,50,50,109,50,]),'EItem':([28,30,39,47,61,66,67,75,76,79,85,89,90,91,117,],[51,51,65,51,65,65,51,51,51,51,65,65,65,116,51,]),'ElseOrEmpty':([38,],[58,]),'EL':([39,61,66,85,],[62,87,98,111,]),'AND':([39,61,66,85,89,],[63,63,63,63,114,]),'Equality':([39,61,66,85,89,90,],[64,64,64,64,64,115,]),'ComaEAOrEmpty':([48,],[74,]),'SumOrSub':([48,55,73,99,108,121,],[75,75,75,75,75,75,]),'MDSymbols':([49,107,],[79,79,]),'EQSymbols':([65,],[91,]),'IntOrEmpty':([121,],[124,]),} +_lr_goto_items = {'programa':([0,],[1,]),'V':([3,],[4,]),'F':([4,],[5,]),'Tipo':([4,],[6,]),'B':([5,23,41,60,113,123,128,],[9,43,68,86,121,126,129,]),'Dim':([6,],[11,]),'S':([9,43,68,86,121,126,129,],[15,15,15,15,15,15,15,]),'Dimensional':([9,17,18,21,28,30,39,43,47,56,57,61,66,67,68,69,75,76,79,85,86,89,90,91,117,121,126,129,],[16,32,36,42,52,52,52,16,52,82,36,52,52,52,16,101,52,52,52,52,16,52,52,52,52,16,16,16,]),'DimensionsOrEmpty':([13,33,],[27,27,]),'RDimensional':([17,],[31,]),'RDimOrString':([18,],[34,]),'DimOrString':([18,57,],[35,83,]),'Relif':([19,],[38,]),'Rid':([24,],[44,]),'EA':([28,30,47,67,76,117,],[48,55,73,99,108,122,]),'MultDiv':([28,30,47,67,75,76,117,],[49,49,49,49,107,49,49,]),'EAParens':([28,30,47,67,75,76,79,117,],[50,50,50,50,50,50,109,50,]),'EItem':([28,30,39,47,61,66,67,75,76,79,85,89,90,91,117,],[51,51,65,51,65,65,51,51,51,51,65,65,65,116,51,]),'ElseOrEmpty':([38,],[58,]),'EL':([39,61,66,85,],[62,87,98,111,]),'AND':([39,61,66,85,89,],[63,63,63,63,114,]),'Equality':([39,61,66,85,89,90,],[64,64,64,64,64,115,]),'ComaEAOrEmpty':([48,],[74,]),'SumOrSub':([48,55,73,99,108,122,],[75,75,75,75,75,75,]),'MDSymbols':([49,107,],[79,79,]),'EQSymbols':([65,],[91,]),'IntOrEmpty':([122,],[125,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): @@ -42,12 +42,12 @@ _lr_productions = [ ('B -> B S','B',2,'p_B','lex_yacc.py',152), ('B -> ','B',0,'p_B','lex_yacc.py',153), ('S -> Dimensional equals EA','S',3,'p_S','lex_yacc.py',158), - ('S -> parens id','S',2,'p_S','lex_yacc.py',159), + ('S -> id parens','S',2,'p_S','lex_yacc.py',159), ('S -> read RDimensional','S',2,'p_S','lex_yacc.py',160), ('S -> print RDimOrString','S',2,'p_S','lex_yacc.py',161), ('S -> if Relif ElseOrEmpty end if','S',5,'p_S','lex_yacc.py',162), - ('S -> do id equals EA coma EA IntOrEmpty B end do','S',10,'p_S','lex_yacc.py',163), - ('S -> do B end do','S',4,'p_S','lex_yacc.py',164), + ('S -> do id equals EA coma EA IntOrEmpty then B end do','S',11,'p_S','lex_yacc.py',163), + ('S -> do then B end do','S',5,'p_S','lex_yacc.py',164), ('S -> swap Dimensional coma Dimensional','S',4,'p_S','lex_yacc.py',165), ('S -> exit','S',1,'p_S','lex_yacc.py',166), ('Dimensional -> id DimensionsOrEmpty','Dimensional',2,'p_Dimensional','lex_yacc.py',171),