diff --git a/antlr/.antlr/GPMini.interp b/antlr/.antlr/GPMini.interp
new file mode 100644
index 0000000..4b7bb50
--- /dev/null
+++ b/antlr/.antlr/GPMini.interp
@@ -0,0 +1,86 @@
+token literal names:
+null
+'while'
+'('
+')'
+'if'
+'{'
+'}'
+'break'
+';'
+'input'
+'output'
+'='
+'and'
+'or'
+'^'
+'=='
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'//'
+'not'
+'true'
+'false'
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+TRUE
+FALSE
+INT
+ID
+WS
+
+rule names:
+program
+statement
+statementBlock
+loopStatement
+conditionalStatement
+block
+breakStatement
+inputStatement
+outputStatement
+variable
+variableStatement
+expression
+value
+numericValue
+logicValue
+
+
+atn:
+[4, 1, 30, 125, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 5, 0, 32, 8, 0, 10, 0, 12, 0, 35, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 43, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 50, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 5, 5, 66, 8, 5, 10, 5, 12, 5, 69, 9, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 99, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 110, 8, 11, 10, 11, 12, 11, 113, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 119, 8, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 0, 1, 22, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 4, 1, 0, 12, 14, 1, 0, 15, 20, 1, 0, 21, 24, 1, 0, 26, 27, 127, 0, 33, 1, 0, 0, 0, 2, 42, 1, 0, 0, 0, 4, 49, 1, 0, 0, 0, 6, 51, 1, 0, 0, 0, 8, 57, 1, 0, 0, 0, 10, 63, 1, 0, 0, 0, 12, 72, 1, 0, 0, 0, 14, 75, 1, 0, 0, 0, 16, 77, 1, 0, 0, 0, 18, 81, 1, 0, 0, 0, 20, 83, 1, 0, 0, 0, 22, 98, 1, 0, 0, 0, 24, 118, 1, 0, 0, 0, 26, 120, 1, 0, 0, 0, 28, 122, 1, 0, 0, 0, 30, 32, 3, 2, 1, 0, 31, 30, 1, 0, 0, 0, 32, 35, 1, 0, 0, 0, 33, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 36, 1, 0, 0, 0, 35, 33, 1, 0, 0, 0, 36, 37, 5, 0, 0, 1, 37, 1, 1, 0, 0, 0, 38, 43, 3, 6, 3, 0, 39, 43, 3, 8, 4, 0, 40, 43, 3, 16, 8, 0, 41, 43, 3, 20, 10, 0, 42, 38, 1, 0, 0, 0, 42, 39, 1, 0, 0, 0, 42, 40, 1, 0, 0, 0, 42, 41, 1, 0, 0, 0, 43, 3, 1, 0, 0, 0, 44, 50, 3, 6, 3, 0, 45, 50, 3, 8, 4, 0, 46, 50, 3, 16, 8, 0, 47, 50, 3, 20, 10, 0, 48, 50, 3, 12, 6, 0, 49, 44, 1, 0, 0, 0, 49, 45, 1, 0, 0, 0, 49, 46, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 49, 48, 1, 0, 0, 0, 50, 5, 1, 0, 0, 0, 51, 52, 5, 1, 0, 0, 52, 53, 5, 2, 0, 0, 53, 54, 3, 22, 11, 0, 54, 55, 5, 3, 0, 0, 55, 56, 3, 10, 5, 0, 56, 7, 1, 0, 0, 0, 57, 58, 5, 4, 0, 0, 58, 59, 5, 2, 0, 0, 59, 60, 3, 22, 11, 0, 60, 61, 5, 3, 0, 0, 61, 62, 3, 10, 5, 0, 62, 9, 1, 0, 0, 0, 63, 67, 5, 5, 0, 0, 64, 66, 3, 4, 2, 0, 65, 64, 1, 0, 0, 0, 66, 69, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 70, 71, 5, 6, 0, 0, 71, 11, 1, 0, 0, 0, 72, 73, 5, 7, 0, 0, 73, 74, 5, 8, 0, 0, 74, 13, 1, 0, 0, 0, 75, 76, 5, 9, 0, 0, 76, 15, 1, 0, 0, 0, 77, 78, 5, 10, 0, 0, 78, 79, 3, 22, 11, 0, 79, 80, 5, 8, 0, 0, 80, 17, 1, 0, 0, 0, 81, 82, 5, 29, 0, 0, 82, 19, 1, 0, 0, 0, 83, 84, 3, 18, 9, 0, 84, 85, 5, 11, 0, 0, 85, 86, 3, 22, 11, 0, 86, 87, 5, 8, 0, 0, 87, 21, 1, 0, 0, 0, 88, 89, 6, 11, -1, 0, 89, 90, 5, 2, 0, 0, 90, 91, 3, 22, 11, 0, 91, 92, 5, 3, 0, 0, 92, 99, 1, 0, 0, 0, 93, 94, 5, 25, 0, 0, 94, 99, 3, 22, 11, 3, 95, 96, 5, 25, 0, 0, 96, 99, 3, 24, 12, 0, 97, 99, 3, 24, 12, 0, 98, 88, 1, 0, 0, 0, 98, 93, 1, 0, 0, 0, 98, 95, 1, 0, 0, 0, 98, 97, 1, 0, 0, 0, 99, 111, 1, 0, 0, 0, 100, 101, 10, 7, 0, 0, 101, 102, 7, 0, 0, 0, 102, 110, 3, 22, 11, 8, 103, 104, 10, 6, 0, 0, 104, 105, 7, 1, 0, 0, 105, 110, 3, 22, 11, 7, 106, 107, 10, 5, 0, 0, 107, 108, 7, 2, 0, 0, 108, 110, 3, 22, 11, 6, 109, 100, 1, 0, 0, 0, 109, 103, 1, 0, 0, 0, 109, 106, 1, 0, 0, 0, 110, 113, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 23, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 114, 119, 3, 18, 9, 0, 115, 119, 3, 26, 13, 0, 116, 119, 3, 28, 14, 0, 117, 119, 3, 14, 7, 0, 118, 114, 1, 0, 0, 0, 118, 115, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 118, 117, 1, 0, 0, 0, 119, 25, 1, 0, 0, 0, 120, 121, 5, 28, 0, 0, 121, 27, 1, 0, 0, 0, 122, 123, 7, 3, 0, 0, 123, 29, 1, 0, 0, 0, 8, 33, 42, 49, 67, 98, 109, 111, 118]
\ No newline at end of file
diff --git a/antlr/.antlr/GPMini.tokens b/antlr/.antlr/GPMini.tokens
new file mode 100644
index 0000000..95b7425
--- /dev/null
+++ b/antlr/.antlr/GPMini.tokens
@@ -0,0 +1,57 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+T__6=7
+T__7=8
+T__8=9
+T__9=10
+T__10=11
+T__11=12
+T__12=13
+T__13=14
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+T__22=23
+T__23=24
+T__24=25
+TRUE=26
+FALSE=27
+INT=28
+ID=29
+WS=30
+'while'=1
+'('=2
+')'=3
+'if'=4
+'{'=5
+'}'=6
+'break'=7
+';'=8
+'input'=9
+'output'=10
+'='=11
+'and'=12
+'or'=13
+'^'=14
+'=='=15
+'!='=16
+'<'=17
+'<='=18
+'>'=19
+'>='=20
+'+'=21
+'-'=22
+'*'=23
+'//'=24
+'not'=25
+'true'=26
+'false'=27
diff --git a/antlr/.antlr/GPMiniBaseListener.java b/antlr/.antlr/GPMiniBaseListener.java
new file mode 100644
index 0000000..530b65c
--- /dev/null
+++ b/antlr/.antlr/GPMiniBaseListener.java
@@ -0,0 +1,339 @@
+// Generated from c:/Users/ISI/Documents/Semestr5/Programowanie genetyczne (blok 1S)/GP_Generator/gp_generator/antlr/GPMini.g4 by ANTLR 4.13.1
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+
+/**
+ * This class provides an empty implementation of {@link GPMiniListener},
+ * which can be extended to create a listener which only needs to handle a subset
+ * of the available methods.
+ */
+@SuppressWarnings("CheckReturnValue")
+public class GPMiniBaseListener implements GPMiniListener {
+ /**
+ * {@inheritDoc}
+ *
+ *
The default implementation does nothing.
+ */
+ @Override public void enterProgram(GPMiniParser.ProgramContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitProgram(GPMiniParser.ProgramContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterStatement(GPMiniParser.StatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitStatement(GPMiniParser.StatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterStatementBlock(GPMiniParser.StatementBlockContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitStatementBlock(GPMiniParser.StatementBlockContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLoopStatement(GPMiniParser.LoopStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLoopStatement(GPMiniParser.LoopStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterConditionalStatement(GPMiniParser.ConditionalStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitConditionalStatement(GPMiniParser.ConditionalStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterBlock(GPMiniParser.BlockContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitBlock(GPMiniParser.BlockContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterBreakStatement(GPMiniParser.BreakStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitBreakStatement(GPMiniParser.BreakStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterInputStatement(GPMiniParser.InputStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitInputStatement(GPMiniParser.InputStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterOutputStatement(GPMiniParser.OutputStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitOutputStatement(GPMiniParser.OutputStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterVariable(GPMiniParser.VariableContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitVariable(GPMiniParser.VariableContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterVariableStatement(GPMiniParser.VariableStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitVariableStatement(GPMiniParser.VariableStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterValue(GPMiniParser.ValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitValue(GPMiniParser.ValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterNumericExpression(GPMiniParser.NumericExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitNumericExpression(GPMiniParser.NumericExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterNumericTerm(GPMiniParser.NumericTermContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitNumericTerm(GPMiniParser.NumericTermContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterNumericFactor(GPMiniParser.NumericFactorContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitNumericFactor(GPMiniParser.NumericFactorContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterNumericAtomValue(GPMiniParser.NumericAtomValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitNumericAtomValue(GPMiniParser.NumericAtomValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLogicExpression(GPMiniParser.LogicExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLogicExpression(GPMiniParser.LogicExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLogicTerm(GPMiniParser.LogicTermContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLogicTerm(GPMiniParser.LogicTermContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLogicComparison(GPMiniParser.LogicComparisonContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLogicComparison(GPMiniParser.LogicComparisonContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLogicFactor(GPMiniParser.LogicFactorContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLogicFactor(GPMiniParser.LogicFactorContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLogicAtomValue(GPMiniParser.LogicAtomValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLogicAtomValue(GPMiniParser.LogicAtomValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterNumericComparison(GPMiniParser.NumericComparisonContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitNumericComparison(GPMiniParser.NumericComparisonContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterComparisonOperator(GPMiniParser.ComparisonOperatorContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitComparisonOperator(GPMiniParser.ComparisonOperatorContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterNumericValue(GPMiniParser.NumericValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitNumericValue(GPMiniParser.NumericValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLogicValue(GPMiniParser.LogicValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLogicValue(GPMiniParser.LogicValueContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterEveryRule(ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitEveryRule(ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void visitTerminal(TerminalNode node) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void visitErrorNode(ErrorNode node) { }
+}
\ No newline at end of file
diff --git a/antlr/.antlr/GPMiniLexer.interp b/antlr/.antlr/GPMiniLexer.interp
new file mode 100644
index 0000000..72baa0c
--- /dev/null
+++ b/antlr/.antlr/GPMiniLexer.interp
@@ -0,0 +1,107 @@
+token literal names:
+null
+'while'
+'('
+')'
+'if'
+'{'
+'}'
+'break'
+';'
+'input'
+'output'
+'='
+'and'
+'or'
+'^'
+'=='
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'//'
+'not'
+'true'
+'false'
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+TRUE
+FALSE
+INT
+ID
+WS
+
+rule names:
+T__0
+T__1
+T__2
+T__3
+T__4
+T__5
+T__6
+T__7
+T__8
+T__9
+T__10
+T__11
+T__12
+T__13
+T__14
+T__15
+T__16
+T__17
+T__18
+T__19
+T__20
+T__21
+T__22
+T__23
+T__24
+TRUE
+FALSE
+INT
+ID
+WS
+
+channel names:
+DEFAULT_TOKEN_CHANNEL
+HIDDEN
+
+mode names:
+DEFAULT_MODE
+
+atn:
+[4, 0, 30, 175, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 3, 27, 152, 8, 27, 1, 27, 4, 27, 155, 8, 27, 11, 27, 12, 27, 156, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 164, 8, 28, 10, 28, 12, 28, 167, 9, 28, 1, 29, 4, 29, 170, 8, 29, 11, 29, 12, 29, 171, 1, 29, 1, 29, 0, 0, 30, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 1, 0, 2, 1, 0, 48, 57, 3, 0, 9, 10, 13, 13, 32, 32, 178, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 1, 61, 1, 0, 0, 0, 3, 67, 1, 0, 0, 0, 5, 69, 1, 0, 0, 0, 7, 71, 1, 0, 0, 0, 9, 74, 1, 0, 0, 0, 11, 76, 1, 0, 0, 0, 13, 78, 1, 0, 0, 0, 15, 84, 1, 0, 0, 0, 17, 86, 1, 0, 0, 0, 19, 92, 1, 0, 0, 0, 21, 99, 1, 0, 0, 0, 23, 101, 1, 0, 0, 0, 25, 105, 1, 0, 0, 0, 27, 108, 1, 0, 0, 0, 29, 110, 1, 0, 0, 0, 31, 113, 1, 0, 0, 0, 33, 116, 1, 0, 0, 0, 35, 118, 1, 0, 0, 0, 37, 121, 1, 0, 0, 0, 39, 123, 1, 0, 0, 0, 41, 126, 1, 0, 0, 0, 43, 128, 1, 0, 0, 0, 45, 130, 1, 0, 0, 0, 47, 132, 1, 0, 0, 0, 49, 135, 1, 0, 0, 0, 51, 139, 1, 0, 0, 0, 53, 144, 1, 0, 0, 0, 55, 151, 1, 0, 0, 0, 57, 158, 1, 0, 0, 0, 59, 169, 1, 0, 0, 0, 61, 62, 5, 119, 0, 0, 62, 63, 5, 104, 0, 0, 63, 64, 5, 105, 0, 0, 64, 65, 5, 108, 0, 0, 65, 66, 5, 101, 0, 0, 66, 2, 1, 0, 0, 0, 67, 68, 5, 40, 0, 0, 68, 4, 1, 0, 0, 0, 69, 70, 5, 41, 0, 0, 70, 6, 1, 0, 0, 0, 71, 72, 5, 105, 0, 0, 72, 73, 5, 102, 0, 0, 73, 8, 1, 0, 0, 0, 74, 75, 5, 123, 0, 0, 75, 10, 1, 0, 0, 0, 76, 77, 5, 125, 0, 0, 77, 12, 1, 0, 0, 0, 78, 79, 5, 98, 0, 0, 79, 80, 5, 114, 0, 0, 80, 81, 5, 101, 0, 0, 81, 82, 5, 97, 0, 0, 82, 83, 5, 107, 0, 0, 83, 14, 1, 0, 0, 0, 84, 85, 5, 59, 0, 0, 85, 16, 1, 0, 0, 0, 86, 87, 5, 105, 0, 0, 87, 88, 5, 110, 0, 0, 88, 89, 5, 112, 0, 0, 89, 90, 5, 117, 0, 0, 90, 91, 5, 116, 0, 0, 91, 18, 1, 0, 0, 0, 92, 93, 5, 111, 0, 0, 93, 94, 5, 117, 0, 0, 94, 95, 5, 116, 0, 0, 95, 96, 5, 112, 0, 0, 96, 97, 5, 117, 0, 0, 97, 98, 5, 116, 0, 0, 98, 20, 1, 0, 0, 0, 99, 100, 5, 61, 0, 0, 100, 22, 1, 0, 0, 0, 101, 102, 5, 97, 0, 0, 102, 103, 5, 110, 0, 0, 103, 104, 5, 100, 0, 0, 104, 24, 1, 0, 0, 0, 105, 106, 5, 111, 0, 0, 106, 107, 5, 114, 0, 0, 107, 26, 1, 0, 0, 0, 108, 109, 5, 94, 0, 0, 109, 28, 1, 0, 0, 0, 110, 111, 5, 61, 0, 0, 111, 112, 5, 61, 0, 0, 112, 30, 1, 0, 0, 0, 113, 114, 5, 33, 0, 0, 114, 115, 5, 61, 0, 0, 115, 32, 1, 0, 0, 0, 116, 117, 5, 60, 0, 0, 117, 34, 1, 0, 0, 0, 118, 119, 5, 60, 0, 0, 119, 120, 5, 61, 0, 0, 120, 36, 1, 0, 0, 0, 121, 122, 5, 62, 0, 0, 122, 38, 1, 0, 0, 0, 123, 124, 5, 62, 0, 0, 124, 125, 5, 61, 0, 0, 125, 40, 1, 0, 0, 0, 126, 127, 5, 43, 0, 0, 127, 42, 1, 0, 0, 0, 128, 129, 5, 45, 0, 0, 129, 44, 1, 0, 0, 0, 130, 131, 5, 42, 0, 0, 131, 46, 1, 0, 0, 0, 132, 133, 5, 47, 0, 0, 133, 134, 5, 47, 0, 0, 134, 48, 1, 0, 0, 0, 135, 136, 5, 110, 0, 0, 136, 137, 5, 111, 0, 0, 137, 138, 5, 116, 0, 0, 138, 50, 1, 0, 0, 0, 139, 140, 5, 116, 0, 0, 140, 141, 5, 114, 0, 0, 141, 142, 5, 117, 0, 0, 142, 143, 5, 101, 0, 0, 143, 52, 1, 0, 0, 0, 144, 145, 5, 102, 0, 0, 145, 146, 5, 97, 0, 0, 146, 147, 5, 108, 0, 0, 147, 148, 5, 115, 0, 0, 148, 149, 5, 101, 0, 0, 149, 54, 1, 0, 0, 0, 150, 152, 5, 45, 0, 0, 151, 150, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 154, 1, 0, 0, 0, 153, 155, 7, 0, 0, 0, 154, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 154, 1, 0, 0, 0, 156, 157, 1, 0, 0, 0, 157, 56, 1, 0, 0, 0, 158, 159, 5, 118, 0, 0, 159, 160, 5, 97, 0, 0, 160, 161, 5, 114, 0, 0, 161, 165, 1, 0, 0, 0, 162, 164, 7, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0, 165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 58, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 168, 170, 7, 1, 0, 0, 169, 168, 1, 0, 0, 0, 170, 171, 1, 0, 0, 0, 171, 169, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 174, 6, 29, 0, 0, 174, 60, 1, 0, 0, 0, 5, 0, 151, 156, 165, 171, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/antlr/.antlr/GPMiniLexer.java b/antlr/.antlr/GPMiniLexer.java
new file mode 100644
index 0000000..c959a64
--- /dev/null
+++ b/antlr/.antlr/GPMiniLexer.java
@@ -0,0 +1,230 @@
+// Generated from c:/Users/ISI/Documents/Semestr5/Programowanie genetyczne (blok 1S)/GP_Generator/gp_generator/antlr/GPMini.g4 by ANTLR 4.13.1
+import org.antlr.v4.runtime.Lexer;
+import org.antlr.v4.runtime.CharStream;
+import org.antlr.v4.runtime.Token;
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.misc.*;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"})
+public class GPMiniLexer extends Lexer {
+ static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ new PredictionContextCache();
+ public static final int
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
+ T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
+ T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
+ T__24=25, TRUE=26, FALSE=27, INT=28, ID=29, WS=30;
+ public static String[] channelNames = {
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
+ };
+
+ public static String[] modeNames = {
+ "DEFAULT_MODE"
+ };
+
+ private static String[] makeRuleNames() {
+ return new String[] {
+ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
+ "T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16",
+ "T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24",
+ "TRUE", "FALSE", "INT", "ID", "WS"
+ };
+ }
+ public static final String[] ruleNames = makeRuleNames();
+
+ private static String[] makeLiteralNames() {
+ return new String[] {
+ null, "'while'", "'('", "')'", "'if'", "'{'", "'}'", "'break'", "';'",
+ "'input'", "'output'", "'='", "'and'", "'or'", "'^'", "'=='", "'!='",
+ "'<'", "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'//'", "'not'", "'true'",
+ "'false'"
+ };
+ }
+ private static final String[] _LITERAL_NAMES = makeLiteralNames();
+ private static String[] makeSymbolicNames() {
+ return new String[] {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, "TRUE", "FALSE", "INT", "ID", "WS"
+ };
+ }
+ private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
+ public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+ /**
+ * @deprecated Use {@link #VOCABULARY} instead.
+ */
+ @Deprecated
+ public static final String[] tokenNames;
+ static {
+ tokenNames = new String[_SYMBOLIC_NAMES.length];
+ for (int i = 0; i < tokenNames.length; i++) {
+ tokenNames[i] = VOCABULARY.getLiteralName(i);
+ if (tokenNames[i] == null) {
+ tokenNames[i] = VOCABULARY.getSymbolicName(i);
+ }
+
+ if (tokenNames[i] == null) {
+ tokenNames[i] = "";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+
+ public GPMiniLexer(CharStream input) {
+ super(input);
+ _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+
+ @Override
+ public String getGrammarFileName() { return "GPMini.g4"; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String getSerializedATN() { return _serializedATN; }
+
+ @Override
+ public String[] getChannelNames() { return channelNames; }
+
+ @Override
+ public String[] getModeNames() { return modeNames; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public static final String _serializedATN =
+ "\u0004\u0000\u001e\u00af\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"+
+ "\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002"+
+ "\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002"+
+ "\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002"+
+ "\u000b\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e"+
+ "\u0002\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011"+
+ "\u0002\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014"+
+ "\u0002\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017"+
+ "\u0002\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a"+
+ "\u0002\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d"+
+ "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000"+
+ "\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003"+
+ "\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0006"+
+ "\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007"+
+ "\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\t\u0001"+
+ "\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b"+
+ "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\r\u0001"+
+ "\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f"+
+ "\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012"+
+ "\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0014\u0001\u0014"+
+ "\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017"+
+ "\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0019"+
+ "\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a"+
+ "\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0003\u001b"+
+ "\u0098\b\u001b\u0001\u001b\u0004\u001b\u009b\b\u001b\u000b\u001b\f\u001b"+
+ "\u009c\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0005"+
+ "\u001c\u00a4\b\u001c\n\u001c\f\u001c\u00a7\t\u001c\u0001\u001d\u0004\u001d"+
+ "\u00aa\b\u001d\u000b\u001d\f\u001d\u00ab\u0001\u001d\u0001\u001d\u0000"+
+ "\u0000\u001e\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b"+
+ "\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b"+
+ "\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016"+
+ "-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e\u0001\u0000\u0002"+
+ "\u0001\u000009\u0003\u0000\t\n\r\r \u00b2\u0000\u0001\u0001\u0000\u0000"+
+ "\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000"+
+ "\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000"+
+ "\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000"+
+ "\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000"+
+ "\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000"+
+ "\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000"+
+ "\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000"+
+ "\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001"+
+ "\u0000\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000"+
+ "\u0000\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000"+
+ "\u0000-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000\u00001"+
+ "\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005\u0001\u0000"+
+ "\u0000\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000"+
+ "\u0000;\u0001\u0000\u0000\u0000\u0001=\u0001\u0000\u0000\u0000\u0003C"+
+ "\u0001\u0000\u0000\u0000\u0005E\u0001\u0000\u0000\u0000\u0007G\u0001\u0000"+
+ "\u0000\u0000\tJ\u0001\u0000\u0000\u0000\u000bL\u0001\u0000\u0000\u0000"+
+ "\rN\u0001\u0000\u0000\u0000\u000fT\u0001\u0000\u0000\u0000\u0011V\u0001"+
+ "\u0000\u0000\u0000\u0013\\\u0001\u0000\u0000\u0000\u0015c\u0001\u0000"+
+ "\u0000\u0000\u0017e\u0001\u0000\u0000\u0000\u0019i\u0001\u0000\u0000\u0000"+
+ "\u001bl\u0001\u0000\u0000\u0000\u001dn\u0001\u0000\u0000\u0000\u001fq"+
+ "\u0001\u0000\u0000\u0000!t\u0001\u0000\u0000\u0000#v\u0001\u0000\u0000"+
+ "\u0000%y\u0001\u0000\u0000\u0000\'{\u0001\u0000\u0000\u0000)~\u0001\u0000"+
+ "\u0000\u0000+\u0080\u0001\u0000\u0000\u0000-\u0082\u0001\u0000\u0000\u0000"+
+ "/\u0084\u0001\u0000\u0000\u00001\u0087\u0001\u0000\u0000\u00003\u008b"+
+ "\u0001\u0000\u0000\u00005\u0090\u0001\u0000\u0000\u00007\u0097\u0001\u0000"+
+ "\u0000\u00009\u009e\u0001\u0000\u0000\u0000;\u00a9\u0001\u0000\u0000\u0000"+
+ "=>\u0005w\u0000\u0000>?\u0005h\u0000\u0000?@\u0005i\u0000\u0000@A\u0005"+
+ "l\u0000\u0000AB\u0005e\u0000\u0000B\u0002\u0001\u0000\u0000\u0000CD\u0005"+
+ "(\u0000\u0000D\u0004\u0001\u0000\u0000\u0000EF\u0005)\u0000\u0000F\u0006"+
+ "\u0001\u0000\u0000\u0000GH\u0005i\u0000\u0000HI\u0005f\u0000\u0000I\b"+
+ "\u0001\u0000\u0000\u0000JK\u0005{\u0000\u0000K\n\u0001\u0000\u0000\u0000"+
+ "LM\u0005}\u0000\u0000M\f\u0001\u0000\u0000\u0000NO\u0005b\u0000\u0000"+
+ "OP\u0005r\u0000\u0000PQ\u0005e\u0000\u0000QR\u0005a\u0000\u0000RS\u0005"+
+ "k\u0000\u0000S\u000e\u0001\u0000\u0000\u0000TU\u0005;\u0000\u0000U\u0010"+
+ "\u0001\u0000\u0000\u0000VW\u0005i\u0000\u0000WX\u0005n\u0000\u0000XY\u0005"+
+ "p\u0000\u0000YZ\u0005u\u0000\u0000Z[\u0005t\u0000\u0000[\u0012\u0001\u0000"+
+ "\u0000\u0000\\]\u0005o\u0000\u0000]^\u0005u\u0000\u0000^_\u0005t\u0000"+
+ "\u0000_`\u0005p\u0000\u0000`a\u0005u\u0000\u0000ab\u0005t\u0000\u0000"+
+ "b\u0014\u0001\u0000\u0000\u0000cd\u0005=\u0000\u0000d\u0016\u0001\u0000"+
+ "\u0000\u0000ef\u0005a\u0000\u0000fg\u0005n\u0000\u0000gh\u0005d\u0000"+
+ "\u0000h\u0018\u0001\u0000\u0000\u0000ij\u0005o\u0000\u0000jk\u0005r\u0000"+
+ "\u0000k\u001a\u0001\u0000\u0000\u0000lm\u0005^\u0000\u0000m\u001c\u0001"+
+ "\u0000\u0000\u0000no\u0005=\u0000\u0000op\u0005=\u0000\u0000p\u001e\u0001"+
+ "\u0000\u0000\u0000qr\u0005!\u0000\u0000rs\u0005=\u0000\u0000s \u0001\u0000"+
+ "\u0000\u0000tu\u0005<\u0000\u0000u\"\u0001\u0000\u0000\u0000vw\u0005<"+
+ "\u0000\u0000wx\u0005=\u0000\u0000x$\u0001\u0000\u0000\u0000yz\u0005>\u0000"+
+ "\u0000z&\u0001\u0000\u0000\u0000{|\u0005>\u0000\u0000|}\u0005=\u0000\u0000"+
+ "}(\u0001\u0000\u0000\u0000~\u007f\u0005+\u0000\u0000\u007f*\u0001\u0000"+
+ "\u0000\u0000\u0080\u0081\u0005-\u0000\u0000\u0081,\u0001\u0000\u0000\u0000"+
+ "\u0082\u0083\u0005*\u0000\u0000\u0083.\u0001\u0000\u0000\u0000\u0084\u0085"+
+ "\u0005/\u0000\u0000\u0085\u0086\u0005/\u0000\u0000\u00860\u0001\u0000"+
+ "\u0000\u0000\u0087\u0088\u0005n\u0000\u0000\u0088\u0089\u0005o\u0000\u0000"+
+ "\u0089\u008a\u0005t\u0000\u0000\u008a2\u0001\u0000\u0000\u0000\u008b\u008c"+
+ "\u0005t\u0000\u0000\u008c\u008d\u0005r\u0000\u0000\u008d\u008e\u0005u"+
+ "\u0000\u0000\u008e\u008f\u0005e\u0000\u0000\u008f4\u0001\u0000\u0000\u0000"+
+ "\u0090\u0091\u0005f\u0000\u0000\u0091\u0092\u0005a\u0000\u0000\u0092\u0093"+
+ "\u0005l\u0000\u0000\u0093\u0094\u0005s\u0000\u0000\u0094\u0095\u0005e"+
+ "\u0000\u0000\u00956\u0001\u0000\u0000\u0000\u0096\u0098\u0005-\u0000\u0000"+
+ "\u0097\u0096\u0001\u0000\u0000\u0000\u0097\u0098\u0001\u0000\u0000\u0000"+
+ "\u0098\u009a\u0001\u0000\u0000\u0000\u0099\u009b\u0007\u0000\u0000\u0000"+
+ "\u009a\u0099\u0001\u0000\u0000\u0000\u009b\u009c\u0001\u0000\u0000\u0000"+
+ "\u009c\u009a\u0001\u0000\u0000\u0000\u009c\u009d\u0001\u0000\u0000\u0000"+
+ "\u009d8\u0001\u0000\u0000\u0000\u009e\u009f\u0005v\u0000\u0000\u009f\u00a0"+
+ "\u0005a\u0000\u0000\u00a0\u00a1\u0005r\u0000\u0000\u00a1\u00a5\u0001\u0000"+
+ "\u0000\u0000\u00a2\u00a4\u0007\u0000\u0000\u0000\u00a3\u00a2\u0001\u0000"+
+ "\u0000\u0000\u00a4\u00a7\u0001\u0000\u0000\u0000\u00a5\u00a3\u0001\u0000"+
+ "\u0000\u0000\u00a5\u00a6\u0001\u0000\u0000\u0000\u00a6:\u0001\u0000\u0000"+
+ "\u0000\u00a7\u00a5\u0001\u0000\u0000\u0000\u00a8\u00aa\u0007\u0001\u0000"+
+ "\u0000\u00a9\u00a8\u0001\u0000\u0000\u0000\u00aa\u00ab\u0001\u0000\u0000"+
+ "\u0000\u00ab\u00a9\u0001\u0000\u0000\u0000\u00ab\u00ac\u0001\u0000\u0000"+
+ "\u0000\u00ac\u00ad\u0001\u0000\u0000\u0000\u00ad\u00ae\u0006\u001d\u0000"+
+ "\u0000\u00ae<\u0001\u0000\u0000\u0000\u0005\u0000\u0097\u009c\u00a5\u00ab"+
+ "\u0001\u0006\u0000\u0000";
+ public static final ATN _ATN =
+ new ATNDeserializer().deserialize(_serializedATN.toCharArray());
+ static {
+ _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
+ for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
+ _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
+ }
+ }
+}
\ No newline at end of file
diff --git a/antlr/.antlr/GPMiniLexer.tokens b/antlr/.antlr/GPMiniLexer.tokens
new file mode 100644
index 0000000..95b7425
--- /dev/null
+++ b/antlr/.antlr/GPMiniLexer.tokens
@@ -0,0 +1,57 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+T__6=7
+T__7=8
+T__8=9
+T__9=10
+T__10=11
+T__11=12
+T__12=13
+T__13=14
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+T__22=23
+T__23=24
+T__24=25
+TRUE=26
+FALSE=27
+INT=28
+ID=29
+WS=30
+'while'=1
+'('=2
+')'=3
+'if'=4
+'{'=5
+'}'=6
+'break'=7
+';'=8
+'input'=9
+'output'=10
+'='=11
+'and'=12
+'or'=13
+'^'=14
+'=='=15
+'!='=16
+'<'=17
+'<='=18
+'>'=19
+'>='=20
+'+'=21
+'-'=22
+'*'=23
+'//'=24
+'not'=25
+'true'=26
+'false'=27
diff --git a/antlr/.antlr/GPMiniListener.java b/antlr/.antlr/GPMiniListener.java
new file mode 100644
index 0000000..ff68e59
--- /dev/null
+++ b/antlr/.antlr/GPMiniListener.java
@@ -0,0 +1,259 @@
+// Generated from c:/Users/ISI/Documents/Semestr5/Programowanie genetyczne (blok 1S)/GP_Generator/gp_generator/antlr/GPMini.g4 by ANTLR 4.13.1
+import org.antlr.v4.runtime.tree.ParseTreeListener;
+
+/**
+ * This interface defines a complete listener for a parse tree produced by
+ * {@link GPMiniParser}.
+ */
+public interface GPMiniListener extends ParseTreeListener {
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#program}.
+ * @param ctx the parse tree
+ */
+ void enterProgram(GPMiniParser.ProgramContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#program}.
+ * @param ctx the parse tree
+ */
+ void exitProgram(GPMiniParser.ProgramContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#statement}.
+ * @param ctx the parse tree
+ */
+ void enterStatement(GPMiniParser.StatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#statement}.
+ * @param ctx the parse tree
+ */
+ void exitStatement(GPMiniParser.StatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#statementBlock}.
+ * @param ctx the parse tree
+ */
+ void enterStatementBlock(GPMiniParser.StatementBlockContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#statementBlock}.
+ * @param ctx the parse tree
+ */
+ void exitStatementBlock(GPMiniParser.StatementBlockContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#loopStatement}.
+ * @param ctx the parse tree
+ */
+ void enterLoopStatement(GPMiniParser.LoopStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#loopStatement}.
+ * @param ctx the parse tree
+ */
+ void exitLoopStatement(GPMiniParser.LoopStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#conditionalStatement}.
+ * @param ctx the parse tree
+ */
+ void enterConditionalStatement(GPMiniParser.ConditionalStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#conditionalStatement}.
+ * @param ctx the parse tree
+ */
+ void exitConditionalStatement(GPMiniParser.ConditionalStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#block}.
+ * @param ctx the parse tree
+ */
+ void enterBlock(GPMiniParser.BlockContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#block}.
+ * @param ctx the parse tree
+ */
+ void exitBlock(GPMiniParser.BlockContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#breakStatement}.
+ * @param ctx the parse tree
+ */
+ void enterBreakStatement(GPMiniParser.BreakStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#breakStatement}.
+ * @param ctx the parse tree
+ */
+ void exitBreakStatement(GPMiniParser.BreakStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#inputStatement}.
+ * @param ctx the parse tree
+ */
+ void enterInputStatement(GPMiniParser.InputStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#inputStatement}.
+ * @param ctx the parse tree
+ */
+ void exitInputStatement(GPMiniParser.InputStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#outputStatement}.
+ * @param ctx the parse tree
+ */
+ void enterOutputStatement(GPMiniParser.OutputStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#outputStatement}.
+ * @param ctx the parse tree
+ */
+ void exitOutputStatement(GPMiniParser.OutputStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#variable}.
+ * @param ctx the parse tree
+ */
+ void enterVariable(GPMiniParser.VariableContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#variable}.
+ * @param ctx the parse tree
+ */
+ void exitVariable(GPMiniParser.VariableContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#variableStatement}.
+ * @param ctx the parse tree
+ */
+ void enterVariableStatement(GPMiniParser.VariableStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#variableStatement}.
+ * @param ctx the parse tree
+ */
+ void exitVariableStatement(GPMiniParser.VariableStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#value}.
+ * @param ctx the parse tree
+ */
+ void enterValue(GPMiniParser.ValueContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#value}.
+ * @param ctx the parse tree
+ */
+ void exitValue(GPMiniParser.ValueContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#numericExpression}.
+ * @param ctx the parse tree
+ */
+ void enterNumericExpression(GPMiniParser.NumericExpressionContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#numericExpression}.
+ * @param ctx the parse tree
+ */
+ void exitNumericExpression(GPMiniParser.NumericExpressionContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#numericTerm}.
+ * @param ctx the parse tree
+ */
+ void enterNumericTerm(GPMiniParser.NumericTermContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#numericTerm}.
+ * @param ctx the parse tree
+ */
+ void exitNumericTerm(GPMiniParser.NumericTermContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#numericFactor}.
+ * @param ctx the parse tree
+ */
+ void enterNumericFactor(GPMiniParser.NumericFactorContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#numericFactor}.
+ * @param ctx the parse tree
+ */
+ void exitNumericFactor(GPMiniParser.NumericFactorContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#numericAtomValue}.
+ * @param ctx the parse tree
+ */
+ void enterNumericAtomValue(GPMiniParser.NumericAtomValueContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#numericAtomValue}.
+ * @param ctx the parse tree
+ */
+ void exitNumericAtomValue(GPMiniParser.NumericAtomValueContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#logicExpression}.
+ * @param ctx the parse tree
+ */
+ void enterLogicExpression(GPMiniParser.LogicExpressionContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#logicExpression}.
+ * @param ctx the parse tree
+ */
+ void exitLogicExpression(GPMiniParser.LogicExpressionContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#logicTerm}.
+ * @param ctx the parse tree
+ */
+ void enterLogicTerm(GPMiniParser.LogicTermContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#logicTerm}.
+ * @param ctx the parse tree
+ */
+ void exitLogicTerm(GPMiniParser.LogicTermContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#logicComparison}.
+ * @param ctx the parse tree
+ */
+ void enterLogicComparison(GPMiniParser.LogicComparisonContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#logicComparison}.
+ * @param ctx the parse tree
+ */
+ void exitLogicComparison(GPMiniParser.LogicComparisonContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#logicFactor}.
+ * @param ctx the parse tree
+ */
+ void enterLogicFactor(GPMiniParser.LogicFactorContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#logicFactor}.
+ * @param ctx the parse tree
+ */
+ void exitLogicFactor(GPMiniParser.LogicFactorContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#logicAtomValue}.
+ * @param ctx the parse tree
+ */
+ void enterLogicAtomValue(GPMiniParser.LogicAtomValueContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#logicAtomValue}.
+ * @param ctx the parse tree
+ */
+ void exitLogicAtomValue(GPMiniParser.LogicAtomValueContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#numericComparison}.
+ * @param ctx the parse tree
+ */
+ void enterNumericComparison(GPMiniParser.NumericComparisonContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#numericComparison}.
+ * @param ctx the parse tree
+ */
+ void exitNumericComparison(GPMiniParser.NumericComparisonContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#comparisonOperator}.
+ * @param ctx the parse tree
+ */
+ void enterComparisonOperator(GPMiniParser.ComparisonOperatorContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#comparisonOperator}.
+ * @param ctx the parse tree
+ */
+ void exitComparisonOperator(GPMiniParser.ComparisonOperatorContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#numericValue}.
+ * @param ctx the parse tree
+ */
+ void enterNumericValue(GPMiniParser.NumericValueContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#numericValue}.
+ * @param ctx the parse tree
+ */
+ void exitNumericValue(GPMiniParser.NumericValueContext ctx);
+ /**
+ * Enter a parse tree produced by {@link GPMiniParser#logicValue}.
+ * @param ctx the parse tree
+ */
+ void enterLogicValue(GPMiniParser.LogicValueContext ctx);
+ /**
+ * Exit a parse tree produced by {@link GPMiniParser#logicValue}.
+ * @param ctx the parse tree
+ */
+ void exitLogicValue(GPMiniParser.LogicValueContext ctx);
+}
\ No newline at end of file
diff --git a/antlr/.antlr/GPMiniParser.java b/antlr/.antlr/GPMiniParser.java
new file mode 100644
index 0000000..91226e3
--- /dev/null
+++ b/antlr/.antlr/GPMiniParser.java
@@ -0,0 +1,1011 @@
+// Generated from c:/Users/ISI/Documents/Semestr5/Programowanie genetyczne (blok 1S)/GP_Generator/gp_generator/antlr/GPMini.g4 by ANTLR 4.13.1
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.misc.*;
+import org.antlr.v4.runtime.tree.*;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
+public class GPMiniParser extends Parser {
+ static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ new PredictionContextCache();
+ public static final int
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
+ T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
+ T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
+ T__24=25, TRUE=26, FALSE=27, INT=28, ID=29, WS=30;
+ public static final int
+ RULE_program = 0, RULE_statement = 1, RULE_statementBlock = 2, RULE_loopStatement = 3,
+ RULE_conditionalStatement = 4, RULE_block = 5, RULE_breakStatement = 6,
+ RULE_inputStatement = 7, RULE_outputStatement = 8, RULE_variable = 9,
+ RULE_variableStatement = 10, RULE_expression = 11, RULE_value = 12, RULE_numericValue = 13,
+ RULE_logicValue = 14;
+ private static String[] makeRuleNames() {
+ return new String[] {
+ "program", "statement", "statementBlock", "loopStatement", "conditionalStatement",
+ "block", "breakStatement", "inputStatement", "outputStatement", "variable",
+ "variableStatement", "expression", "value", "numericValue", "logicValue"
+ };
+ }
+ public static final String[] ruleNames = makeRuleNames();
+
+ private static String[] makeLiteralNames() {
+ return new String[] {
+ null, "'while'", "'('", "')'", "'if'", "'{'", "'}'", "'break'", "';'",
+ "'input'", "'output'", "'='", "'and'", "'or'", "'^'", "'=='", "'!='",
+ "'<'", "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'//'", "'not'", "'true'",
+ "'false'"
+ };
+ }
+ private static final String[] _LITERAL_NAMES = makeLiteralNames();
+ private static String[] makeSymbolicNames() {
+ return new String[] {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, "TRUE", "FALSE", "INT", "ID", "WS"
+ };
+ }
+ private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
+ public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+ /**
+ * @deprecated Use {@link #VOCABULARY} instead.
+ */
+ @Deprecated
+ public static final String[] tokenNames;
+ static {
+ tokenNames = new String[_SYMBOLIC_NAMES.length];
+ for (int i = 0; i < tokenNames.length; i++) {
+ tokenNames[i] = VOCABULARY.getLiteralName(i);
+ if (tokenNames[i] == null) {
+ tokenNames[i] = VOCABULARY.getSymbolicName(i);
+ }
+
+ if (tokenNames[i] == null) {
+ tokenNames[i] = "";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+ @Override
+ public String getGrammarFileName() { return "GPMini.g4"; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String getSerializedATN() { return _serializedATN; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public GPMiniParser(TokenStream input) {
+ super(input);
+ _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ProgramContext extends ParserRuleContext {
+ public TerminalNode EOF() { return getToken(GPMiniParser.EOF, 0); }
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public ProgramContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_program; }
+ }
+
+ public final ProgramContext program() throws RecognitionException {
+ ProgramContext _localctx = new ProgramContext(_ctx, getState());
+ enterRule(_localctx, 0, RULE_program);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(33);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536871954L) != 0)) {
+ {
+ {
+ setState(30);
+ statement();
+ }
+ }
+ setState(35);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(36);
+ match(EOF);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class StatementContext extends ParserRuleContext {
+ public LoopStatementContext loopStatement() {
+ return getRuleContext(LoopStatementContext.class,0);
+ }
+ public ConditionalStatementContext conditionalStatement() {
+ return getRuleContext(ConditionalStatementContext.class,0);
+ }
+ public OutputStatementContext outputStatement() {
+ return getRuleContext(OutputStatementContext.class,0);
+ }
+ public VariableStatementContext variableStatement() {
+ return getRuleContext(VariableStatementContext.class,0);
+ }
+ public StatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_statement; }
+ }
+
+ public final StatementContext statement() throws RecognitionException {
+ StatementContext _localctx = new StatementContext(_ctx, getState());
+ enterRule(_localctx, 2, RULE_statement);
+ try {
+ setState(42);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case T__0:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(38);
+ loopStatement();
+ }
+ break;
+ case T__3:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(39);
+ conditionalStatement();
+ }
+ break;
+ case T__9:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(40);
+ outputStatement();
+ }
+ break;
+ case ID:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(41);
+ variableStatement();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class StatementBlockContext extends ParserRuleContext {
+ public LoopStatementContext loopStatement() {
+ return getRuleContext(LoopStatementContext.class,0);
+ }
+ public ConditionalStatementContext conditionalStatement() {
+ return getRuleContext(ConditionalStatementContext.class,0);
+ }
+ public OutputStatementContext outputStatement() {
+ return getRuleContext(OutputStatementContext.class,0);
+ }
+ public VariableStatementContext variableStatement() {
+ return getRuleContext(VariableStatementContext.class,0);
+ }
+ public BreakStatementContext breakStatement() {
+ return getRuleContext(BreakStatementContext.class,0);
+ }
+ public StatementBlockContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_statementBlock; }
+ }
+
+ public final StatementBlockContext statementBlock() throws RecognitionException {
+ StatementBlockContext _localctx = new StatementBlockContext(_ctx, getState());
+ enterRule(_localctx, 4, RULE_statementBlock);
+ try {
+ setState(49);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case T__0:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(44);
+ loopStatement();
+ }
+ break;
+ case T__3:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(45);
+ conditionalStatement();
+ }
+ break;
+ case T__9:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(46);
+ outputStatement();
+ }
+ break;
+ case ID:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(47);
+ variableStatement();
+ }
+ break;
+ case T__6:
+ enterOuterAlt(_localctx, 5);
+ {
+ setState(48);
+ breakStatement();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class LoopStatementContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public BlockContext block() {
+ return getRuleContext(BlockContext.class,0);
+ }
+ public LoopStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_loopStatement; }
+ }
+
+ public final LoopStatementContext loopStatement() throws RecognitionException {
+ LoopStatementContext _localctx = new LoopStatementContext(_ctx, getState());
+ enterRule(_localctx, 6, RULE_loopStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(51);
+ match(T__0);
+ setState(52);
+ match(T__1);
+ setState(53);
+ expression(0);
+ setState(54);
+ match(T__2);
+ setState(55);
+ block();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ConditionalStatementContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public BlockContext block() {
+ return getRuleContext(BlockContext.class,0);
+ }
+ public ConditionalStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_conditionalStatement; }
+ }
+
+ public final ConditionalStatementContext conditionalStatement() throws RecognitionException {
+ ConditionalStatementContext _localctx = new ConditionalStatementContext(_ctx, getState());
+ enterRule(_localctx, 8, RULE_conditionalStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(57);
+ match(T__3);
+ setState(58);
+ match(T__1);
+ setState(59);
+ expression(0);
+ setState(60);
+ match(T__2);
+ setState(61);
+ block();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class BlockContext extends ParserRuleContext {
+ public List statementBlock() {
+ return getRuleContexts(StatementBlockContext.class);
+ }
+ public StatementBlockContext statementBlock(int i) {
+ return getRuleContext(StatementBlockContext.class,i);
+ }
+ public BlockContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_block; }
+ }
+
+ public final BlockContext block() throws RecognitionException {
+ BlockContext _localctx = new BlockContext(_ctx, getState());
+ enterRule(_localctx, 10, RULE_block);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(63);
+ match(T__4);
+ setState(67);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 536872082L) != 0)) {
+ {
+ {
+ setState(64);
+ statementBlock();
+ }
+ }
+ setState(69);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(70);
+ match(T__5);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class BreakStatementContext extends ParserRuleContext {
+ public BreakStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_breakStatement; }
+ }
+
+ public final BreakStatementContext breakStatement() throws RecognitionException {
+ BreakStatementContext _localctx = new BreakStatementContext(_ctx, getState());
+ enterRule(_localctx, 12, RULE_breakStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(72);
+ match(T__6);
+ setState(73);
+ match(T__7);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class InputStatementContext extends ParserRuleContext {
+ public InputStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_inputStatement; }
+ }
+
+ public final InputStatementContext inputStatement() throws RecognitionException {
+ InputStatementContext _localctx = new InputStatementContext(_ctx, getState());
+ enterRule(_localctx, 14, RULE_inputStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(75);
+ match(T__8);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class OutputStatementContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public OutputStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_outputStatement; }
+ }
+
+ public final OutputStatementContext outputStatement() throws RecognitionException {
+ OutputStatementContext _localctx = new OutputStatementContext(_ctx, getState());
+ enterRule(_localctx, 16, RULE_outputStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(77);
+ match(T__9);
+ setState(78);
+ expression(0);
+ setState(79);
+ match(T__7);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class VariableContext extends ParserRuleContext {
+ public TerminalNode ID() { return getToken(GPMiniParser.ID, 0); }
+ public VariableContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_variable; }
+ }
+
+ public final VariableContext variable() throws RecognitionException {
+ VariableContext _localctx = new VariableContext(_ctx, getState());
+ enterRule(_localctx, 18, RULE_variable);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(81);
+ match(ID);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class VariableStatementContext extends ParserRuleContext {
+ public VariableContext variable() {
+ return getRuleContext(VariableContext.class,0);
+ }
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public VariableStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_variableStatement; }
+ }
+
+ public final VariableStatementContext variableStatement() throws RecognitionException {
+ VariableStatementContext _localctx = new VariableStatementContext(_ctx, getState());
+ enterRule(_localctx, 20, RULE_variableStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(83);
+ variable();
+ setState(84);
+ match(T__10);
+ setState(85);
+ expression(0);
+ setState(86);
+ match(T__7);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ExpressionContext extends ParserRuleContext {
+ public List expression() {
+ return getRuleContexts(ExpressionContext.class);
+ }
+ public ExpressionContext expression(int i) {
+ return getRuleContext(ExpressionContext.class,i);
+ }
+ public ValueContext value() {
+ return getRuleContext(ValueContext.class,0);
+ }
+ public ExpressionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_expression; }
+ }
+
+ public final ExpressionContext expression() throws RecognitionException {
+ return expression(0);
+ }
+
+ private ExpressionContext expression(int _p) throws RecognitionException {
+ ParserRuleContext _parentctx = _ctx;
+ int _parentState = getState();
+ ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState);
+ ExpressionContext _prevctx = _localctx;
+ int _startState = 22;
+ enterRecursionRule(_localctx, 22, RULE_expression, _p);
+ int _la;
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(98);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
+ case 1:
+ {
+ setState(89);
+ match(T__1);
+ setState(90);
+ expression(0);
+ setState(91);
+ match(T__2);
+ }
+ break;
+ case 2:
+ {
+ setState(93);
+ match(T__24);
+ setState(94);
+ expression(3);
+ }
+ break;
+ case 3:
+ {
+ setState(95);
+ match(T__24);
+ setState(96);
+ value();
+ }
+ break;
+ case 4:
+ {
+ setState(97);
+ value();
+ }
+ break;
+ }
+ _ctx.stop = _input.LT(-1);
+ setState(111);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,6,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ if ( _parseListeners!=null ) triggerExitRuleEvent();
+ _prevctx = _localctx;
+ {
+ setState(109);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
+ case 1:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(100);
+ if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
+ setState(101);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 28672L) != 0)) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(102);
+ expression(8);
+ }
+ break;
+ case 2:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(103);
+ if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
+ setState(104);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 2064384L) != 0)) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(105);
+ expression(7);
+ }
+ break;
+ case 3:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(106);
+ if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)");
+ setState(107);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 31457280L) != 0)) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(108);
+ expression(6);
+ }
+ break;
+ }
+ }
+ }
+ setState(113);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,6,_ctx);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ unrollRecursionContexts(_parentctx);
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ValueContext extends ParserRuleContext {
+ public VariableContext variable() {
+ return getRuleContext(VariableContext.class,0);
+ }
+ public NumericValueContext numericValue() {
+ return getRuleContext(NumericValueContext.class,0);
+ }
+ public LogicValueContext logicValue() {
+ return getRuleContext(LogicValueContext.class,0);
+ }
+ public InputStatementContext inputStatement() {
+ return getRuleContext(InputStatementContext.class,0);
+ }
+ public ValueContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_value; }
+ }
+
+ public final ValueContext value() throws RecognitionException {
+ ValueContext _localctx = new ValueContext(_ctx, getState());
+ enterRule(_localctx, 24, RULE_value);
+ try {
+ setState(118);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case ID:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(114);
+ variable();
+ }
+ break;
+ case INT:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(115);
+ numericValue();
+ }
+ break;
+ case TRUE:
+ case FALSE:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(116);
+ logicValue();
+ }
+ break;
+ case T__8:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(117);
+ inputStatement();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class NumericValueContext extends ParserRuleContext {
+ public TerminalNode INT() { return getToken(GPMiniParser.INT, 0); }
+ public NumericValueContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_numericValue; }
+ }
+
+ public final NumericValueContext numericValue() throws RecognitionException {
+ NumericValueContext _localctx = new NumericValueContext(_ctx, getState());
+ enterRule(_localctx, 26, RULE_numericValue);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(120);
+ match(INT);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class LogicValueContext extends ParserRuleContext {
+ public TerminalNode TRUE() { return getToken(GPMiniParser.TRUE, 0); }
+ public TerminalNode FALSE() { return getToken(GPMiniParser.FALSE, 0); }
+ public LogicValueContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_logicValue; }
+ }
+
+ public final LogicValueContext logicValue() throws RecognitionException {
+ LogicValueContext _localctx = new LogicValueContext(_ctx, getState());
+ enterRule(_localctx, 28, RULE_logicValue);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(122);
+ _la = _input.LA(1);
+ if ( !(_la==TRUE || _la==FALSE) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
+ switch (ruleIndex) {
+ case 11:
+ return expression_sempred((ExpressionContext)_localctx, predIndex);
+ }
+ return true;
+ }
+ private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
+ switch (predIndex) {
+ case 0:
+ return precpred(_ctx, 7);
+ case 1:
+ return precpred(_ctx, 6);
+ case 2:
+ return precpred(_ctx, 5);
+ }
+ return true;
+ }
+
+ public static final String _serializedATN =
+ "\u0004\u0001\u001e}\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
+ "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+
+ "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002"+
+ "\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002"+
+ "\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0001\u0000\u0005\u0000"+
+ " \b\u0000\n\u0000\f\u0000#\t\u0000\u0001\u0000\u0001\u0000\u0001\u0001"+
+ "\u0001\u0001\u0001\u0001\u0001\u0001\u0003\u0001+\b\u0001\u0001\u0002"+
+ "\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0003\u00022\b\u0002"+
+ "\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003"+
+ "\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004"+
+ "\u0001\u0005\u0001\u0005\u0005\u0005B\b\u0005\n\u0005\f\u0005E\t\u0005"+
+ "\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007"+
+ "\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001"+
+ "\n\u0001\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"+
+ "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"+
+ "\u0003\u000bc\b\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"+
+ "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0005\u000b"+
+ "n\b\u000b\n\u000b\f\u000bq\t\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0003"+
+ "\fw\b\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0000\u0001"+
+ "\u0016\u000f\u0000\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014\u0016"+
+ "\u0018\u001a\u001c\u0000\u0004\u0001\u0000\f\u000e\u0001\u0000\u000f\u0014"+
+ "\u0001\u0000\u0015\u0018\u0001\u0000\u001a\u001b\u007f\u0000!\u0001\u0000"+
+ "\u0000\u0000\u0002*\u0001\u0000\u0000\u0000\u00041\u0001\u0000\u0000\u0000"+
+ "\u00063\u0001\u0000\u0000\u0000\b9\u0001\u0000\u0000\u0000\n?\u0001\u0000"+
+ "\u0000\u0000\fH\u0001\u0000\u0000\u0000\u000eK\u0001\u0000\u0000\u0000"+
+ "\u0010M\u0001\u0000\u0000\u0000\u0012Q\u0001\u0000\u0000\u0000\u0014S"+
+ "\u0001\u0000\u0000\u0000\u0016b\u0001\u0000\u0000\u0000\u0018v\u0001\u0000"+
+ "\u0000\u0000\u001ax\u0001\u0000\u0000\u0000\u001cz\u0001\u0000\u0000\u0000"+
+ "\u001e \u0003\u0002\u0001\u0000\u001f\u001e\u0001\u0000\u0000\u0000 #"+
+ "\u0001\u0000\u0000\u0000!\u001f\u0001\u0000\u0000\u0000!\"\u0001\u0000"+
+ "\u0000\u0000\"$\u0001\u0000\u0000\u0000#!\u0001\u0000\u0000\u0000$%\u0005"+
+ "\u0000\u0000\u0001%\u0001\u0001\u0000\u0000\u0000&+\u0003\u0006\u0003"+
+ "\u0000\'+\u0003\b\u0004\u0000(+\u0003\u0010\b\u0000)+\u0003\u0014\n\u0000"+
+ "*&\u0001\u0000\u0000\u0000*\'\u0001\u0000\u0000\u0000*(\u0001\u0000\u0000"+
+ "\u0000*)\u0001\u0000\u0000\u0000+\u0003\u0001\u0000\u0000\u0000,2\u0003"+
+ "\u0006\u0003\u0000-2\u0003\b\u0004\u0000.2\u0003\u0010\b\u0000/2\u0003"+
+ "\u0014\n\u000002\u0003\f\u0006\u00001,\u0001\u0000\u0000\u00001-\u0001"+
+ "\u0000\u0000\u00001.\u0001\u0000\u0000\u00001/\u0001\u0000\u0000\u0000"+
+ "10\u0001\u0000\u0000\u00002\u0005\u0001\u0000\u0000\u000034\u0005\u0001"+
+ "\u0000\u000045\u0005\u0002\u0000\u000056\u0003\u0016\u000b\u000067\u0005"+
+ "\u0003\u0000\u000078\u0003\n\u0005\u00008\u0007\u0001\u0000\u0000\u0000"+
+ "9:\u0005\u0004\u0000\u0000:;\u0005\u0002\u0000\u0000;<\u0003\u0016\u000b"+
+ "\u0000<=\u0005\u0003\u0000\u0000=>\u0003\n\u0005\u0000>\t\u0001\u0000"+
+ "\u0000\u0000?C\u0005\u0005\u0000\u0000@B\u0003\u0004\u0002\u0000A@\u0001"+
+ "\u0000\u0000\u0000BE\u0001\u0000\u0000\u0000CA\u0001\u0000\u0000\u0000"+
+ "CD\u0001\u0000\u0000\u0000DF\u0001\u0000\u0000\u0000EC\u0001\u0000\u0000"+
+ "\u0000FG\u0005\u0006\u0000\u0000G\u000b\u0001\u0000\u0000\u0000HI\u0005"+
+ "\u0007\u0000\u0000IJ\u0005\b\u0000\u0000J\r\u0001\u0000\u0000\u0000KL"+
+ "\u0005\t\u0000\u0000L\u000f\u0001\u0000\u0000\u0000MN\u0005\n\u0000\u0000"+
+ "NO\u0003\u0016\u000b\u0000OP\u0005\b\u0000\u0000P\u0011\u0001\u0000\u0000"+
+ "\u0000QR\u0005\u001d\u0000\u0000R\u0013\u0001\u0000\u0000\u0000ST\u0003"+
+ "\u0012\t\u0000TU\u0005\u000b\u0000\u0000UV\u0003\u0016\u000b\u0000VW\u0005"+
+ "\b\u0000\u0000W\u0015\u0001\u0000\u0000\u0000XY\u0006\u000b\uffff\uffff"+
+ "\u0000YZ\u0005\u0002\u0000\u0000Z[\u0003\u0016\u000b\u0000[\\\u0005\u0003"+
+ "\u0000\u0000\\c\u0001\u0000\u0000\u0000]^\u0005\u0019\u0000\u0000^c\u0003"+
+ "\u0016\u000b\u0003_`\u0005\u0019\u0000\u0000`c\u0003\u0018\f\u0000ac\u0003"+
+ "\u0018\f\u0000bX\u0001\u0000\u0000\u0000b]\u0001\u0000\u0000\u0000b_\u0001"+
+ "\u0000\u0000\u0000ba\u0001\u0000\u0000\u0000co\u0001\u0000\u0000\u0000"+
+ "de\n\u0007\u0000\u0000ef\u0007\u0000\u0000\u0000fn\u0003\u0016\u000b\b"+
+ "gh\n\u0006\u0000\u0000hi\u0007\u0001\u0000\u0000in\u0003\u0016\u000b\u0007"+
+ "jk\n\u0005\u0000\u0000kl\u0007\u0002\u0000\u0000ln\u0003\u0016\u000b\u0006"+
+ "md\u0001\u0000\u0000\u0000mg\u0001\u0000\u0000\u0000mj\u0001\u0000\u0000"+
+ "\u0000nq\u0001\u0000\u0000\u0000om\u0001\u0000\u0000\u0000op\u0001\u0000"+
+ "\u0000\u0000p\u0017\u0001\u0000\u0000\u0000qo\u0001\u0000\u0000\u0000"+
+ "rw\u0003\u0012\t\u0000sw\u0003\u001a\r\u0000tw\u0003\u001c\u000e\u0000"+
+ "uw\u0003\u000e\u0007\u0000vr\u0001\u0000\u0000\u0000vs\u0001\u0000\u0000"+
+ "\u0000vt\u0001\u0000\u0000\u0000vu\u0001\u0000\u0000\u0000w\u0019\u0001"+
+ "\u0000\u0000\u0000xy\u0005\u001c\u0000\u0000y\u001b\u0001\u0000\u0000"+
+ "\u0000z{\u0007\u0003\u0000\u0000{\u001d\u0001\u0000\u0000\u0000\b!*1C"+
+ "bmov";
+ public static final ATN _ATN =
+ new ATNDeserializer().deserialize(_serializedATN.toCharArray());
+ static {
+ _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
+ for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
+ _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
+ }
+ }
+}
\ No newline at end of file
diff --git a/antlr/GPMini.g4 b/antlr/GPMini.g4
new file mode 100644
index 0000000..7f70e4f
--- /dev/null
+++ b/antlr/GPMini.g4
@@ -0,0 +1,82 @@
+grammar GPMini;
+
+program: statement* EOF
+ ;
+
+statement
+ : loopStatement
+ | conditionalStatement
+ | outputStatement
+ | variableStatement
+ ;
+
+statementBlock
+ : loopStatement
+ | conditionalStatement
+ | outputStatement
+ | variableStatement
+ | breakStatement
+ ;
+
+loopStatement
+ : 'while' '(' expression ')' block
+ ;
+
+conditionalStatement
+ : 'if' '(' expression ')' block
+ ;
+
+block
+ : '{' statementBlock* '}'
+ ;
+
+breakStatement
+ : 'break' ';'
+ ;
+
+inputStatement
+ : 'input'
+ ;
+
+outputStatement
+ : 'output' expression ';'
+ ;
+
+variable
+ : ID
+ ;
+
+variableStatement
+ : variable '=' expression ';'
+ ;
+
+expression
+ : expression ( 'and' | 'or' | '^' ) expression
+ | expression ( '==' | '!=' | '<' | '<=' | '>' | '>=' ) expression
+ | expression ( '+' | '-' | '*' | '//' ) expression
+ | '(' expression ')'
+ | 'not' expression
+ | 'not' value
+ | value
+ ;
+
+value
+ : variable
+ | numericValue
+ | logicValue
+ | inputStatement
+ ;
+
+numericValue: INT;
+
+logicValue: TRUE | FALSE;
+
+TRUE: 'true';
+
+FALSE: 'false';
+
+INT: ('-')?[0-9]+;
+
+ID: 'var'[0-9]*;
+
+WS: [ \t\r\n]+ -> skip;
diff --git a/antlr/GPMini.interp b/antlr/GPMini.interp
new file mode 100644
index 0000000..4b7bb50
--- /dev/null
+++ b/antlr/GPMini.interp
@@ -0,0 +1,86 @@
+token literal names:
+null
+'while'
+'('
+')'
+'if'
+'{'
+'}'
+'break'
+';'
+'input'
+'output'
+'='
+'and'
+'or'
+'^'
+'=='
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'//'
+'not'
+'true'
+'false'
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+TRUE
+FALSE
+INT
+ID
+WS
+
+rule names:
+program
+statement
+statementBlock
+loopStatement
+conditionalStatement
+block
+breakStatement
+inputStatement
+outputStatement
+variable
+variableStatement
+expression
+value
+numericValue
+logicValue
+
+
+atn:
+[4, 1, 30, 125, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 5, 0, 32, 8, 0, 10, 0, 12, 0, 35, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 43, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 50, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 5, 5, 66, 8, 5, 10, 5, 12, 5, 69, 9, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 99, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 110, 8, 11, 10, 11, 12, 11, 113, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 119, 8, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 0, 1, 22, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 4, 1, 0, 12, 14, 1, 0, 15, 20, 1, 0, 21, 24, 1, 0, 26, 27, 127, 0, 33, 1, 0, 0, 0, 2, 42, 1, 0, 0, 0, 4, 49, 1, 0, 0, 0, 6, 51, 1, 0, 0, 0, 8, 57, 1, 0, 0, 0, 10, 63, 1, 0, 0, 0, 12, 72, 1, 0, 0, 0, 14, 75, 1, 0, 0, 0, 16, 77, 1, 0, 0, 0, 18, 81, 1, 0, 0, 0, 20, 83, 1, 0, 0, 0, 22, 98, 1, 0, 0, 0, 24, 118, 1, 0, 0, 0, 26, 120, 1, 0, 0, 0, 28, 122, 1, 0, 0, 0, 30, 32, 3, 2, 1, 0, 31, 30, 1, 0, 0, 0, 32, 35, 1, 0, 0, 0, 33, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 36, 1, 0, 0, 0, 35, 33, 1, 0, 0, 0, 36, 37, 5, 0, 0, 1, 37, 1, 1, 0, 0, 0, 38, 43, 3, 6, 3, 0, 39, 43, 3, 8, 4, 0, 40, 43, 3, 16, 8, 0, 41, 43, 3, 20, 10, 0, 42, 38, 1, 0, 0, 0, 42, 39, 1, 0, 0, 0, 42, 40, 1, 0, 0, 0, 42, 41, 1, 0, 0, 0, 43, 3, 1, 0, 0, 0, 44, 50, 3, 6, 3, 0, 45, 50, 3, 8, 4, 0, 46, 50, 3, 16, 8, 0, 47, 50, 3, 20, 10, 0, 48, 50, 3, 12, 6, 0, 49, 44, 1, 0, 0, 0, 49, 45, 1, 0, 0, 0, 49, 46, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 49, 48, 1, 0, 0, 0, 50, 5, 1, 0, 0, 0, 51, 52, 5, 1, 0, 0, 52, 53, 5, 2, 0, 0, 53, 54, 3, 22, 11, 0, 54, 55, 5, 3, 0, 0, 55, 56, 3, 10, 5, 0, 56, 7, 1, 0, 0, 0, 57, 58, 5, 4, 0, 0, 58, 59, 5, 2, 0, 0, 59, 60, 3, 22, 11, 0, 60, 61, 5, 3, 0, 0, 61, 62, 3, 10, 5, 0, 62, 9, 1, 0, 0, 0, 63, 67, 5, 5, 0, 0, 64, 66, 3, 4, 2, 0, 65, 64, 1, 0, 0, 0, 66, 69, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 70, 71, 5, 6, 0, 0, 71, 11, 1, 0, 0, 0, 72, 73, 5, 7, 0, 0, 73, 74, 5, 8, 0, 0, 74, 13, 1, 0, 0, 0, 75, 76, 5, 9, 0, 0, 76, 15, 1, 0, 0, 0, 77, 78, 5, 10, 0, 0, 78, 79, 3, 22, 11, 0, 79, 80, 5, 8, 0, 0, 80, 17, 1, 0, 0, 0, 81, 82, 5, 29, 0, 0, 82, 19, 1, 0, 0, 0, 83, 84, 3, 18, 9, 0, 84, 85, 5, 11, 0, 0, 85, 86, 3, 22, 11, 0, 86, 87, 5, 8, 0, 0, 87, 21, 1, 0, 0, 0, 88, 89, 6, 11, -1, 0, 89, 90, 5, 2, 0, 0, 90, 91, 3, 22, 11, 0, 91, 92, 5, 3, 0, 0, 92, 99, 1, 0, 0, 0, 93, 94, 5, 25, 0, 0, 94, 99, 3, 22, 11, 3, 95, 96, 5, 25, 0, 0, 96, 99, 3, 24, 12, 0, 97, 99, 3, 24, 12, 0, 98, 88, 1, 0, 0, 0, 98, 93, 1, 0, 0, 0, 98, 95, 1, 0, 0, 0, 98, 97, 1, 0, 0, 0, 99, 111, 1, 0, 0, 0, 100, 101, 10, 7, 0, 0, 101, 102, 7, 0, 0, 0, 102, 110, 3, 22, 11, 8, 103, 104, 10, 6, 0, 0, 104, 105, 7, 1, 0, 0, 105, 110, 3, 22, 11, 7, 106, 107, 10, 5, 0, 0, 107, 108, 7, 2, 0, 0, 108, 110, 3, 22, 11, 6, 109, 100, 1, 0, 0, 0, 109, 103, 1, 0, 0, 0, 109, 106, 1, 0, 0, 0, 110, 113, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 23, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 114, 119, 3, 18, 9, 0, 115, 119, 3, 26, 13, 0, 116, 119, 3, 28, 14, 0, 117, 119, 3, 14, 7, 0, 118, 114, 1, 0, 0, 0, 118, 115, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 118, 117, 1, 0, 0, 0, 119, 25, 1, 0, 0, 0, 120, 121, 5, 28, 0, 0, 121, 27, 1, 0, 0, 0, 122, 123, 7, 3, 0, 0, 123, 29, 1, 0, 0, 0, 8, 33, 42, 49, 67, 98, 109, 111, 118]
\ No newline at end of file
diff --git a/antlr/GPMini.tokens b/antlr/GPMini.tokens
new file mode 100644
index 0000000..95b7425
--- /dev/null
+++ b/antlr/GPMini.tokens
@@ -0,0 +1,57 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+T__6=7
+T__7=8
+T__8=9
+T__9=10
+T__10=11
+T__11=12
+T__12=13
+T__13=14
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+T__22=23
+T__23=24
+T__24=25
+TRUE=26
+FALSE=27
+INT=28
+ID=29
+WS=30
+'while'=1
+'('=2
+')'=3
+'if'=4
+'{'=5
+'}'=6
+'break'=7
+';'=8
+'input'=9
+'output'=10
+'='=11
+'and'=12
+'or'=13
+'^'=14
+'=='=15
+'!='=16
+'<'=17
+'<='=18
+'>'=19
+'>='=20
+'+'=21
+'-'=22
+'*'=23
+'//'=24
+'not'=25
+'true'=26
+'false'=27
diff --git a/antlr/GPMiniLexer.interp b/antlr/GPMiniLexer.interp
new file mode 100644
index 0000000..72baa0c
--- /dev/null
+++ b/antlr/GPMiniLexer.interp
@@ -0,0 +1,107 @@
+token literal names:
+null
+'while'
+'('
+')'
+'if'
+'{'
+'}'
+'break'
+';'
+'input'
+'output'
+'='
+'and'
+'or'
+'^'
+'=='
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'//'
+'not'
+'true'
+'false'
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+TRUE
+FALSE
+INT
+ID
+WS
+
+rule names:
+T__0
+T__1
+T__2
+T__3
+T__4
+T__5
+T__6
+T__7
+T__8
+T__9
+T__10
+T__11
+T__12
+T__13
+T__14
+T__15
+T__16
+T__17
+T__18
+T__19
+T__20
+T__21
+T__22
+T__23
+T__24
+TRUE
+FALSE
+INT
+ID
+WS
+
+channel names:
+DEFAULT_TOKEN_CHANNEL
+HIDDEN
+
+mode names:
+DEFAULT_MODE
+
+atn:
+[4, 0, 30, 175, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 3, 27, 152, 8, 27, 1, 27, 4, 27, 155, 8, 27, 11, 27, 12, 27, 156, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 164, 8, 28, 10, 28, 12, 28, 167, 9, 28, 1, 29, 4, 29, 170, 8, 29, 11, 29, 12, 29, 171, 1, 29, 1, 29, 0, 0, 30, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 1, 0, 2, 1, 0, 48, 57, 3, 0, 9, 10, 13, 13, 32, 32, 178, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 1, 61, 1, 0, 0, 0, 3, 67, 1, 0, 0, 0, 5, 69, 1, 0, 0, 0, 7, 71, 1, 0, 0, 0, 9, 74, 1, 0, 0, 0, 11, 76, 1, 0, 0, 0, 13, 78, 1, 0, 0, 0, 15, 84, 1, 0, 0, 0, 17, 86, 1, 0, 0, 0, 19, 92, 1, 0, 0, 0, 21, 99, 1, 0, 0, 0, 23, 101, 1, 0, 0, 0, 25, 105, 1, 0, 0, 0, 27, 108, 1, 0, 0, 0, 29, 110, 1, 0, 0, 0, 31, 113, 1, 0, 0, 0, 33, 116, 1, 0, 0, 0, 35, 118, 1, 0, 0, 0, 37, 121, 1, 0, 0, 0, 39, 123, 1, 0, 0, 0, 41, 126, 1, 0, 0, 0, 43, 128, 1, 0, 0, 0, 45, 130, 1, 0, 0, 0, 47, 132, 1, 0, 0, 0, 49, 135, 1, 0, 0, 0, 51, 139, 1, 0, 0, 0, 53, 144, 1, 0, 0, 0, 55, 151, 1, 0, 0, 0, 57, 158, 1, 0, 0, 0, 59, 169, 1, 0, 0, 0, 61, 62, 5, 119, 0, 0, 62, 63, 5, 104, 0, 0, 63, 64, 5, 105, 0, 0, 64, 65, 5, 108, 0, 0, 65, 66, 5, 101, 0, 0, 66, 2, 1, 0, 0, 0, 67, 68, 5, 40, 0, 0, 68, 4, 1, 0, 0, 0, 69, 70, 5, 41, 0, 0, 70, 6, 1, 0, 0, 0, 71, 72, 5, 105, 0, 0, 72, 73, 5, 102, 0, 0, 73, 8, 1, 0, 0, 0, 74, 75, 5, 123, 0, 0, 75, 10, 1, 0, 0, 0, 76, 77, 5, 125, 0, 0, 77, 12, 1, 0, 0, 0, 78, 79, 5, 98, 0, 0, 79, 80, 5, 114, 0, 0, 80, 81, 5, 101, 0, 0, 81, 82, 5, 97, 0, 0, 82, 83, 5, 107, 0, 0, 83, 14, 1, 0, 0, 0, 84, 85, 5, 59, 0, 0, 85, 16, 1, 0, 0, 0, 86, 87, 5, 105, 0, 0, 87, 88, 5, 110, 0, 0, 88, 89, 5, 112, 0, 0, 89, 90, 5, 117, 0, 0, 90, 91, 5, 116, 0, 0, 91, 18, 1, 0, 0, 0, 92, 93, 5, 111, 0, 0, 93, 94, 5, 117, 0, 0, 94, 95, 5, 116, 0, 0, 95, 96, 5, 112, 0, 0, 96, 97, 5, 117, 0, 0, 97, 98, 5, 116, 0, 0, 98, 20, 1, 0, 0, 0, 99, 100, 5, 61, 0, 0, 100, 22, 1, 0, 0, 0, 101, 102, 5, 97, 0, 0, 102, 103, 5, 110, 0, 0, 103, 104, 5, 100, 0, 0, 104, 24, 1, 0, 0, 0, 105, 106, 5, 111, 0, 0, 106, 107, 5, 114, 0, 0, 107, 26, 1, 0, 0, 0, 108, 109, 5, 94, 0, 0, 109, 28, 1, 0, 0, 0, 110, 111, 5, 61, 0, 0, 111, 112, 5, 61, 0, 0, 112, 30, 1, 0, 0, 0, 113, 114, 5, 33, 0, 0, 114, 115, 5, 61, 0, 0, 115, 32, 1, 0, 0, 0, 116, 117, 5, 60, 0, 0, 117, 34, 1, 0, 0, 0, 118, 119, 5, 60, 0, 0, 119, 120, 5, 61, 0, 0, 120, 36, 1, 0, 0, 0, 121, 122, 5, 62, 0, 0, 122, 38, 1, 0, 0, 0, 123, 124, 5, 62, 0, 0, 124, 125, 5, 61, 0, 0, 125, 40, 1, 0, 0, 0, 126, 127, 5, 43, 0, 0, 127, 42, 1, 0, 0, 0, 128, 129, 5, 45, 0, 0, 129, 44, 1, 0, 0, 0, 130, 131, 5, 42, 0, 0, 131, 46, 1, 0, 0, 0, 132, 133, 5, 47, 0, 0, 133, 134, 5, 47, 0, 0, 134, 48, 1, 0, 0, 0, 135, 136, 5, 110, 0, 0, 136, 137, 5, 111, 0, 0, 137, 138, 5, 116, 0, 0, 138, 50, 1, 0, 0, 0, 139, 140, 5, 116, 0, 0, 140, 141, 5, 114, 0, 0, 141, 142, 5, 117, 0, 0, 142, 143, 5, 101, 0, 0, 143, 52, 1, 0, 0, 0, 144, 145, 5, 102, 0, 0, 145, 146, 5, 97, 0, 0, 146, 147, 5, 108, 0, 0, 147, 148, 5, 115, 0, 0, 148, 149, 5, 101, 0, 0, 149, 54, 1, 0, 0, 0, 150, 152, 5, 45, 0, 0, 151, 150, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 154, 1, 0, 0, 0, 153, 155, 7, 0, 0, 0, 154, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 154, 1, 0, 0, 0, 156, 157, 1, 0, 0, 0, 157, 56, 1, 0, 0, 0, 158, 159, 5, 118, 0, 0, 159, 160, 5, 97, 0, 0, 160, 161, 5, 114, 0, 0, 161, 165, 1, 0, 0, 0, 162, 164, 7, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0, 165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 58, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 168, 170, 7, 1, 0, 0, 169, 168, 1, 0, 0, 0, 170, 171, 1, 0, 0, 0, 171, 169, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 174, 6, 29, 0, 0, 174, 60, 1, 0, 0, 0, 5, 0, 151, 156, 165, 171, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/antlr/GPMiniLexer.py b/antlr/GPMiniLexer.py
new file mode 100644
index 0000000..0e259f2
--- /dev/null
+++ b/antlr/GPMiniLexer.py
@@ -0,0 +1,139 @@
+# Generated from GPMini.g4 by ANTLR 4.13.1
+from antlr4 import *
+from io import StringIO
+import sys
+if sys.version_info[1] > 5:
+ from typing import TextIO
+else:
+ from typing.io import TextIO
+
+
+def serializedATN():
+ return [
+ 4,0,30,175,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,
+ 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,
+ 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,
+ 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,
+ 26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,1,0,1,0,1,0,1,0,1,0,1,0,1,
+ 1,1,1,1,2,1,2,1,3,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,
+ 6,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,
+ 10,1,10,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,13,1,13,1,14,1,14,1,
+ 14,1,15,1,15,1,15,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,19,1,19,1,
+ 19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,
+ 24,1,25,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,27,3,
+ 27,152,8,27,1,27,4,27,155,8,27,11,27,12,27,156,1,28,1,28,1,28,1,
+ 28,1,28,5,28,164,8,28,10,28,12,28,167,9,28,1,29,4,29,170,8,29,11,
+ 29,12,29,171,1,29,1,29,0,0,30,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,
+ 17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,
+ 39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,
+ 1,0,2,1,0,48,57,3,0,9,10,13,13,32,32,178,0,1,1,0,0,0,0,3,1,0,0,0,
+ 0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,
+ 15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,
+ 25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,
+ 35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,
+ 45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,
+ 55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,1,61,1,0,0,0,3,67,1,0,0,0,5,
+ 69,1,0,0,0,7,71,1,0,0,0,9,74,1,0,0,0,11,76,1,0,0,0,13,78,1,0,0,0,
+ 15,84,1,0,0,0,17,86,1,0,0,0,19,92,1,0,0,0,21,99,1,0,0,0,23,101,1,
+ 0,0,0,25,105,1,0,0,0,27,108,1,0,0,0,29,110,1,0,0,0,31,113,1,0,0,
+ 0,33,116,1,0,0,0,35,118,1,0,0,0,37,121,1,0,0,0,39,123,1,0,0,0,41,
+ 126,1,0,0,0,43,128,1,0,0,0,45,130,1,0,0,0,47,132,1,0,0,0,49,135,
+ 1,0,0,0,51,139,1,0,0,0,53,144,1,0,0,0,55,151,1,0,0,0,57,158,1,0,
+ 0,0,59,169,1,0,0,0,61,62,5,119,0,0,62,63,5,104,0,0,63,64,5,105,0,
+ 0,64,65,5,108,0,0,65,66,5,101,0,0,66,2,1,0,0,0,67,68,5,40,0,0,68,
+ 4,1,0,0,0,69,70,5,41,0,0,70,6,1,0,0,0,71,72,5,105,0,0,72,73,5,102,
+ 0,0,73,8,1,0,0,0,74,75,5,123,0,0,75,10,1,0,0,0,76,77,5,125,0,0,77,
+ 12,1,0,0,0,78,79,5,98,0,0,79,80,5,114,0,0,80,81,5,101,0,0,81,82,
+ 5,97,0,0,82,83,5,107,0,0,83,14,1,0,0,0,84,85,5,59,0,0,85,16,1,0,
+ 0,0,86,87,5,105,0,0,87,88,5,110,0,0,88,89,5,112,0,0,89,90,5,117,
+ 0,0,90,91,5,116,0,0,91,18,1,0,0,0,92,93,5,111,0,0,93,94,5,117,0,
+ 0,94,95,5,116,0,0,95,96,5,112,0,0,96,97,5,117,0,0,97,98,5,116,0,
+ 0,98,20,1,0,0,0,99,100,5,61,0,0,100,22,1,0,0,0,101,102,5,97,0,0,
+ 102,103,5,110,0,0,103,104,5,100,0,0,104,24,1,0,0,0,105,106,5,111,
+ 0,0,106,107,5,114,0,0,107,26,1,0,0,0,108,109,5,94,0,0,109,28,1,0,
+ 0,0,110,111,5,61,0,0,111,112,5,61,0,0,112,30,1,0,0,0,113,114,5,33,
+ 0,0,114,115,5,61,0,0,115,32,1,0,0,0,116,117,5,60,0,0,117,34,1,0,
+ 0,0,118,119,5,60,0,0,119,120,5,61,0,0,120,36,1,0,0,0,121,122,5,62,
+ 0,0,122,38,1,0,0,0,123,124,5,62,0,0,124,125,5,61,0,0,125,40,1,0,
+ 0,0,126,127,5,43,0,0,127,42,1,0,0,0,128,129,5,45,0,0,129,44,1,0,
+ 0,0,130,131,5,42,0,0,131,46,1,0,0,0,132,133,5,47,0,0,133,134,5,47,
+ 0,0,134,48,1,0,0,0,135,136,5,110,0,0,136,137,5,111,0,0,137,138,5,
+ 116,0,0,138,50,1,0,0,0,139,140,5,116,0,0,140,141,5,114,0,0,141,142,
+ 5,117,0,0,142,143,5,101,0,0,143,52,1,0,0,0,144,145,5,102,0,0,145,
+ 146,5,97,0,0,146,147,5,108,0,0,147,148,5,115,0,0,148,149,5,101,0,
+ 0,149,54,1,0,0,0,150,152,5,45,0,0,151,150,1,0,0,0,151,152,1,0,0,
+ 0,152,154,1,0,0,0,153,155,7,0,0,0,154,153,1,0,0,0,155,156,1,0,0,
+ 0,156,154,1,0,0,0,156,157,1,0,0,0,157,56,1,0,0,0,158,159,5,118,0,
+ 0,159,160,5,97,0,0,160,161,5,114,0,0,161,165,1,0,0,0,162,164,7,0,
+ 0,0,163,162,1,0,0,0,164,167,1,0,0,0,165,163,1,0,0,0,165,166,1,0,
+ 0,0,166,58,1,0,0,0,167,165,1,0,0,0,168,170,7,1,0,0,169,168,1,0,0,
+ 0,170,171,1,0,0,0,171,169,1,0,0,0,171,172,1,0,0,0,172,173,1,0,0,
+ 0,173,174,6,29,0,0,174,60,1,0,0,0,5,0,151,156,165,171,1,6,0,0
+ ]
+
+class GPMiniLexer(Lexer):
+
+ atn = ATNDeserializer().deserialize(serializedATN())
+
+ decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
+
+ T__0 = 1
+ T__1 = 2
+ T__2 = 3
+ T__3 = 4
+ T__4 = 5
+ T__5 = 6
+ T__6 = 7
+ T__7 = 8
+ T__8 = 9
+ T__9 = 10
+ T__10 = 11
+ T__11 = 12
+ T__12 = 13
+ T__13 = 14
+ T__14 = 15
+ T__15 = 16
+ T__16 = 17
+ T__17 = 18
+ T__18 = 19
+ T__19 = 20
+ T__20 = 21
+ T__21 = 22
+ T__22 = 23
+ T__23 = 24
+ T__24 = 25
+ TRUE = 26
+ FALSE = 27
+ INT = 28
+ ID = 29
+ WS = 30
+
+ channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
+
+ modeNames = [ "DEFAULT_MODE" ]
+
+ literalNames = [ "",
+ "'while'", "'('", "')'", "'if'", "'{'", "'}'", "'break'", "';'",
+ "'input'", "'output'", "'='", "'and'", "'or'", "'^'", "'=='",
+ "'!='", "'<'", "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'//'",
+ "'not'", "'true'", "'false'" ]
+
+ symbolicNames = [ "",
+ "TRUE", "FALSE", "INT", "ID", "WS" ]
+
+ ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
+ "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
+ "T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
+ "T__20", "T__21", "T__22", "T__23", "T__24", "TRUE", "FALSE",
+ "INT", "ID", "WS" ]
+
+ grammarFileName = "GPMini.g4"
+
+ def __init__(self, input=None, output:TextIO = sys.stdout):
+ super().__init__(input, output)
+ self.checkVersion("4.13.1")
+ self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
+ self._actions = None
+ self._predicates = None
+
+
diff --git a/antlr/GPMiniLexer.tokens b/antlr/GPMiniLexer.tokens
new file mode 100644
index 0000000..95b7425
--- /dev/null
+++ b/antlr/GPMiniLexer.tokens
@@ -0,0 +1,57 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+T__6=7
+T__7=8
+T__8=9
+T__9=10
+T__10=11
+T__11=12
+T__12=13
+T__13=14
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+T__22=23
+T__23=24
+T__24=25
+TRUE=26
+FALSE=27
+INT=28
+ID=29
+WS=30
+'while'=1
+'('=2
+')'=3
+'if'=4
+'{'=5
+'}'=6
+'break'=7
+';'=8
+'input'=9
+'output'=10
+'='=11
+'and'=12
+'or'=13
+'^'=14
+'=='=15
+'!='=16
+'<'=17
+'<='=18
+'>'=19
+'>='=20
+'+'=21
+'-'=22
+'*'=23
+'//'=24
+'not'=25
+'true'=26
+'false'=27
diff --git a/antlr/GPMiniListener.py b/antlr/GPMiniListener.py
new file mode 100644
index 0000000..f4daf46
--- /dev/null
+++ b/antlr/GPMiniListener.py
@@ -0,0 +1,147 @@
+# Generated from GPMini.g4 by ANTLR 4.13.1
+from antlr4 import *
+if "." in __name__:
+ from .GPMiniParser import GPMiniParser
+else:
+ from GPMiniParser import GPMiniParser
+
+# This class defines a complete listener for a parse tree produced by GPMiniParser.
+class GPMiniListener(ParseTreeListener):
+
+ # Enter a parse tree produced by GPMiniParser#program.
+ def enterProgram(self, ctx:GPMiniParser.ProgramContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#program.
+ def exitProgram(self, ctx:GPMiniParser.ProgramContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#statement.
+ def enterStatement(self, ctx:GPMiniParser.StatementContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#statement.
+ def exitStatement(self, ctx:GPMiniParser.StatementContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#statementBlock.
+ def enterStatementBlock(self, ctx:GPMiniParser.StatementBlockContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#statementBlock.
+ def exitStatementBlock(self, ctx:GPMiniParser.StatementBlockContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#loopStatement.
+ def enterLoopStatement(self, ctx:GPMiniParser.LoopStatementContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#loopStatement.
+ def exitLoopStatement(self, ctx:GPMiniParser.LoopStatementContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#conditionalStatement.
+ def enterConditionalStatement(self, ctx:GPMiniParser.ConditionalStatementContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#conditionalStatement.
+ def exitConditionalStatement(self, ctx:GPMiniParser.ConditionalStatementContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#block.
+ def enterBlock(self, ctx:GPMiniParser.BlockContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#block.
+ def exitBlock(self, ctx:GPMiniParser.BlockContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#breakStatement.
+ def enterBreakStatement(self, ctx:GPMiniParser.BreakStatementContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#breakStatement.
+ def exitBreakStatement(self, ctx:GPMiniParser.BreakStatementContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#inputStatement.
+ def enterInputStatement(self, ctx:GPMiniParser.InputStatementContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#inputStatement.
+ def exitInputStatement(self, ctx:GPMiniParser.InputStatementContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#outputStatement.
+ def enterOutputStatement(self, ctx:GPMiniParser.OutputStatementContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#outputStatement.
+ def exitOutputStatement(self, ctx:GPMiniParser.OutputStatementContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#variable.
+ def enterVariable(self, ctx:GPMiniParser.VariableContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#variable.
+ def exitVariable(self, ctx:GPMiniParser.VariableContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#variableStatement.
+ def enterVariableStatement(self, ctx:GPMiniParser.VariableStatementContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#variableStatement.
+ def exitVariableStatement(self, ctx:GPMiniParser.VariableStatementContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#expression.
+ def enterExpression(self, ctx:GPMiniParser.ExpressionContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#expression.
+ def exitExpression(self, ctx:GPMiniParser.ExpressionContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#value.
+ def enterValue(self, ctx:GPMiniParser.ValueContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#value.
+ def exitValue(self, ctx:GPMiniParser.ValueContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#numericValue.
+ def enterNumericValue(self, ctx:GPMiniParser.NumericValueContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#numericValue.
+ def exitNumericValue(self, ctx:GPMiniParser.NumericValueContext):
+ pass
+
+
+ # Enter a parse tree produced by GPMiniParser#logicValue.
+ def enterLogicValue(self, ctx:GPMiniParser.LogicValueContext):
+ pass
+
+ # Exit a parse tree produced by GPMiniParser#logicValue.
+ def exitLogicValue(self, ctx:GPMiniParser.LogicValueContext):
+ pass
+
+
+
+del GPMiniParser
\ No newline at end of file
diff --git a/antlr/GPMiniParser.py b/antlr/GPMiniParser.py
new file mode 100644
index 0000000..4b337b8
--- /dev/null
+++ b/antlr/GPMiniParser.py
@@ -0,0 +1,1187 @@
+# Generated from GPMini.g4 by ANTLR 4.13.1
+# encoding: utf-8
+from antlr4 import *
+from io import StringIO
+import sys
+if sys.version_info[1] > 5:
+ from typing import TextIO
+else:
+ from typing.io import TextIO
+
+def serializedATN():
+ return [
+ 4,1,30,125,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
+ 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,
+ 2,14,7,14,1,0,5,0,32,8,0,10,0,12,0,35,9,0,1,0,1,0,1,1,1,1,1,1,1,
+ 1,3,1,43,8,1,1,2,1,2,1,2,1,2,1,2,3,2,50,8,2,1,3,1,3,1,3,1,3,1,3,
+ 1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,5,5,66,8,5,10,5,12,5,69,9,5,
+ 1,5,1,5,1,6,1,6,1,6,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,10,1,10,1,
+ 10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,
+ 11,99,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,5,11,110,
+ 8,11,10,11,12,11,113,9,11,1,12,1,12,1,12,1,12,3,12,119,8,12,1,13,
+ 1,13,1,14,1,14,1,14,0,1,22,15,0,2,4,6,8,10,12,14,16,18,20,22,24,
+ 26,28,0,4,1,0,12,14,1,0,15,20,1,0,21,24,1,0,26,27,127,0,33,1,0,0,
+ 0,2,42,1,0,0,0,4,49,1,0,0,0,6,51,1,0,0,0,8,57,1,0,0,0,10,63,1,0,
+ 0,0,12,72,1,0,0,0,14,75,1,0,0,0,16,77,1,0,0,0,18,81,1,0,0,0,20,83,
+ 1,0,0,0,22,98,1,0,0,0,24,118,1,0,0,0,26,120,1,0,0,0,28,122,1,0,0,
+ 0,30,32,3,2,1,0,31,30,1,0,0,0,32,35,1,0,0,0,33,31,1,0,0,0,33,34,
+ 1,0,0,0,34,36,1,0,0,0,35,33,1,0,0,0,36,37,5,0,0,1,37,1,1,0,0,0,38,
+ 43,3,6,3,0,39,43,3,8,4,0,40,43,3,16,8,0,41,43,3,20,10,0,42,38,1,
+ 0,0,0,42,39,1,0,0,0,42,40,1,0,0,0,42,41,1,0,0,0,43,3,1,0,0,0,44,
+ 50,3,6,3,0,45,50,3,8,4,0,46,50,3,16,8,0,47,50,3,20,10,0,48,50,3,
+ 12,6,0,49,44,1,0,0,0,49,45,1,0,0,0,49,46,1,0,0,0,49,47,1,0,0,0,49,
+ 48,1,0,0,0,50,5,1,0,0,0,51,52,5,1,0,0,52,53,5,2,0,0,53,54,3,22,11,
+ 0,54,55,5,3,0,0,55,56,3,10,5,0,56,7,1,0,0,0,57,58,5,4,0,0,58,59,
+ 5,2,0,0,59,60,3,22,11,0,60,61,5,3,0,0,61,62,3,10,5,0,62,9,1,0,0,
+ 0,63,67,5,5,0,0,64,66,3,4,2,0,65,64,1,0,0,0,66,69,1,0,0,0,67,65,
+ 1,0,0,0,67,68,1,0,0,0,68,70,1,0,0,0,69,67,1,0,0,0,70,71,5,6,0,0,
+ 71,11,1,0,0,0,72,73,5,7,0,0,73,74,5,8,0,0,74,13,1,0,0,0,75,76,5,
+ 9,0,0,76,15,1,0,0,0,77,78,5,10,0,0,78,79,3,22,11,0,79,80,5,8,0,0,
+ 80,17,1,0,0,0,81,82,5,29,0,0,82,19,1,0,0,0,83,84,3,18,9,0,84,85,
+ 5,11,0,0,85,86,3,22,11,0,86,87,5,8,0,0,87,21,1,0,0,0,88,89,6,11,
+ -1,0,89,90,5,2,0,0,90,91,3,22,11,0,91,92,5,3,0,0,92,99,1,0,0,0,93,
+ 94,5,25,0,0,94,99,3,22,11,3,95,96,5,25,0,0,96,99,3,24,12,0,97,99,
+ 3,24,12,0,98,88,1,0,0,0,98,93,1,0,0,0,98,95,1,0,0,0,98,97,1,0,0,
+ 0,99,111,1,0,0,0,100,101,10,7,0,0,101,102,7,0,0,0,102,110,3,22,11,
+ 8,103,104,10,6,0,0,104,105,7,1,0,0,105,110,3,22,11,7,106,107,10,
+ 5,0,0,107,108,7,2,0,0,108,110,3,22,11,6,109,100,1,0,0,0,109,103,
+ 1,0,0,0,109,106,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,
+ 1,0,0,0,112,23,1,0,0,0,113,111,1,0,0,0,114,119,3,18,9,0,115,119,
+ 3,26,13,0,116,119,3,28,14,0,117,119,3,14,7,0,118,114,1,0,0,0,118,
+ 115,1,0,0,0,118,116,1,0,0,0,118,117,1,0,0,0,119,25,1,0,0,0,120,121,
+ 5,28,0,0,121,27,1,0,0,0,122,123,7,3,0,0,123,29,1,0,0,0,8,33,42,49,
+ 67,98,109,111,118
+ ]
+
+class GPMiniParser ( Parser ):
+
+ grammarFileName = "GPMini.g4"
+
+ atn = ATNDeserializer().deserialize(serializedATN())
+
+ decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
+
+ sharedContextCache = PredictionContextCache()
+
+ literalNames = [ "", "'while'", "'('", "')'", "'if'", "'{'",
+ "'}'", "'break'", "';'", "'input'", "'output'", "'='",
+ "'and'", "'or'", "'^'", "'=='", "'!='", "'<'", "'<='",
+ "'>'", "'>='", "'+'", "'-'", "'*'", "'//'", "'not'",
+ "'true'", "'false'" ]
+
+ symbolicNames = [ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "TRUE", "FALSE", "INT",
+ "ID", "WS" ]
+
+ RULE_program = 0
+ RULE_statement = 1
+ RULE_statementBlock = 2
+ RULE_loopStatement = 3
+ RULE_conditionalStatement = 4
+ RULE_block = 5
+ RULE_breakStatement = 6
+ RULE_inputStatement = 7
+ RULE_outputStatement = 8
+ RULE_variable = 9
+ RULE_variableStatement = 10
+ RULE_expression = 11
+ RULE_value = 12
+ RULE_numericValue = 13
+ RULE_logicValue = 14
+
+ ruleNames = [ "program", "statement", "statementBlock", "loopStatement",
+ "conditionalStatement", "block", "breakStatement", "inputStatement",
+ "outputStatement", "variable", "variableStatement", "expression",
+ "value", "numericValue", "logicValue" ]
+
+ EOF = Token.EOF
+ T__0=1
+ T__1=2
+ T__2=3
+ T__3=4
+ T__4=5
+ T__5=6
+ T__6=7
+ T__7=8
+ T__8=9
+ T__9=10
+ T__10=11
+ T__11=12
+ T__12=13
+ T__13=14
+ T__14=15
+ T__15=16
+ T__16=17
+ T__17=18
+ T__18=19
+ T__19=20
+ T__20=21
+ T__21=22
+ T__22=23
+ T__23=24
+ T__24=25
+ TRUE=26
+ FALSE=27
+ INT=28
+ ID=29
+ WS=30
+
+ def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
+ super().__init__(input, output)
+ self.checkVersion("4.13.1")
+ self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
+ self._predicates = None
+
+
+
+
+ class ProgramContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def EOF(self):
+ return self.getToken(GPMiniParser.EOF, 0)
+
+ def statement(self, i:int=None):
+ if i is None:
+ return self.getTypedRuleContexts(GPMiniParser.StatementContext)
+ else:
+ return self.getTypedRuleContext(GPMiniParser.StatementContext,i)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_program
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterProgram" ):
+ listener.enterProgram(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitProgram" ):
+ listener.exitProgram(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitProgram" ):
+ return visitor.visitProgram(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def program(self):
+
+ localctx = GPMiniParser.ProgramContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 0, self.RULE_program)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 33
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & 536871954) != 0):
+ self.state = 30
+ self.statement()
+ self.state = 35
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 36
+ self.match(GPMiniParser.EOF)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class StatementContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def loopStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.LoopStatementContext,0)
+
+
+ def conditionalStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.ConditionalStatementContext,0)
+
+
+ def outputStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.OutputStatementContext,0)
+
+
+ def variableStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.VariableStatementContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_statement
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterStatement" ):
+ listener.enterStatement(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitStatement" ):
+ listener.exitStatement(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitStatement" ):
+ return visitor.visitStatement(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def statement(self):
+
+ localctx = GPMiniParser.StatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 2, self.RULE_statement)
+ try:
+ self.state = 42
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [1]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 38
+ self.loopStatement()
+ pass
+ elif token in [4]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 39
+ self.conditionalStatement()
+ pass
+ elif token in [10]:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 40
+ self.outputStatement()
+ pass
+ elif token in [29]:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 41
+ self.variableStatement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class StatementBlockContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def loopStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.LoopStatementContext,0)
+
+
+ def conditionalStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.ConditionalStatementContext,0)
+
+
+ def outputStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.OutputStatementContext,0)
+
+
+ def variableStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.VariableStatementContext,0)
+
+
+ def breakStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.BreakStatementContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_statementBlock
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterStatementBlock" ):
+ listener.enterStatementBlock(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitStatementBlock" ):
+ listener.exitStatementBlock(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitStatementBlock" ):
+ return visitor.visitStatementBlock(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def statementBlock(self):
+
+ localctx = GPMiniParser.StatementBlockContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 4, self.RULE_statementBlock)
+ try:
+ self.state = 49
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [1]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 44
+ self.loopStatement()
+ pass
+ elif token in [4]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 45
+ self.conditionalStatement()
+ pass
+ elif token in [10]:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 46
+ self.outputStatement()
+ pass
+ elif token in [29]:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 47
+ self.variableStatement()
+ pass
+ elif token in [7]:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 48
+ self.breakStatement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class LoopStatementContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def expression(self):
+ return self.getTypedRuleContext(GPMiniParser.ExpressionContext,0)
+
+
+ def block(self):
+ return self.getTypedRuleContext(GPMiniParser.BlockContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_loopStatement
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterLoopStatement" ):
+ listener.enterLoopStatement(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitLoopStatement" ):
+ listener.exitLoopStatement(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitLoopStatement" ):
+ return visitor.visitLoopStatement(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def loopStatement(self):
+
+ localctx = GPMiniParser.LoopStatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 6, self.RULE_loopStatement)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 51
+ self.match(GPMiniParser.T__0)
+ self.state = 52
+ self.match(GPMiniParser.T__1)
+ self.state = 53
+ self.expression(0)
+ self.state = 54
+ self.match(GPMiniParser.T__2)
+ self.state = 55
+ self.block()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class ConditionalStatementContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def expression(self):
+ return self.getTypedRuleContext(GPMiniParser.ExpressionContext,0)
+
+
+ def block(self):
+ return self.getTypedRuleContext(GPMiniParser.BlockContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_conditionalStatement
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterConditionalStatement" ):
+ listener.enterConditionalStatement(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitConditionalStatement" ):
+ listener.exitConditionalStatement(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitConditionalStatement" ):
+ return visitor.visitConditionalStatement(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def conditionalStatement(self):
+
+ localctx = GPMiniParser.ConditionalStatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 8, self.RULE_conditionalStatement)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 57
+ self.match(GPMiniParser.T__3)
+ self.state = 58
+ self.match(GPMiniParser.T__1)
+ self.state = 59
+ self.expression(0)
+ self.state = 60
+ self.match(GPMiniParser.T__2)
+ self.state = 61
+ self.block()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class BlockContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def statementBlock(self, i:int=None):
+ if i is None:
+ return self.getTypedRuleContexts(GPMiniParser.StatementBlockContext)
+ else:
+ return self.getTypedRuleContext(GPMiniParser.StatementBlockContext,i)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_block
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterBlock" ):
+ listener.enterBlock(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitBlock" ):
+ listener.exitBlock(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitBlock" ):
+ return visitor.visitBlock(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def block(self):
+
+ localctx = GPMiniParser.BlockContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 10, self.RULE_block)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 63
+ self.match(GPMiniParser.T__4)
+ self.state = 67
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & 536872082) != 0):
+ self.state = 64
+ self.statementBlock()
+ self.state = 69
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 70
+ self.match(GPMiniParser.T__5)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class BreakStatementContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_breakStatement
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterBreakStatement" ):
+ listener.enterBreakStatement(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitBreakStatement" ):
+ listener.exitBreakStatement(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitBreakStatement" ):
+ return visitor.visitBreakStatement(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def breakStatement(self):
+
+ localctx = GPMiniParser.BreakStatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 12, self.RULE_breakStatement)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 72
+ self.match(GPMiniParser.T__6)
+ self.state = 73
+ self.match(GPMiniParser.T__7)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class InputStatementContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_inputStatement
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterInputStatement" ):
+ listener.enterInputStatement(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitInputStatement" ):
+ listener.exitInputStatement(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitInputStatement" ):
+ return visitor.visitInputStatement(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def inputStatement(self):
+
+ localctx = GPMiniParser.InputStatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 14, self.RULE_inputStatement)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 75
+ self.match(GPMiniParser.T__8)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class OutputStatementContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def expression(self):
+ return self.getTypedRuleContext(GPMiniParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_outputStatement
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterOutputStatement" ):
+ listener.enterOutputStatement(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitOutputStatement" ):
+ listener.exitOutputStatement(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitOutputStatement" ):
+ return visitor.visitOutputStatement(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def outputStatement(self):
+
+ localctx = GPMiniParser.OutputStatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 16, self.RULE_outputStatement)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 77
+ self.match(GPMiniParser.T__9)
+ self.state = 78
+ self.expression(0)
+ self.state = 79
+ self.match(GPMiniParser.T__7)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class VariableContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def ID(self):
+ return self.getToken(GPMiniParser.ID, 0)
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_variable
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterVariable" ):
+ listener.enterVariable(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitVariable" ):
+ listener.exitVariable(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitVariable" ):
+ return visitor.visitVariable(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def variable(self):
+
+ localctx = GPMiniParser.VariableContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 18, self.RULE_variable)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 81
+ self.match(GPMiniParser.ID)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class VariableStatementContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def variable(self):
+ return self.getTypedRuleContext(GPMiniParser.VariableContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(GPMiniParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_variableStatement
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterVariableStatement" ):
+ listener.enterVariableStatement(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitVariableStatement" ):
+ listener.exitVariableStatement(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitVariableStatement" ):
+ return visitor.visitVariableStatement(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def variableStatement(self):
+
+ localctx = GPMiniParser.VariableStatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 20, self.RULE_variableStatement)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 83
+ self.variable()
+ self.state = 84
+ self.match(GPMiniParser.T__10)
+ self.state = 85
+ self.expression(0)
+ self.state = 86
+ self.match(GPMiniParser.T__7)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class ExpressionContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def expression(self, i:int=None):
+ if i is None:
+ return self.getTypedRuleContexts(GPMiniParser.ExpressionContext)
+ else:
+ return self.getTypedRuleContext(GPMiniParser.ExpressionContext,i)
+
+
+ def value(self):
+ return self.getTypedRuleContext(GPMiniParser.ValueContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_expression
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterExpression" ):
+ listener.enterExpression(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitExpression" ):
+ listener.exitExpression(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitExpression" ):
+ return visitor.visitExpression(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+ def expression(self, _p:int=0):
+ _parentctx = self._ctx
+ _parentState = self.state
+ localctx = GPMiniParser.ExpressionContext(self, self._ctx, _parentState)
+ _prevctx = localctx
+ _startState = 22
+ self.enterRecursionRule(localctx, 22, self.RULE_expression, _p)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 98
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
+ if la_ == 1:
+ self.state = 89
+ self.match(GPMiniParser.T__1)
+ self.state = 90
+ self.expression(0)
+ self.state = 91
+ self.match(GPMiniParser.T__2)
+ pass
+
+ elif la_ == 2:
+ self.state = 93
+ self.match(GPMiniParser.T__24)
+ self.state = 94
+ self.expression(3)
+ pass
+
+ elif la_ == 3:
+ self.state = 95
+ self.match(GPMiniParser.T__24)
+ self.state = 96
+ self.value()
+ pass
+
+ elif la_ == 4:
+ self.state = 97
+ self.value()
+ pass
+
+
+ self._ctx.stop = self._input.LT(-1)
+ self.state = 111
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,6,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ if self._parseListeners is not None:
+ self.triggerExitRuleEvent()
+ _prevctx = localctx
+ self.state = 109
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
+ if la_ == 1:
+ localctx = GPMiniParser.ExpressionContext(self, _parentctx, _parentState)
+ self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
+ self.state = 100
+ if not self.precpred(self._ctx, 7):
+ from antlr4.error.Errors import FailedPredicateException
+ raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
+ self.state = 101
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 28672) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 102
+ self.expression(8)
+ pass
+
+ elif la_ == 2:
+ localctx = GPMiniParser.ExpressionContext(self, _parentctx, _parentState)
+ self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
+ self.state = 103
+ if not self.precpred(self._ctx, 6):
+ from antlr4.error.Errors import FailedPredicateException
+ raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
+ self.state = 104
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 2064384) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 105
+ self.expression(7)
+ pass
+
+ elif la_ == 3:
+ localctx = GPMiniParser.ExpressionContext(self, _parentctx, _parentState)
+ self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
+ self.state = 106
+ if not self.precpred(self._ctx, 5):
+ from antlr4.error.Errors import FailedPredicateException
+ raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
+ self.state = 107
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 31457280) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 108
+ self.expression(6)
+ pass
+
+
+ self.state = 113
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,6,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.unrollRecursionContexts(_parentctx)
+ return localctx
+
+
+ class ValueContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def variable(self):
+ return self.getTypedRuleContext(GPMiniParser.VariableContext,0)
+
+
+ def numericValue(self):
+ return self.getTypedRuleContext(GPMiniParser.NumericValueContext,0)
+
+
+ def logicValue(self):
+ return self.getTypedRuleContext(GPMiniParser.LogicValueContext,0)
+
+
+ def inputStatement(self):
+ return self.getTypedRuleContext(GPMiniParser.InputStatementContext,0)
+
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_value
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterValue" ):
+ listener.enterValue(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitValue" ):
+ listener.exitValue(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitValue" ):
+ return visitor.visitValue(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def value(self):
+
+ localctx = GPMiniParser.ValueContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 24, self.RULE_value)
+ try:
+ self.state = 118
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [29]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 114
+ self.variable()
+ pass
+ elif token in [28]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 115
+ self.numericValue()
+ pass
+ elif token in [26, 27]:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 116
+ self.logicValue()
+ pass
+ elif token in [9]:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 117
+ self.inputStatement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class NumericValueContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def INT(self):
+ return self.getToken(GPMiniParser.INT, 0)
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_numericValue
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterNumericValue" ):
+ listener.enterNumericValue(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitNumericValue" ):
+ listener.exitNumericValue(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitNumericValue" ):
+ return visitor.visitNumericValue(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def numericValue(self):
+
+ localctx = GPMiniParser.NumericValueContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 26, self.RULE_numericValue)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 120
+ self.match(GPMiniParser.INT)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+ class LogicValueContext(ParserRuleContext):
+ __slots__ = 'parser'
+
+ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def TRUE(self):
+ return self.getToken(GPMiniParser.TRUE, 0)
+
+ def FALSE(self):
+ return self.getToken(GPMiniParser.FALSE, 0)
+
+ def getRuleIndex(self):
+ return GPMiniParser.RULE_logicValue
+
+ def enterRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "enterLogicValue" ):
+ listener.enterLogicValue(self)
+
+ def exitRule(self, listener:ParseTreeListener):
+ if hasattr( listener, "exitLogicValue" ):
+ listener.exitLogicValue(self)
+
+ def accept(self, visitor:ParseTreeVisitor):
+ if hasattr( visitor, "visitLogicValue" ):
+ return visitor.visitLogicValue(self)
+ else:
+ return visitor.visitChildren(self)
+
+
+
+
+ def logicValue(self):
+
+ localctx = GPMiniParser.LogicValueContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 28, self.RULE_logicValue)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 122
+ _la = self._input.LA(1)
+ if not(_la==26 or _la==27):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+
+ def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
+ if self._predicates == None:
+ self._predicates = dict()
+ self._predicates[11] = self.expression_sempred
+ pred = self._predicates.get(ruleIndex, None)
+ if pred is None:
+ raise Exception("No predicate with index:" + str(ruleIndex))
+ else:
+ return pred(localctx, predIndex)
+
+ def expression_sempred(self, localctx:ExpressionContext, predIndex:int):
+ if predIndex == 0:
+ return self.precpred(self._ctx, 7)
+
+
+ if predIndex == 1:
+ return self.precpred(self._ctx, 6)
+
+
+ if predIndex == 2:
+ return self.precpred(self._ctx, 5)
+
+
+
+
+
diff --git a/antlr/GPMiniVisitor.py b/antlr/GPMiniVisitor.py
new file mode 100644
index 0000000..e465766
--- /dev/null
+++ b/antlr/GPMiniVisitor.py
@@ -0,0 +1,88 @@
+# Generated from GPMini.g4 by ANTLR 4.13.1
+from antlr4 import *
+if "." in __name__:
+ from .GPMiniParser import GPMiniParser
+else:
+ from GPMiniParser import GPMiniParser
+
+# This class defines a complete generic visitor for a parse tree produced by GPMiniParser.
+
+class GPMiniVisitor(ParseTreeVisitor):
+
+ # Visit a parse tree produced by GPMiniParser#program.
+ def visitProgram(self, ctx:GPMiniParser.ProgramContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#statement.
+ def visitStatement(self, ctx:GPMiniParser.StatementContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#statementBlock.
+ def visitStatementBlock(self, ctx:GPMiniParser.StatementBlockContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#loopStatement.
+ def visitLoopStatement(self, ctx:GPMiniParser.LoopStatementContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#conditionalStatement.
+ def visitConditionalStatement(self, ctx:GPMiniParser.ConditionalStatementContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#block.
+ def visitBlock(self, ctx:GPMiniParser.BlockContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#breakStatement.
+ def visitBreakStatement(self, ctx:GPMiniParser.BreakStatementContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#inputStatement.
+ def visitInputStatement(self, ctx:GPMiniParser.InputStatementContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#outputStatement.
+ def visitOutputStatement(self, ctx:GPMiniParser.OutputStatementContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#variable.
+ def visitVariable(self, ctx:GPMiniParser.VariableContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#variableStatement.
+ def visitVariableStatement(self, ctx:GPMiniParser.VariableStatementContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#expression.
+ def visitExpression(self, ctx:GPMiniParser.ExpressionContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#value.
+ def visitValue(self, ctx:GPMiniParser.ValueContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#numericValue.
+ def visitNumericValue(self, ctx:GPMiniParser.NumericValueContext):
+ return self.visitChildren(ctx)
+
+
+ # Visit a parse tree produced by GPMiniParser#logicValue.
+ def visitLogicValue(self, ctx:GPMiniParser.LogicValueContext):
+ return self.visitChildren(ctx)
+
+
+
+del GPMiniParser
\ No newline at end of file
diff --git a/antlr/MyGPMiniVisitor.py b/antlr/MyGPMiniVisitor.py
new file mode 100644
index 0000000..13c62ac
--- /dev/null
+++ b/antlr/MyGPMiniVisitor.py
@@ -0,0 +1,212 @@
+# Generated from GPMini.g4 by ANTLR 4.13.1
+from antlr4 import *
+if "." in __name__:
+ from .GPMiniParser import GPMiniParser
+ from .GPMiniVisitor import GPMiniVisitor
+else:
+ from GPMiniParser import GPMiniParser
+ from GPMiniVisitor import GPMiniVisitor
+
+# This class defines a complete generic visitor for a parse tree produced by GPMiniParser.
+
+class MyGPMiniVisitor(GPMiniVisitor):
+ def __init__(self, counter, input):
+ self.variableList = []
+ self.breakValue = []
+ self.counter = counter
+ self.input = input
+ self.inputIndex = 0
+ self.output = []
+
+ # Visit a parse tree produced by GPMiniParser#program.
+ def visitProgram(self, ctx:GPMiniParser.ProgramContext):
+ for s in ctx.statement():
+ if self.counter == 0:
+ return self.output
+ self.visitStatement(s)
+ return self.output
+
+
+ # Visit a parse tree produced by GPMiniParser#statement.
+ def visitStatement(self, ctx:GPMiniParser.StatementContext):
+ self.counter -= 1
+ next_child_rule_name = ctx.parser.ruleNames[ctx.getChild(0).getRuleIndex()]
+
+ match next_child_rule_name:
+ case 'loopStatement' :
+ self.visitLoopStatement(ctx.loopStatement())
+
+ case 'conditionalStatement' :
+ self.visitConditionalStatement(ctx.conditionalStatement())
+
+ case 'outputStatement' :
+ self.visitOutputStatement(ctx.outputStatement())
+
+ case 'variableStatement':
+ self.visitVariableStatement(ctx.variableStatement())
+
+ case _:
+ return 'error'
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#statementBlock.
+ def visitStatementBlock(self, ctx:GPMiniParser.StatementBlockContext):
+ next_child_rule_name = ctx.parser.ruleNames[ctx.getChild(0).getRuleIndex()]
+ self.counter -= 1
+
+ match next_child_rule_name:
+ case 'loopStatement' :
+ self.visitLoopStatement(ctx.loopStatement())
+
+ case 'conditionalStatement' :
+ self.visitConditionalStatement(ctx.conditionalStatement())
+
+ case 'outputStatement' :
+ self.visitOutputStatement(ctx.outputStatement())
+
+ case 'variableStatement':
+ self.visitVariableStatement(ctx.variableStatement())
+
+ case 'breakStatement':
+ self.visitBreakStatement(ctx.breakStatement())
+
+ case _:
+ return 'error'
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#loopStatement.
+ def visitLoopStatement(self, ctx:GPMiniParser.LoopStatementContext):
+ self.breakValue.append(False)
+ while self.value_eval(ctx.expression().getText(), self.visitExpression(ctx.expression())) and not self.breakValue[-1]:
+ if self.counter == 0:
+ return
+ self.visitBlock(ctx.block())
+ self.breakValue.pop()
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#conditionalStatement.
+ def visitConditionalStatement(self, ctx:GPMiniParser.ConditionalStatementContext):
+ if self.value_eval(ctx.expression().getText(), self.visitExpression(ctx.expression())):
+ self.visitBlock(ctx.getChild(4))
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#block.
+ def visitBlock(self, ctx:GPMiniParser.BlockContext):
+ self.counter -= 1
+ for s in ctx.statementBlock():
+ if self.counter == 0:
+ return
+ self.visitStatementBlock(s)
+
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#breakStatement.
+ def visitBreakStatement(self, ctx:GPMiniParser.BreakStatementContext):
+ self.breakValue[-1] = True
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#inputStatement.
+ def visitInputStatement(self, ctx:GPMiniParser.InputStatementContext):
+ if self.inputIndex < len(self.input):
+ self.inputIndex += 1
+ return self.input[self.inputIndex-1]
+ return 0
+
+
+ # Visit a parse tree produced by GPMiniParser#outputStatement.
+ def visitOutputStatement(self, ctx:GPMiniParser.OutputStatementContext):
+ output = self.value_eval(ctx.expression().getText(), self.visitExpression(ctx.expression()))
+ self.output.append(int(output))
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#variable.
+ def visitVariable(self, ctx:GPMiniParser.VariableContext):
+ variable_name = ctx.getText()
+ index = int(variable_name[3::])
+ if index < len(self.variableList):
+ return self.variableList[index]
+ else:
+ return 0
+
+
+ # Visit a parse tree produced by GPMiniParser#variableStatement.
+ def visitVariableStatement(self, ctx:GPMiniParser.VariableStatementContext):
+ index = int(ctx.variable().getText()[3::])
+ value = self.value_eval(ctx.expression().getText(), self.visitExpression(ctx.expression()))
+
+ if len(self.variableList) < index+1:
+ b = []
+ for i in range(index+1):
+ if len(self.variableList)>i:
+ b.append(self.variableList[i])
+ else:
+ b.append(0)
+ b[index] = value
+ self.variableList = b
+ else:
+ self.variableList[index]=value
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#expression.
+ def visitExpression(self, ctx:GPMiniParser.ExpressionContext):
+ if ctx.getChildCount() == 3:
+ if ctx.getChild(0).getText() == '(':
+ return f'({self.visitExpression(ctx.getChild(1))})'
+ else:
+ left = self.visitExpression(ctx.getChild(0))
+ right = self.visitExpression(ctx.getChild(2))
+ operator = ctx.getChild(1).getText()
+ return f'{left} {operator} {right}'
+ elif ctx.getChildCount() == 2:
+ operator = ctx.getChild(0).getText()
+ if operator == 'not':
+ return f'{operator} {self.visitExpression(ctx.getChild(1))}'
+ else:
+ return f'{operator} {self.visitValue(ctx.getChild(1))}'
+ else:
+ return f'{self.visitValue(ctx.getChild(0))}'
+
+
+ # Visit a parse tree produced by GPMiniParser#value.
+ def visitValue(self, ctx:GPMiniParser.ValueContext):
+ next_child_rule_name = ctx.parser.ruleNames[ctx.getChild(0).getRuleIndex()]
+
+ match next_child_rule_name:
+ case 'variable' :
+ return self.visitVariable(ctx.variable())
+ case 'numericValue' :
+ return self.visitNumericValue(ctx.numericValue())
+ case 'logicValue' :
+ return self.visitLogicValue(ctx.logicValue())
+ case 'inputStatement' :
+ return self.visitInputStatement(ctx.inputStatement())
+ case _:
+ return
+
+
+ # Visit a parse tree produced by GPMiniParser#numericValue.
+ def visitNumericValue(self, ctx:GPMiniParser.NumericValueContext):
+ return ctx.getText()
+
+
+ # Visit a parse tree produced by GPMiniParser#logicValue.
+ def visitLogicValue(self, ctx:GPMiniParser.LogicValueContext):
+ return True if ctx.getText() == 'true' else False
+
+ def value_eval(self, orginal, string):
+ try:
+ return eval(string)
+ except Exception as error:
+ self.output = ['ERROR', error, orginal, string]
+ self.counter = 0
+ return 0
+
+del GPMiniParser
\ No newline at end of file
diff --git a/config.py b/config.py
index 4bbd7a3..21b57e0 100644
--- a/config.py
+++ b/config.py
@@ -1,17 +1,23 @@
class Config:
def __init__(self):
+
+ self.data = 'data.txt'
+ self.heuristic = '1.1.B'
+
+ self.max_interpreter_steps = 100
+
self.min_inital_vars = 1
self.max_initial_vars = 4
- self.min_const_val = -100
- self.max_const_val = 100
+ self.min_const_val = -1000
+ self.max_const_val = 1000
self.min_blocks = 2
self.max_blocks = 5
self.max_blocks_depth = 2
- self.max_operations_depth = 4
- self.max_logic_depth = 4
+ self.max_operations_depth = 3
+ self.max_logic_depth = 3
# between 0 and 1
# 0 means no complexity
@@ -19,9 +25,9 @@ def __init__(self):
self.complexity_of_operations = 0.3
self.complexity_of_logic = 0.3
- self.population = 1
- self.generations = 0
- self.tournament_size = 3
+ self.population = 50
+ self.generations = 100
+ self.tournament_size = 20
self.not_prob = 30
self.evolution_prob = {
diff --git a/data.txt b/data.txt
new file mode 100644
index 0000000..8acb2a1
--- /dev/null
+++ b/data.txt
@@ -0,0 +1,3 @@
+1 2 3 4 5 : 9 8 7 6
+1 2 3 : 90 60
+7 7 7 : 4 4 4 4
\ No newline at end of file
diff --git a/evolution.py b/evolution.py
index fc5b8ed..a27aa1b 100644
--- a/evolution.py
+++ b/evolution.py
@@ -1,13 +1,13 @@
import random
-from config import Config
from utils import Utils
-from fitness import Fitness
+from gpParser import GpParser
-class Evolution(Utils, Fitness):
- def __init__(self, state, config=Config()):
- super().__init__(config)
+class Evolution(Utils):
+ def __init__(self, state, fitness, config):
self.state = state
-
+ self.fitness = fitness
+ self.config = config
+
def _mutation(self, parent_index):
parent_stack_copy = self.state.stack[parent_index][:]
parent_stack_length = len(parent_stack_copy)
@@ -104,15 +104,29 @@ def negative_tournament(self):
return worst_indiv_index
- def stats(self):
- fitness_avg = sum(self.state.fitness) / len(self.state.fitness)
+ def stats(self, g):
+ fitness_avg = -sum(self.state.fitness) / len(self.state.fitness)
best_fitness = max(self.state.fitness)
best_indiv_index = self.state.fitness.index(best_fitness)
best_indiv = self.state.stack[best_indiv_index]
- print(f"Generation {g} fitness avg: {fitness_avg}")
+ gpParser = GpParser(best_indiv)
+ indiv = gpParser.parse()
+ print(f"Generation: {g} \nAvg_fitness: {fitness_avg} \nBest_fitness: {-best_fitness} \nBest_individual: {indiv}\n")
+ def problem_solved(self):
+ best_indiv_index = self.state.fitness.index(0)
+ best_indiv = self.state.stack[best_indiv_index]
+ gpParser = GpParser(best_indiv)
+ indiv = gpParser.parse()
+ print(f"\n\n\nFound solution: {indiv}\n\n")
+ return 1
+
def evolve(self):
for g in range(self.config.generations):
+ self.stats(g)
+ if max(self.state.fitness) == 0:
+ return self.problem_solved()
+
# print(f"Generation {g}")
for i in range(self.config.population):
evolution_type = self.get_random_evolution_type()
@@ -129,12 +143,13 @@ def evolve(self):
indiv_index = self._tournament()
new_indiv = self._mutation(indiv_index)
- new_fitness = self.fitness_function(new_indiv)
+ new_fitness = self.fitness.fitness_function(new_indiv)
# Get worst individual and replace it with new individual
offspring_index = self.negative_tournament()
self.state.replace_indiv(offspring_index, new_indiv, new_fitness)
- self.stats()
+
+
diff --git a/fitness.py b/fitness.py
index 515cedb..d299fb4 100644
--- a/fitness.py
+++ b/fitness.py
@@ -1,14 +1,49 @@
-import random
+from antlr4 import *
+from antlr.GPMiniLexer import GPMiniLexer
+from antlr.GPMiniListener import GPMiniListener
+from antlr.GPMiniParser import GPMiniParser
+from antlr.MyGPMiniVisitor import MyGPMiniVisitor
from gpParser import GpParser
+import math
class Fitness():
+ def __init__(self, heuristic, config):
+ self.heuristic = heuristic
+ self.config = config
+ self.input = []
+ self.output = []
+ self.prepare_data()
+
+ def prepare_data(self):
+ file = open(self.config.data, 'r')
+ data = file.read().split('\n')
+
+ for line in data:
+ line = line.split(':')
+ self.input.append(line[0].split())
+ self.output.append(line[1].split())
+
def fitness_function(self, indiv):
- random_number = random.randint(1, 100)
+ fitness = 0
+ output_generated = []
+
+ #parse
gpParser = GpParser(indiv)
result = gpParser.parse()
+ # result = 'var1 = -34;var4 = -53;var2 = input;var3 = -76;var4 = ((not false) >= true);output var2;var5 = input;if ((not ((not false) > (not false)))){output var4;}var6 = (-76 // var5);'
- # TODO run interpreter and heuristic
-
-
- print(result + "\n\n")
- return random_number
\ No newline at end of file
+ # interpreter
+ input_stream = InputStream(result)
+ lexer = GPMiniLexer(input_stream)
+ stream = CommonTokenStream(lexer)
+ parser = GPMiniParser(stream)
+ tree = parser.program()
+ for i in range(len(self.input)):
+ visitor = MyGPMiniVisitor(self.config.max_interpreter_steps, self.input[i])
+ output_generated = visitor.visitProgram(tree)
+ if 'ERROR' in output_generated:
+ fitness -= math.inf
+ else:
+ fitness += self.heuristic.rate(self.config.heuristic, self.input[i], self.output[i], output_generated)
+ # print(f"output_generated = {output_generated} \nfitness = {fitness}\n")
+ return fitness
\ No newline at end of file
diff --git a/gpParser.py b/gpParser.py
index 5fd7c1f..8d9dd35 100644
--- a/gpParser.py
+++ b/gpParser.py
@@ -214,11 +214,11 @@ def parse(self):
return self.result
-# read from output.txt
-with open('output.txt', 'r') as f:
- data = f.read()
-
-data = [elem.strip().replace("'", "") for elem in data.strip()[1:-1].split(',')]
-gpParser = GpParser(data)
-res = gpParser.parse()
-print("RES: ", res)
\ No newline at end of file
+# # read from output.txt
+# with open('output.txt', 'r') as f:
+# data = f.read()
+
+# data = [elem.strip().replace("'", "") for elem in data.strip()[1:-1].split(',')]
+# gpParser = GpParser(data)
+# res = gpParser.parse()
+# print("RES: ", res)
\ No newline at end of file
diff --git a/heuristic.py b/heuristic.py
new file mode 100644
index 0000000..9d931c8
--- /dev/null
+++ b/heuristic.py
@@ -0,0 +1,55 @@
+from heuristics.h1_1_A import h_1_1_A
+from heuristics.h1_1_B import h_1_1_B
+from heuristics.h1_1_C import h_1_1_C
+from heuristics.h1_1_D import h_1_1_D
+from heuristics.h1_1_E import h_1_1_E
+from heuristics.h1_1_F import h_1_1_F
+from heuristics.h1_2_A import h_1_2_A
+from heuristics.h1_2_B import h_1_2_B
+from heuristics.h1_2_C import h_1_2_C
+from heuristics.h1_2_D import h_1_2_D
+from heuristics.h1_2_E import h_1_2_E
+from heuristics.h1_3_A import h_1_3_A
+from heuristics.h1_3_B import h_1_3_B
+from heuristics.h1_4_A import h_1_4_A
+from heuristics.h1_4_B import h_1_4_B
+
+
+class Heuristic:
+ def __init__(self):
+ self.problem = 1
+
+ def rate(self, heuristic, input, output, output_generated):
+ match heuristic:
+ case '1.1.A':
+ return h_1_1_A(input, output, output_generated)
+ case '1.1.B':
+ return h_1_1_B(input, output, output_generated)
+ case '1.1.C':
+ return h_1_1_C(input, output, output_generated)
+ case '1.1.D':
+ return h_1_1_D(input, output, output_generated)
+ case '1.1.E':
+ return h_1_1_E(input, output, output_generated)
+ case '1.1.F':
+ return h_1_1_F(input, output, output_generated)
+ case '1.2.A':
+ return h_1_2_A(input, output, output_generated)
+ case '1.2.B':
+ return h_1_2_B(input, output, output_generated)
+ case '1.2.C':
+ return h_1_2_C(input, output, output_generated)
+ case '1.2.D':
+ return h_1_2_D(input, output, output_generated)
+ case '1.2.E':
+ return h_1_2_E(input, output, output_generated)
+ case '1.3.A':
+ return h_1_3_A(input, output, output_generated)
+ case '1.3.B':
+ return h_1_3_B(input, output, output_generated)
+ case '1.4.A':
+ return h_1_4_A(input, output, output_generated)
+ case '1.4.B':
+ return h_1_4_B(input, output, output_generated)
+ case _:
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_1_A.py b/heuristics/h1_1_A.py
new file mode 100644
index 0000000..6e100b3
--- /dev/null
+++ b/heuristics/h1_1_A.py
@@ -0,0 +1,12 @@
+'''
+ 1.1.A
+ Program powinien wygenerować na wyjściu
+ (na dowolnej pozycji w danych wyjściowych)
+ liczbę 1.
+ Poza liczbą 1 może też zwrócić inne liczby.
+'''
+def h_1_1_A(input, output, output_generated):
+ rate = 0
+ if 1 not in output_generated:
+ rate -= 100
+ return rate
\ No newline at end of file
diff --git a/heuristics/h1_1_B.py b/heuristics/h1_1_B.py
new file mode 100644
index 0000000..8b37247
--- /dev/null
+++ b/heuristics/h1_1_B.py
@@ -0,0 +1,13 @@
+'''
+ 1.1.B
+ Program powinien wygenerować na wyjściu
+ (na dowolnej pozycji w danych wyjściowych)
+ liczbę 789.
+ Poza liczbą 789 może też zwrócić inne liczby.
+'''
+
+def h_1_1_B(input, output, output_generated):
+ rate = 0
+ if 789 not in output_generated:
+ rate -= 100
+ return rate
\ No newline at end of file
diff --git a/heuristics/h1_1_C.py b/heuristics/h1_1_C.py
new file mode 100644
index 0000000..7e198c7
--- /dev/null
+++ b/heuristics/h1_1_C.py
@@ -0,0 +1,13 @@
+'''
+ 1.1.C
+ Program powinien wygenerować na wyjściu
+ (na dowolnej pozycji w danych wyjściowych)
+ liczbę 31415.
+ Poza liczbą 31415 może też zwrócić inne liczby.
+'''
+
+def h_1_1_C(input, output, output_generated):
+ rate = 0
+ if 31415 not in output_generated:
+ rate -= 100
+ return rate
\ No newline at end of file
diff --git a/heuristics/h1_1_D.py b/heuristics/h1_1_D.py
new file mode 100644
index 0000000..5f9e583
--- /dev/null
+++ b/heuristics/h1_1_D.py
@@ -0,0 +1,12 @@
+'''
+ 1.1.D
+ Program powinien wygenerować
+ na pierwszej pozycji na wyjściu liczbę 1.
+ Poza liczbą 1 może też zwrócić inne liczby.
+'''
+
+def h_1_1_D(input, output, output_generated):
+ rate = 0
+ if output_generated[0] != 1:
+ rate -= 100
+ return rate
\ No newline at end of file
diff --git a/heuristics/h1_1_E.py b/heuristics/h1_1_E.py
new file mode 100644
index 0000000..76edf22
--- /dev/null
+++ b/heuristics/h1_1_E.py
@@ -0,0 +1,12 @@
+'''
+ 1.1.E
+ Program powinien wygenerować
+ na pierwszej pozycji na wyjściu liczbę 789.
+ Poza liczbą 789 może też zwrócić inne liczby.
+'''
+
+def h_1_1_E(input, output, output_generated):
+ rate = 0
+ if output_generated[0] != 789:
+ rate -= 100
+ return rate
\ No newline at end of file
diff --git a/heuristics/h1_1_F.py b/heuristics/h1_1_F.py
new file mode 100644
index 0000000..56f8ed7
--- /dev/null
+++ b/heuristics/h1_1_F.py
@@ -0,0 +1,14 @@
+'''
+ 1.1.F
+ Program powinien wygenerować
+ na wyjściu liczbę jako jedyną liczbę 1.
+ Poza liczbą 1 NIE powinien nic więcej wygenerować.
+'''
+
+def h_1_1_F(input, output, output_generated):
+ rate = 0
+ if len(output_generated) != 1:
+ rate -= 1000
+ if output_generated[0] != 1:
+ rate -= 100
+ return rate
\ No newline at end of file
diff --git a/heuristics/h1_2_A.py b/heuristics/h1_2_A.py
new file mode 100644
index 0000000..42252b5
--- /dev/null
+++ b/heuristics/h1_2_A.py
@@ -0,0 +1,11 @@
+'''
+ 1.2.A
+ Program powinien odczytać
+ dwie pierwsze liczy z wejścia
+ i zwrócić na wyjściu (jedynie) ich sumę.
+ Na wejściu mogą być tylko
+ całkowite liczby dodatnie w zakresie [0,9]
+'''
+
+def h_1_2_A(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_2_B.py b/heuristics/h1_2_B.py
new file mode 100644
index 0000000..b9027a4
--- /dev/null
+++ b/heuristics/h1_2_B.py
@@ -0,0 +1,11 @@
+'''
+ 1.2.B
+ Program powinien odczytać
+ dwie pierwsze liczy z wejścia
+ i zwrócić na wyjściu (jedynie) ich sumę.
+ Na wejściu mogą być tylko
+ całkowite liczby w zakresie [-9,9]
+'''
+
+def h_1_2_B(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_2_C.py b/heuristics/h1_2_C.py
new file mode 100644
index 0000000..784e2aa
--- /dev/null
+++ b/heuristics/h1_2_C.py
@@ -0,0 +1,11 @@
+'''
+ 1.2.C
+ Program powinien odczytać
+ dwie pierwsze liczy z wejścia
+ i zwrócić na wyjściu (jedynie) ich sumę.
+ Na wejściu mogą być tylko
+ całkowite liczby dodatnie w zakresie [-9999,9999]
+'''
+
+def h_1_2_C(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_2_D.py b/heuristics/h1_2_D.py
new file mode 100644
index 0000000..a4b094b
--- /dev/null
+++ b/heuristics/h1_2_D.py
@@ -0,0 +1,11 @@
+'''
+ 1.2.D
+ Program powinien odczytać
+ dwie pierwsze liczy z wejścia
+ i zwrócić na wyjściu (jedynie) ich różnicę.
+ Na wejściu mogą być tylko
+ całkowite liczby dodatnie w zakresie [-9999,9999]
+'''
+
+def h_1_2_D(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_2_E.py b/heuristics/h1_2_E.py
new file mode 100644
index 0000000..7c92157
--- /dev/null
+++ b/heuristics/h1_2_E.py
@@ -0,0 +1,11 @@
+'''
+ 1.2.E
+ Program powinien odczytać
+ dwie pierwsze liczy z wejścia
+ i zwrócić na wyjściu (jedynie) ich iloczyn.
+ Na wejściu mogą być tylko
+ całkowite liczby dodatnie w zakresie [-9999,9999]
+'''
+
+def h_1_2_E(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_3_A.py b/heuristics/h1_3_A.py
new file mode 100644
index 0000000..47bd1f1
--- /dev/null
+++ b/heuristics/h1_3_A.py
@@ -0,0 +1,11 @@
+'''
+ 1.3.A
+ Program powinien odczytać
+ dwie pierwsze liczy z wejścia
+ i zwrócić na wyjściu (jedynie) większą z nich.
+ Na wejściu mogą być tylko
+ całkowite liczby dodatnie w zakresie [0,9]
+'''
+
+def h_1_3_A(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_3_B.py b/heuristics/h1_3_B.py
new file mode 100644
index 0000000..da0267c
--- /dev/null
+++ b/heuristics/h1_3_B.py
@@ -0,0 +1,11 @@
+'''
+ 1.3.B
+ Program powinien odczytać
+ dwie pierwsze liczy z wejścia
+ i zwrócić na wyjściu (jedynie) większą z nich.
+ Na wejściu mogą być tylko
+ całkowite liczby w zakresie [-9999,9999]
+'''
+
+def h_1_3_B(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_4_A.py b/heuristics/h1_4_A.py
new file mode 100644
index 0000000..6d04e79
--- /dev/null
+++ b/heuristics/h1_4_A.py
@@ -0,0 +1,13 @@
+'''
+ 1.4.A
+ Program powinien odczytać
+ dziesięć pierwszych liczy z wejścia
+ i zwrócić na wyjściu (jedynie) ich
+ średnią arytmetyczną
+ (zaokrągloną do pełnej liczby całkowitej).
+ Na wejściu mogą być tylko
+ całkowite liczby w zakresie [-99,99]
+'''
+
+def h_1_4_A(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/heuristics/h1_4_B.py b/heuristics/h1_4_B.py
new file mode 100644
index 0000000..b9d3653
--- /dev/null
+++ b/heuristics/h1_4_B.py
@@ -0,0 +1,20 @@
+'''
+ 1.4.B
+ Program powinien odczytać na początek
+ z wejścia pierwszą liczbę
+ (ma być to wartość nieujemna)
+ a następnie tyle liczb (całkowitych)
+ jaka jest wartość pierwszej odczytanej liczby
+ i zwrócić na wyjściu (jedynie) ich
+ średnią arytmetyczną zaokrągloną
+ do pełnej liczby całkowitej
+ (do średniej nie jest wliczana
+ pierwsza odczytana liczba, która
+ mówi z ilu liczb chcemy obliczyć średnią).
+ Na wejściu mogą być tylko całkowite liczby
+ w zakresie [-99,99], pierwsza liczba może być
+ tylko w zakresie [0,99].
+'''
+
+def h_1_4_B(input, output, output_generated):
+ return 0
\ No newline at end of file
diff --git a/main.py b/main.py
index f36ef92..753df7a 100644
--- a/main.py
+++ b/main.py
@@ -3,19 +3,18 @@
from state import State
from treeFactory import TreeFactory
from evolution import Evolution
+from fitness import Fitness
+from heuristic import Heuristic
import timeit
class TinyGPGenerator:
- def __init__(self, config=Config(), state=State(), tree_factory=TreeFactory):
- self.config = config
- self.state = state
- self.tree_factory = tree_factory(self.state)
-
- def write_to_file(self):
- with open('output.txt', 'w') as f:
- for indiv_stack in self.state.stack:
- f.write(str(indiv_stack))
- f.write('\n\n')
+ def __init__(self, tree_factory=TreeFactory):
+ self.config = Config()
+ self.state = State(self.config)
+ self.heuristic = Heuristic()
+ self.fitness = Fitness(self.heuristic, self.config)
+ self.tree_factory = TreeFactory(self.state, self.fitness, self.config)
+ self.evolution = Evolution(self.state, self.fitness, self.config)
def run(self):
self.config.assert_probabilities()
@@ -26,10 +25,14 @@ def run(self):
end_time = timeit.default_timer()
print(f"Time to generate population: {end_time - start_time}")
- evolution = Evolution(self.state)
- evolution.evolve()
+ v = self.evolution.evolve()
- self.write_to_file()
+ self.end(v)
+
+ def end(self, v):
+ print('PROBLEM NOT SOLVED') if v != 1 else print('PROBLEM SOLVED')
+ print('END')
+ pass
if __name__ == "__main__":
diff --git a/output.txt b/output.txt
index d156722..c9f4ed1 100644
--- a/output.txt
+++ b/output.txt
@@ -1,2 +1,22 @@
-['=', 'var0', '-49', 'output', 'var0', 'if', '<=', 'true', '-75', '{', '=', 'var0', 'var0', '=', 'var1', 'input', 'output', 'var1', '}', 'if', 'not', '>=', 'not', 'input', 'false', '{', 'output', 'var0', 'output', 'var1', '}']
-
+var0 = (not ((not ((not var1) > (not -81))) or (-86 >= false)));
+output var0;
+if ((true <= -75)){
+ var0 = var0;
+ var1 = input;
+ output var1;}
+ if ((not ((not input) >= false))){
+ output var0;
+ output var1;
+ }
+var0 = input;
+var1 = 64;
+output var0;
+if ((not ((not ((not var1) > (not -81))) or (-86 >= false)))){
+ output var1;
+}
+if ((true < input)){
+ output var1;
+ output var0;
+ output var0;
+ }
+var2 = input;
\ No newline at end of file
diff --git a/state.py b/state.py
index 18e3e80..e586c5a 100644
--- a/state.py
+++ b/state.py
@@ -1,12 +1,11 @@
import random
-from config import Config
class State:
- def __init__(self, config=Config()):
+ def __init__(self, config):
+ self.config = config
self.current_indiv_index = None
self.variables = []
self.stack = []
- self.config = config
self.fitness = []
diff --git a/treeFactory.py b/treeFactory.py
index 884bf1f..4234df3 100644
--- a/treeFactory.py
+++ b/treeFactory.py
@@ -1,12 +1,11 @@
import random
-from config import Config
from utils import Utils
-from fitness import Fitness
-class TreeFactory(Utils, Fitness):
- def __init__(self, state, config=Config()):
- super().__init__(config)
+class TreeFactory(Utils):
+ def __init__(self, state, fitness, config):
self.state = state
+ self.fitness = fitness
+ self.config = config
def denial_expression_with_probability(self):
if self.add_not():
@@ -150,6 +149,6 @@ def generate_population(self):
self.state.init_new_indiv_state()
self._generate_initial_variables()
self._generate_block()
- fitness = self.fitness_function(self.state.get_indiv_stack(i))
+ fitness = self.fitness.fitness_function(self.state.get_indiv_stack(i))
self.state.set_cur_indiv_fitness(fitness)