diff --git a/docs/Diplomamunka_Szabo_Tamas.docx b/docs/Diplomamunka_Szabo_Tamas.docx
index 2d13dc0..af3c546 100644
Binary files a/docs/Diplomamunka_Szabo_Tamas.docx and b/docs/Diplomamunka_Szabo_Tamas.docx differ
diff --git a/docs/graphics/szintaxisfa.vsdx b/docs/graphics/szintaxisfa.vsdx
index 3e98366..98aed2e 100644
Binary files a/docs/graphics/szintaxisfa.vsdx and b/docs/graphics/szintaxisfa.vsdx differ
diff --git a/docs/graphics/~$$szintaxisfa.~vsdx b/docs/graphics/~$$szintaxisfa.~vsdx
deleted file mode 100644
index 9fe0af3..0000000
Binary files a/docs/graphics/~$$szintaxisfa.~vsdx and /dev/null differ
diff --git a/docs/~$akdolgozat_kovetelmenyek.docx b/docs/~$akdolgozat_kovetelmenyek.docx
deleted file mode 100644
index 0d2087e..0000000
Binary files a/docs/~$akdolgozat_kovetelmenyek.docx and /dev/null differ
diff --git a/grammar-imperative/Imperative.g4 b/grammar-imperative/Imperative.g4
index ea72299..549915b 100644
--- a/grammar-imperative/Imperative.g4
+++ b/grammar-imperative/Imperative.g4
@@ -1,15 +1,35 @@
grammar Imperative;
-init: (statement)+;
- //| functionDefinition
- //| macroDefinition)*;
-
- statement : skip
- | assignment
- | functionCall
- | ifStatement
- | loopStatement
- ;
+init: sequence
+ | functionDefinition
+ | procedureDefinition
+ ;
+ //| macroDefinition;
+
+functionDefinition : 'function' ID '(' formalParameters? ')' 'returns' ID 'begin'
+ sequence
+ 'endfunction'
+ ;
+
+procedureDefinition : 'procedure' ID '(' formalParameters? ')' 'begin'
+ sequence
+ 'endfunction'
+ ;
+
+formalParameters : (ID ':' ID) (',' (ID ':' ID))*
+ ;
+
+statement : skip
+ | assignment
+ | returnStatement
+ | functionCall
+ | ifStatement
+ | loopStatement
+ ;
+
+returnStatement : 'return' expression;
+
+sequence : statement+;
skip : 'skip'
;
@@ -17,10 +37,10 @@ skip : 'skip'
assignment : ID ':=' expression
;
-ifStatement : 'if' '(' expression ')' 'then' statement+ 'endif'
+ifStatement : 'if' '(' expression ')' 'then' sequence 'endif'
;
-loopStatement : 'loop' '(' expression ')' 'do' statement+ 'end' 'loop'
+loopStatement : 'loop' '(' expression ')' 'do' sequence 'endloop'
;
functionCall : ID '(' actualParameters ')'
diff --git a/grammar-imperative/example.txt b/grammar-imperative/example.txt
index 91868c7..2d04b8a 100644
--- a/grammar-imperative/example.txt
+++ b/grammar-imperative/example.txt
@@ -1,7 +1,15 @@
+function max(a: Integer, b: Integer) returns Integer
+begin
+ if (a > b) then
+ return a
+ endif
+ return b
+endfunction
+
print("Program futásának kezdete ...")
i := 0
loop (i < 10) do
print(toString(i) + " sor: ")
i := i + 1
-end loop
+endloop
print("Program futásának vége.")
\ No newline at end of file
diff --git a/grammar-imperative/src/Imperative.tokens b/grammar-imperative/src/Imperative.tokens
index 5e0d877..7878765 100644
--- a/grammar-imperative/src/Imperative.tokens
+++ b/grammar-imperative/src/Imperative.tokens
@@ -1,54 +1,68 @@
-T__23=1
-T__22=2
-T__21=3
-T__20=4
-NUMBER=27
-WHITESPACE=29
-ID=28
-T__9=15
-T__8=16
-T__7=17
-T__6=18
-T__5=19
-T__4=20
-T__19=5
-BOOLEAN=25
-T__16=8
-T__15=9
-T__18=6
-T__17=7
-T__12=12
-T__11=13
-T__14=10
-T__13=11
-T__1=23
-T__0=24
-T__10=14
-T__3=21
-T__2=22
-NEW_LINE=30
-STRING=26
-'end'=24
-'>='=23
-'skip'=22
-'=='=21
-'/'=20
-'then'=19
-':='=18
-'and'=17
-'>'=16
-'<='=15
-'!='=14
-'<'=13
-'if'=12
-'not'=10
-'('=11
-'-'=7
-'*'=8
-'or'=9
-'+'=6
-','=5
-'endif'=3
-')'=4
-'loop'=2
-'do'=1
+T__29=2
+T__28=3
+T__27=4
+T__26=5
+T__25=6
+T__24=7
+T__23=8
+T__22=9
+T__21=10
+T__20=11
+NUMBER=34
+WHITESPACE=36
+ID=35
+T__9=22
+T__8=23
+T__7=24
+T__6=25
+T__5=26
+T__4=27
+T__19=12
+T__30=1
+BOOLEAN=32
+T__16=15
+T__15=16
+T__18=13
+T__17=14
+T__12=19
+T__11=20
+T__14=17
+T__13=18
+T__1=30
+T__0=31
+T__3=28
+T__10=21
+T__2=29
+NEW_LINE=37
+STRING=33
+'>='=31
+'=='=30
+'returns'=29
+'/'=28
+'begin'=27
+'then'=26
+':='=25
+'>'=24
+'return'=23
+'+'=22
+'procedure'=21
+'function'=19
+')'=20
+'loop'=18
+'do'=17
+'endloop'=16
+'skip'=15
+'and'=14
+'<='=13
+'!='=12
+'<'=11
+'if'=10
+':'=9
+'('=8
+'not'=7
+'or'=6
+'endfunction'=5
+'-'=4
+'*'=3
+','=2
+'endif'=1
diff --git a/grammar-imperative/src/ImperativeBaseListener.class b/grammar-imperative/src/ImperativeBaseListener.class
index 0a5c2da..ffe76b2 100644
Binary files a/grammar-imperative/src/ImperativeBaseListener.class and b/grammar-imperative/src/ImperativeBaseListener.class differ
diff --git a/grammar-imperative/src/ImperativeBaseListener.java b/grammar-imperative/src/ImperativeBaseListener.java
index bd244d7..cc5583d 100644
--- a/grammar-imperative/src/ImperativeBaseListener.java
+++ b/grammar-imperative/src/ImperativeBaseListener.java
@@ -29,26 +29,91 @@ public class ImperativeBaseListener implements ImperativeListener {
*
* The default implementation does nothing.
*/
- @Override public void enterStatement(@NotNull ImperativeParser.StatementContext ctx) { }
+ @Override public void enterConstant(@NotNull ImperativeParser.ConstantContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitStatement(@NotNull ImperativeParser.StatementContext ctx) { }
+ @Override public void exitConstant(@NotNull ImperativeParser.ConstantContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void enterFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { }
+ @Override public void enterLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { }
+ @Override public void exitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterReturnStatement(@NotNull ImperativeParser.ReturnStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitReturnStatement(@NotNull ImperativeParser.ReturnStatementContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterInit(@NotNull ImperativeParser.InitContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitInit(@NotNull ImperativeParser.InitContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterSkip(@NotNull ImperativeParser.SkipContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitSkip(@NotNull ImperativeParser.SkipContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterIfStatement(@NotNull ImperativeParser.IfStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterStatement(@NotNull ImperativeParser.StatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitStatement(@NotNull ImperativeParser.StatementContext ctx) { }
/**
* {@inheritDoc}
@@ -68,78 +133,78 @@ public class ImperativeBaseListener implements ImperativeListener {
*
* The default implementation does nothing.
*/
- @Override public void enterConstant(@NotNull ImperativeParser.ConstantContext ctx) { }
+ @Override public void enterFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitConstant(@NotNull ImperativeParser.ConstantContext ctx) { }
+ @Override public void exitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void enterLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx) { }
+ @Override public void enterFunctionDefinition(@NotNull ImperativeParser.FunctionDefinitionContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx) { }
+ @Override public void exitFunctionDefinition(@NotNull ImperativeParser.FunctionDefinitionContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void enterInit(@NotNull ImperativeParser.InitContext ctx) { }
+ @Override public void enterFormalParameters(@NotNull ImperativeParser.FormalParametersContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitInit(@NotNull ImperativeParser.InitContext ctx) { }
+ @Override public void exitFormalParameters(@NotNull ImperativeParser.FormalParametersContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void enterSkip(@NotNull ImperativeParser.SkipContext ctx) { }
+ @Override public void enterSequence(@NotNull ImperativeParser.SequenceContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitSkip(@NotNull ImperativeParser.SkipContext ctx) { }
+ @Override public void exitSequence(@NotNull ImperativeParser.SequenceContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void enterActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx) { }
+ @Override public void enterProcedureDefinition(@NotNull ImperativeParser.ProcedureDefinitionContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx) { }
+ @Override public void exitProcedureDefinition(@NotNull ImperativeParser.ProcedureDefinitionContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void enterIfStatement(@NotNull ImperativeParser.IfStatementContext ctx) { }
+ @Override public void enterActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx) { }
+ @Override public void exitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx) { }
/**
* {@inheritDoc}
diff --git a/grammar-imperative/src/ImperativeBaseVisitor.class b/grammar-imperative/src/ImperativeBaseVisitor.class
index adb4c57..6be14be 100644
Binary files a/grammar-imperative/src/ImperativeBaseVisitor.class and b/grammar-imperative/src/ImperativeBaseVisitor.class differ
diff --git a/grammar-imperative/src/ImperativeBaseVisitor.java b/grammar-imperative/src/ImperativeBaseVisitor.java
index 336878d..d936892 100644
--- a/grammar-imperative/src/ImperativeBaseVisitor.java
+++ b/grammar-imperative/src/ImperativeBaseVisitor.java
@@ -25,7 +25,7 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitStatement(@NotNull ImperativeParser.StatementContext ctx) { return visitChildren(ctx); }
+ @Override public T visitConstant(@NotNull ImperativeParser.ConstantContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
@@ -33,7 +33,47 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { return visitChildren(ctx); }
+ @Override public T visitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitReturnStatement(@NotNull ImperativeParser.ReturnStatementContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitInit(@NotNull ImperativeParser.InitContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitSkip(@NotNull ImperativeParser.SkipContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitStatement(@NotNull ImperativeParser.StatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
@@ -49,7 +89,7 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitConstant(@NotNull ImperativeParser.ConstantContext ctx) { return visitChildren(ctx); }
+ @Override public T visitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
@@ -57,7 +97,7 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx) { return visitChildren(ctx); }
+ @Override public T visitFunctionDefinition(@NotNull ImperativeParser.FunctionDefinitionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
@@ -65,7 +105,7 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitInit(@NotNull ImperativeParser.InitContext ctx) { return visitChildren(ctx); }
+ @Override public T visitFormalParameters(@NotNull ImperativeParser.FormalParametersContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
@@ -73,7 +113,7 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitSkip(@NotNull ImperativeParser.SkipContext ctx) { return visitChildren(ctx); }
+ @Override public T visitSequence(@NotNull ImperativeParser.SequenceContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
@@ -81,7 +121,7 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx) { return visitChildren(ctx); }
+ @Override public T visitProcedureDefinition(@NotNull ImperativeParser.ProcedureDefinitionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
@@ -89,5 +129,5 @@ public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implem
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx) { return visitChildren(ctx); }
+ @Override public T visitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx) { return visitChildren(ctx); }
}
\ No newline at end of file
diff --git a/grammar-imperative/src/ImperativeLexer.class b/grammar-imperative/src/ImperativeLexer.class
index 019828f..a2e95b0 100644
Binary files a/grammar-imperative/src/ImperativeLexer.class and b/grammar-imperative/src/ImperativeLexer.class differ
diff --git a/grammar-imperative/src/ImperativeLexer.java b/grammar-imperative/src/ImperativeLexer.java
index 88474ee..5829742 100644
--- a/grammar-imperative/src/ImperativeLexer.java
+++ b/grammar-imperative/src/ImperativeLexer.java
@@ -14,26 +14,29 @@ public class ImperativeLexer extends Lexer {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
- T__23=1, T__22=2, T__21=3, T__20=4, T__19=5, T__18=6, T__17=7, T__16=8,
- T__15=9, T__14=10, T__13=11, T__12=12, T__11=13, T__10=14, T__9=15, T__8=16,
- T__7=17, T__6=18, T__5=19, T__4=20, T__3=21, T__2=22, T__1=23, T__0=24,
- BOOLEAN=25, STRING=26, NUMBER=27, ID=28, WHITESPACE=29, NEW_LINE=30;
+ T__30=1, T__29=2, T__28=3, T__27=4, T__26=5, T__25=6, T__24=7, T__23=8,
+ T__22=9, T__21=10, T__20=11, T__19=12, T__18=13, T__17=14, T__16=15, T__15=16,
+ T__14=17, T__13=18, T__12=19, T__11=20, T__10=21, T__9=22, T__8=23, T__7=24,
+ T__6=25, T__5=26, T__4=27, T__3=28, T__2=29, T__1=30, T__0=31, BOOLEAN=32,
+ STRING=33, NUMBER=34, ID=35, WHITESPACE=36, NEW_LINE=37;
public static String[] modeNames = {
"DEFAULT_MODE"
};
public static final String[] tokenNames = {
"",
- "'do'", "'loop'", "'endif'", "')'", "','", "'+'", "'-'", "'*'", "'or'",
- "'not'", "'('", "'if'", "'<'", "'!='", "'<='", "'>'", "'and'", "':='",
- "'then'", "'/'", "'=='", "'skip'", "'>='", "'end'", "BOOLEAN", "STRING",
- "NUMBER", "ID", "WHITESPACE", "NEW_LINE"
+ "'endif'", "','", "'*'", "'-'", "'endfunction'", "'or'", "'not'", "'('",
+ "':'", "'if'", "'<'", "'!='", "'<='", "'and'", "'skip'", "'endloop'",
+ "'do'", "'loop'", "'function'", "')'", "'procedure'", "'+'", "'return'",
+ "'>'", "':='", "'then'", "'begin'", "'/'", "'returns'", "'=='", "'>='",
+ "BOOLEAN", "STRING", "NUMBER", "ID", "WHITESPACE", "NEW_LINE"
};
public static final String[] ruleNames = {
- "T__23", "T__22", "T__21", "T__20", "T__19", "T__18", "T__17", "T__16",
- "T__15", "T__14", "T__13", "T__12", "T__11", "T__10", "T__9", "T__8",
- "T__7", "T__6", "T__5", "T__4", "T__3", "T__2", "T__1", "T__0", "BOOLEAN",
- "STRING", "NUMBER", "ID", "WHITESPACE", "NEW_LINE"
+ "T__30", "T__29", "T__28", "T__27", "T__26", "T__25", "T__24", "T__23",
+ "T__22", "T__21", "T__20", "T__19", "T__18", "T__17", "T__16", "T__15",
+ "T__14", "T__13", "T__12", "T__11", "T__10", "T__9", "T__8", "T__7", "T__6",
+ "T__5", "T__4", "T__3", "T__2", "T__1", "T__0", "BOOLEAN", "STRING", "NUMBER",
+ "ID", "WHITESPACE", "NEW_LINE"
};
@@ -60,9 +63,9 @@ public ImperativeLexer(CharStream input) {
@Override
public void action(RuleContext _localctx, int ruleIndex, int actionIndex) {
switch (ruleIndex) {
- case 28: WHITESPACE_action((RuleContext)_localctx, actionIndex); break;
+ case 35: WHITESPACE_action((RuleContext)_localctx, actionIndex); break;
- case 29: NEW_LINE_action((RuleContext)_localctx, actionIndex); break;
+ case 36: NEW_LINE_action((RuleContext)_localctx, actionIndex); break;
}
}
private void WHITESPACE_action(RuleContext _localctx, int actionIndex) {
@@ -77,67 +80,90 @@ private void NEW_LINE_action(RuleContext _localctx, int actionIndex) {
}
public static final String _serializedATN =
- "\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\2 \u00c5\b\1\4\2\t"+
+ "\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\2\'\u010d\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
- "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\3\2\3\2\3"+
- "\2\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7"+
- "\3\b\3\b\3\t\3\t\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\f\3\f\3\r\3\r\3\r\3"+
- "\16\3\16\3\17\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\22\3\22\3\22\3\22\3"+
- "\23\3\23\3\23\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3\26\3\27\3"+
- "\27\3\27\3\27\3\27\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3"+
- "\32\3\32\3\32\3\32\3\32\3\32\5\32\u0094\n\32\3\33\3\33\7\33\u0098\n\33"+
- "\f\33\16\33\u009b\13\33\3\33\3\33\3\34\6\34\u00a0\n\34\r\34\16\34\u00a1"+
- "\3\34\3\34\6\34\u00a6\n\34\r\34\16\34\u00a7\7\34\u00aa\n\34\f\34\16\34"+
- "\u00ad\13\34\3\35\5\35\u00b0\n\35\3\35\7\35\u00b3\n\35\f\35\16\35\u00b6"+
- "\13\35\3\36\6\36\u00b9\n\36\r\36\16\36\u00ba\3\36\3\36\3\37\5\37\u00c0"+
- "\n\37\3\37\3\37\3\37\3\37\3\u0099 \3\3\1\5\4\1\7\5\1\t\6\1\13\7\1\r\b"+
- "\1\17\t\1\21\n\1\23\13\1\25\f\1\27\r\1\31\16\1\33\17\1\35\20\1\37\21\1"+
- "!\22\1#\23\1%\24\1\'\25\1)\26\1+\27\1-\30\1/\31\1\61\32\1\63\33\1\65\34"+
- "\1\67\35\19\36\1;\37\2= \3\3\2\6\3\2\62;\5\2C\\aac|\6\2\62;C\\aac|\4\2"+
- "\13\13\"\"\u00cc\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13"+
- "\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2"+
- "\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2"+
- "!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3"+
- "\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2"+
- "\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\3?\3\2\2\2\5B\3\2\2\2\7G\3\2\2\2\tM"+
- "\3\2\2\2\13O\3\2\2\2\rQ\3\2\2\2\17S\3\2\2\2\21U\3\2\2\2\23W\3\2\2\2\25"+
- "Z\3\2\2\2\27^\3\2\2\2\31`\3\2\2\2\33c\3\2\2\2\35e\3\2\2\2\37h\3\2\2\2"+
- "!k\3\2\2\2#m\3\2\2\2%q\3\2\2\2\'t\3\2\2\2)y\3\2\2\2+{\3\2\2\2-~\3\2\2"+
- "\2/\u0083\3\2\2\2\61\u0086\3\2\2\2\63\u0093\3\2\2\2\65\u0095\3\2\2\2\67"+
- "\u009f\3\2\2\29\u00af\3\2\2\2;\u00b8\3\2\2\2=\u00bf\3\2\2\2?@\7f\2\2@"+
- "A\7q\2\2A\4\3\2\2\2BC\7n\2\2CD\7q\2\2DE\7q\2\2EF\7r\2\2F\6\3\2\2\2GH\7"+
- "g\2\2HI\7p\2\2IJ\7f\2\2JK\7k\2\2KL\7h\2\2L\b\3\2\2\2MN\7+\2\2N\n\3\2\2"+
- "\2OP\7.\2\2P\f\3\2\2\2QR\7-\2\2R\16\3\2\2\2ST\7/\2\2T\20\3\2\2\2UV\7,"+
- "\2\2V\22\3\2\2\2WX\7q\2\2XY\7t\2\2Y\24\3\2\2\2Z[\7p\2\2[\\\7q\2\2\\]\7"+
- "v\2\2]\26\3\2\2\2^_\7*\2\2_\30\3\2\2\2`a\7k\2\2ab\7h\2\2b\32\3\2\2\2c"+
- "d\7>\2\2d\34\3\2\2\2ef\7#\2\2fg\7?\2\2g\36\3\2\2\2hi\7>\2\2ij\7?\2\2j"+
- " \3\2\2\2kl\7@\2\2l\"\3\2\2\2mn\7c\2\2no\7p\2\2op\7f\2\2p$\3\2\2\2qr\7"+
- "<\2\2rs\7?\2\2s&\3\2\2\2tu\7v\2\2uv\7j\2\2vw\7g\2\2wx\7p\2\2x(\3\2\2\2"+
- "yz\7\61\2\2z*\3\2\2\2{|\7?\2\2|}\7?\2\2},\3\2\2\2~\177\7u\2\2\177\u0080"+
- "\7m\2\2\u0080\u0081\7k\2\2\u0081\u0082\7r\2\2\u0082.\3\2\2\2\u0083\u0084"+
- "\7@\2\2\u0084\u0085\7?\2\2\u0085\60\3\2\2\2\u0086\u0087\7g\2\2\u0087\u0088"+
- "\7p\2\2\u0088\u0089\7f\2\2\u0089\62\3\2\2\2\u008a\u008b\7h\2\2\u008b\u008c"+
- "\7c\2\2\u008c\u008d\7n\2\2\u008d\u008e\7u\2\2\u008e\u0094\7g\2\2\u008f"+
- "\u0090\7v\2\2\u0090\u0091\7t\2\2\u0091\u0092\7w\2\2\u0092\u0094\7g\2\2"+
- "\u0093\u008a\3\2\2\2\u0093\u008f\3\2\2\2\u0094\64\3\2\2\2\u0095\u0099"+
- "\7$\2\2\u0096\u0098\13\2\2\2\u0097\u0096\3\2\2\2\u0098\u009b\3\2\2\2\u0099"+
- "\u009a\3\2\2\2\u0099\u0097\3\2\2\2\u009a\u009c\3\2\2\2\u009b\u0099\3\2"+
- "\2\2\u009c\u009d\7$\2\2\u009d\66\3\2\2\2\u009e\u00a0\t\2\2\2\u009f\u009e"+
- "\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u009f\3\2\2\2\u00a1\u00a2\3\2\2\2\u00a2"+
- "\u00ab\3\2\2\2\u00a3\u00a5\7\60\2\2\u00a4\u00a6\t\2\2\2\u00a5\u00a4\3"+
- "\2\2\2\u00a6\u00a7\3\2\2\2\u00a7\u00a5\3\2\2\2\u00a7\u00a8\3\2\2\2\u00a8"+
- "\u00aa\3\2\2\2\u00a9\u00a3\3\2\2\2\u00aa\u00ad\3\2\2\2\u00ab\u00a9\3\2"+
- "\2\2\u00ab\u00ac\3\2\2\2\u00ac8\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ae\u00b0"+
- "\t\3\2\2\u00af\u00ae\3\2\2\2\u00b0\u00b4\3\2\2\2\u00b1\u00b3\t\4\2\2\u00b2"+
- "\u00b1\3\2\2\2\u00b3\u00b6\3\2\2\2\u00b4\u00b2\3\2\2\2\u00b4\u00b5\3\2"+
- "\2\2\u00b5:\3\2\2\2\u00b6\u00b4\3\2\2\2\u00b7\u00b9\t\5\2\2\u00b8\u00b7"+
- "\3\2\2\2\u00b9\u00ba\3\2\2\2\u00ba\u00b8\3\2\2\2\u00ba\u00bb\3\2\2\2\u00bb"+
- "\u00bc\3\2\2\2\u00bc\u00bd\b\36\2\2\u00bd<\3\2\2\2\u00be\u00c0\7\17\2"+
- "\2\u00bf\u00be\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\u00c1\3\2\2\2\u00c1\u00c2"+
- "\7\f\2\2\u00c2\u00c3\3\2\2\2\u00c3\u00c4\b\37\3\2\u00c4>\3\2\2\2\r\2\u0093"+
- "\u0099\u00a1\u00a7\u00ab\u00af\u00b2\u00b4\u00ba\u00bf";
+ "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
+ "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3"+
+ "\4\3\4\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7"+
+ "\3\7\3\b\3\b\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\13\3\f\3\f\3\r\3\r\3"+
+ "\r\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\21\3"+
+ "\21\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3"+
+ "\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3"+
+ "\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\30\3\30\3\30\3\30\3"+
+ "\30\3\30\3\30\3\31\3\31\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\33\3\34\3"+
+ "\34\3\34\3\34\3\34\3\34\3\35\3\35\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3"+
+ "\36\3\37\3\37\3\37\3 \3 \3 \3!\3!\3!\3!\3!\3!\3!\3!\3!\5!\u00dc\n!\3\""+
+ "\3\"\7\"\u00e0\n\"\f\"\16\"\u00e3\13\"\3\"\3\"\3#\6#\u00e8\n#\r#\16#\u00e9"+
+ "\3#\3#\6#\u00ee\n#\r#\16#\u00ef\7#\u00f2\n#\f#\16#\u00f5\13#\3$\5$\u00f8"+
+ "\n$\3$\7$\u00fb\n$\f$\16$\u00fe\13$\3%\6%\u0101\n%\r%\16%\u0102\3%\3%"+
+ "\3&\5&\u0108\n&\3&\3&\3&\3&\3\u00e1\'\3\3\1\5\4\1\7\5\1\t\6\1\13\7\1\r"+
+ "\b\1\17\t\1\21\n\1\23\13\1\25\f\1\27\r\1\31\16\1\33\17\1\35\20\1\37\21"+
+ "\1!\22\1#\23\1%\24\1\'\25\1)\26\1+\27\1-\30\1/\31\1\61\32\1\63\33\1\65"+
+ "\34\1\67\35\19\36\1;\37\1= \1?!\1A\"\1C#\1E$\1G%\1I&\2K\'\3\3\2\6\3\2"+
+ "\62;\5\2C\\aac|\6\2\62;C\\aac|\4\2\13\13\"\"\u0114\2\3\3\2\2\2\2\5\3\2"+
+ "\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21"+
+ "\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2"+
+ "\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3"+
+ "\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3"+
+ "\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3"+
+ "\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2"+
+ "\2\3M\3\2\2\2\5S\3\2\2\2\7U\3\2\2\2\tW\3\2\2\2\13Y\3\2\2\2\re\3\2\2\2"+
+ "\17h\3\2\2\2\21l\3\2\2\2\23n\3\2\2\2\25p\3\2\2\2\27s\3\2\2\2\31u\3\2\2"+
+ "\2\33x\3\2\2\2\35{\3\2\2\2\37\177\3\2\2\2!\u0084\3\2\2\2#\u008c\3\2\2"+
+ "\2%\u008f\3\2\2\2\'\u0094\3\2\2\2)\u009d\3\2\2\2+\u009f\3\2\2\2-\u00a9"+
+ "\3\2\2\2/\u00ab\3\2\2\2\61\u00b2\3\2\2\2\63\u00b4\3\2\2\2\65\u00b7\3\2"+
+ "\2\2\67\u00bc\3\2\2\29\u00c2\3\2\2\2;\u00c4\3\2\2\2=\u00cc\3\2\2\2?\u00cf"+
+ "\3\2\2\2A\u00db\3\2\2\2C\u00dd\3\2\2\2E\u00e7\3\2\2\2G\u00f7\3\2\2\2I"+
+ "\u0100\3\2\2\2K\u0107\3\2\2\2MN\7g\2\2NO\7p\2\2OP\7f\2\2PQ\7k\2\2QR\7"+
+ "h\2\2R\4\3\2\2\2ST\7.\2\2T\6\3\2\2\2UV\7,\2\2V\b\3\2\2\2WX\7/\2\2X\n\3"+
+ "\2\2\2YZ\7g\2\2Z[\7p\2\2[\\\7f\2\2\\]\7h\2\2]^\7w\2\2^_\7p\2\2_`\7e\2"+
+ "\2`a\7v\2\2ab\7k\2\2bc\7q\2\2cd\7p\2\2d\f\3\2\2\2ef\7q\2\2fg\7t\2\2g\16"+
+ "\3\2\2\2hi\7p\2\2ij\7q\2\2jk\7v\2\2k\20\3\2\2\2lm\7*\2\2m\22\3\2\2\2n"+
+ "o\7<\2\2o\24\3\2\2\2pq\7k\2\2qr\7h\2\2r\26\3\2\2\2st\7>\2\2t\30\3\2\2"+
+ "\2uv\7#\2\2vw\7?\2\2w\32\3\2\2\2xy\7>\2\2yz\7?\2\2z\34\3\2\2\2{|\7c\2"+
+ "\2|}\7p\2\2}~\7f\2\2~\36\3\2\2\2\177\u0080\7u\2\2\u0080\u0081\7m\2\2\u0081"+
+ "\u0082\7k\2\2\u0082\u0083\7r\2\2\u0083 \3\2\2\2\u0084\u0085\7g\2\2\u0085"+
+ "\u0086\7p\2\2\u0086\u0087\7f\2\2\u0087\u0088\7n\2\2\u0088\u0089\7q\2\2"+
+ "\u0089\u008a\7q\2\2\u008a\u008b\7r\2\2\u008b\"\3\2\2\2\u008c\u008d\7f"+
+ "\2\2\u008d\u008e\7q\2\2\u008e$\3\2\2\2\u008f\u0090\7n\2\2\u0090\u0091"+
+ "\7q\2\2\u0091\u0092\7q\2\2\u0092\u0093\7r\2\2\u0093&\3\2\2\2\u0094\u0095"+
+ "\7h\2\2\u0095\u0096\7w\2\2\u0096\u0097\7p\2\2\u0097\u0098\7e\2\2\u0098"+
+ "\u0099\7v\2\2\u0099\u009a\7k\2\2\u009a\u009b\7q\2\2\u009b\u009c\7p\2\2"+
+ "\u009c(\3\2\2\2\u009d\u009e\7+\2\2\u009e*\3\2\2\2\u009f\u00a0\7r\2\2\u00a0"+
+ "\u00a1\7t\2\2\u00a1\u00a2\7q\2\2\u00a2\u00a3\7e\2\2\u00a3\u00a4\7g\2\2"+
+ "\u00a4\u00a5\7f\2\2\u00a5\u00a6\7w\2\2\u00a6\u00a7\7t\2\2\u00a7\u00a8"+
+ "\7g\2\2\u00a8,\3\2\2\2\u00a9\u00aa\7-\2\2\u00aa.\3\2\2\2\u00ab\u00ac\7"+
+ "t\2\2\u00ac\u00ad\7g\2\2\u00ad\u00ae\7v\2\2\u00ae\u00af\7w\2\2\u00af\u00b0"+
+ "\7t\2\2\u00b0\u00b1\7p\2\2\u00b1\60\3\2\2\2\u00b2\u00b3\7@\2\2\u00b3\62"+
+ "\3\2\2\2\u00b4\u00b5\7<\2\2\u00b5\u00b6\7?\2\2\u00b6\64\3\2\2\2\u00b7"+
+ "\u00b8\7v\2\2\u00b8\u00b9\7j\2\2\u00b9\u00ba\7g\2\2\u00ba\u00bb\7p\2\2"+
+ "\u00bb\66\3\2\2\2\u00bc\u00bd\7d\2\2\u00bd\u00be\7g\2\2\u00be\u00bf\7"+
+ "i\2\2\u00bf\u00c0\7k\2\2\u00c0\u00c1\7p\2\2\u00c18\3\2\2\2\u00c2\u00c3"+
+ "\7\61\2\2\u00c3:\3\2\2\2\u00c4\u00c5\7t\2\2\u00c5\u00c6\7g\2\2\u00c6\u00c7"+
+ "\7v\2\2\u00c7\u00c8\7w\2\2\u00c8\u00c9\7t\2\2\u00c9\u00ca\7p\2\2\u00ca"+
+ "\u00cb\7u\2\2\u00cb<\3\2\2\2\u00cc\u00cd\7?\2\2\u00cd\u00ce\7?\2\2\u00ce"+
+ ">\3\2\2\2\u00cf\u00d0\7@\2\2\u00d0\u00d1\7?\2\2\u00d1@\3\2\2\2\u00d2\u00d3"+
+ "\7h\2\2\u00d3\u00d4\7c\2\2\u00d4\u00d5\7n\2\2\u00d5\u00d6\7u\2\2\u00d6"+
+ "\u00dc\7g\2\2\u00d7\u00d8\7v\2\2\u00d8\u00d9\7t\2\2\u00d9\u00da\7w\2\2"+
+ "\u00da\u00dc\7g\2\2\u00db\u00d2\3\2\2\2\u00db\u00d7\3\2\2\2\u00dcB\3\2"+
+ "\2\2\u00dd\u00e1\7$\2\2\u00de\u00e0\13\2\2\2\u00df\u00de\3\2\2\2\u00e0"+
+ "\u00e3\3\2\2\2\u00e1\u00e2\3\2\2\2\u00e1\u00df\3\2\2\2\u00e2\u00e4\3\2"+
+ "\2\2\u00e3\u00e1\3\2\2\2\u00e4\u00e5\7$\2\2\u00e5D\3\2\2\2\u00e6\u00e8"+
+ "\t\2\2\2\u00e7\u00e6\3\2\2\2\u00e8\u00e9\3\2\2\2\u00e9\u00e7\3\2\2\2\u00e9"+
+ "\u00ea\3\2\2\2\u00ea\u00f3\3\2\2\2\u00eb\u00ed\7\60\2\2\u00ec\u00ee\t"+
+ "\2\2\2\u00ed\u00ec\3\2\2\2\u00ee\u00ef\3\2\2\2\u00ef\u00ed\3\2\2\2\u00ef"+
+ "\u00f0\3\2\2\2\u00f0\u00f2\3\2\2\2\u00f1\u00eb\3\2\2\2\u00f2\u00f5\3\2"+
+ "\2\2\u00f3\u00f1\3\2\2\2\u00f3\u00f4\3\2\2\2\u00f4F\3\2\2\2\u00f5\u00f3"+
+ "\3\2\2\2\u00f6\u00f8\t\3\2\2\u00f7\u00f6\3\2\2\2\u00f8\u00fc\3\2\2\2\u00f9"+
+ "\u00fb\t\4\2\2\u00fa\u00f9\3\2\2\2\u00fb\u00fe\3\2\2\2\u00fc\u00fa\3\2"+
+ "\2\2\u00fc\u00fd\3\2\2\2\u00fdH\3\2\2\2\u00fe\u00fc\3\2\2\2\u00ff\u0101"+
+ "\t\5\2\2\u0100\u00ff\3\2\2\2\u0101\u0102\3\2\2\2\u0102\u0100\3\2\2\2\u0102"+
+ "\u0103\3\2\2\2\u0103\u0104\3\2\2\2\u0104\u0105\b%\2\2\u0105J\3\2\2\2\u0106"+
+ "\u0108\7\17\2\2\u0107\u0106\3\2\2\2\u0107\u0108\3\2\2\2\u0108\u0109\3"+
+ "\2\2\2\u0109\u010a\7\f\2\2\u010a\u010b\3\2\2\2\u010b\u010c\b&\3\2\u010c"+
+ "L\3\2\2\2\r\2\u00db\u00e1\u00e9\u00ef\u00f3\u00f7\u00fa\u00fc\u0102\u0107";
public static final ATN _ATN =
ATNSimulator.deserialize(_serializedATN.toCharArray());
static {
diff --git a/grammar-imperative/src/ImperativeLexer.tokens b/grammar-imperative/src/ImperativeLexer.tokens
index 5e0d877..7878765 100644
--- a/grammar-imperative/src/ImperativeLexer.tokens
+++ b/grammar-imperative/src/ImperativeLexer.tokens
@@ -1,54 +1,68 @@
-T__23=1
-T__22=2
-T__21=3
-T__20=4
-NUMBER=27
-WHITESPACE=29
-ID=28
-T__9=15
-T__8=16
-T__7=17
-T__6=18
-T__5=19
-T__4=20
-T__19=5
-BOOLEAN=25
-T__16=8
-T__15=9
-T__18=6
-T__17=7
-T__12=12
-T__11=13
-T__14=10
-T__13=11
-T__1=23
-T__0=24
-T__10=14
-T__3=21
-T__2=22
-NEW_LINE=30
-STRING=26
-'end'=24
-'>='=23
-'skip'=22
-'=='=21
-'/'=20
-'then'=19
-':='=18
-'and'=17
-'>'=16
-'<='=15
-'!='=14
-'<'=13
-'if'=12
-'not'=10
-'('=11
-'-'=7
-'*'=8
-'or'=9
-'+'=6
-','=5
-'endif'=3
-')'=4
-'loop'=2
-'do'=1
+T__29=2
+T__28=3
+T__27=4
+T__26=5
+T__25=6
+T__24=7
+T__23=8
+T__22=9
+T__21=10
+T__20=11
+NUMBER=34
+WHITESPACE=36
+ID=35
+T__9=22
+T__8=23
+T__7=24
+T__6=25
+T__5=26
+T__4=27
+T__19=12
+T__30=1
+BOOLEAN=32
+T__16=15
+T__15=16
+T__18=13
+T__17=14
+T__12=19
+T__11=20
+T__14=17
+T__13=18
+T__1=30
+T__0=31
+T__3=28
+T__10=21
+T__2=29
+NEW_LINE=37
+STRING=33
+'>='=31
+'=='=30
+'returns'=29
+'/'=28
+'begin'=27
+'then'=26
+':='=25
+'>'=24
+'return'=23
+'+'=22
+'procedure'=21
+'function'=19
+')'=20
+'loop'=18
+'do'=17
+'endloop'=16
+'skip'=15
+'and'=14
+'<='=13
+'!='=12
+'<'=11
+'if'=10
+':'=9
+'('=8
+'not'=7
+'or'=6
+'endfunction'=5
+'-'=4
+'*'=3
+','=2
+'endif'=1
diff --git a/grammar-imperative/src/ImperativeListener.class b/grammar-imperative/src/ImperativeListener.class
index 79509c7..4efcda0 100644
Binary files a/grammar-imperative/src/ImperativeListener.class and b/grammar-imperative/src/ImperativeListener.class differ
diff --git a/grammar-imperative/src/ImperativeListener.java b/grammar-imperative/src/ImperativeListener.java
index e886c54..b9d3b6f 100644
--- a/grammar-imperative/src/ImperativeListener.java
+++ b/grammar-imperative/src/ImperativeListener.java
@@ -19,26 +19,81 @@ public interface ImperativeListener extends ParseTreeListener {
void exitExpression(@NotNull ImperativeParser.ExpressionContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#statement}.
+ * Enter a parse tree produced by {@link ImperativeParser#constant}.
* @param ctx the parse tree
*/
- void enterStatement(@NotNull ImperativeParser.StatementContext ctx);
+ void enterConstant(@NotNull ImperativeParser.ConstantContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#statement}.
+ * Exit a parse tree produced by {@link ImperativeParser#constant}.
* @param ctx the parse tree
*/
- void exitStatement(@NotNull ImperativeParser.StatementContext ctx);
+ void exitConstant(@NotNull ImperativeParser.ConstantContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#functionCall}.
+ * Enter a parse tree produced by {@link ImperativeParser#loopStatement}.
* @param ctx the parse tree
*/
- void enterFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
+ void enterLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#functionCall}.
+ * Exit a parse tree produced by {@link ImperativeParser#loopStatement}.
* @param ctx the parse tree
*/
- void exitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
+ void exitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#returnStatement}.
+ * @param ctx the parse tree
+ */
+ void enterReturnStatement(@NotNull ImperativeParser.ReturnStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#returnStatement}.
+ * @param ctx the parse tree
+ */
+ void exitReturnStatement(@NotNull ImperativeParser.ReturnStatementContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#init}.
+ * @param ctx the parse tree
+ */
+ void enterInit(@NotNull ImperativeParser.InitContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#init}.
+ * @param ctx the parse tree
+ */
+ void exitInit(@NotNull ImperativeParser.InitContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#skip}.
+ * @param ctx the parse tree
+ */
+ void enterSkip(@NotNull ImperativeParser.SkipContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#skip}.
+ * @param ctx the parse tree
+ */
+ void exitSkip(@NotNull ImperativeParser.SkipContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#ifStatement}.
+ * @param ctx the parse tree
+ */
+ void enterIfStatement(@NotNull ImperativeParser.IfStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#ifStatement}.
+ * @param ctx the parse tree
+ */
+ void exitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#statement}.
+ * @param ctx the parse tree
+ */
+ void enterStatement(@NotNull ImperativeParser.StatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#statement}.
+ * @param ctx the parse tree
+ */
+ void exitStatement(@NotNull ImperativeParser.StatementContext ctx);
/**
* Enter a parse tree produced by {@link ImperativeParser#assignment}.
@@ -52,68 +107,68 @@ public interface ImperativeListener extends ParseTreeListener {
void exitAssignment(@NotNull ImperativeParser.AssignmentContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#constant}.
+ * Enter a parse tree produced by {@link ImperativeParser#functionCall}.
* @param ctx the parse tree
*/
- void enterConstant(@NotNull ImperativeParser.ConstantContext ctx);
+ void enterFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#constant}.
+ * Exit a parse tree produced by {@link ImperativeParser#functionCall}.
* @param ctx the parse tree
*/
- void exitConstant(@NotNull ImperativeParser.ConstantContext ctx);
+ void exitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#loopStatement}.
+ * Enter a parse tree produced by {@link ImperativeParser#functionDefinition}.
* @param ctx the parse tree
*/
- void enterLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx);
+ void enterFunctionDefinition(@NotNull ImperativeParser.FunctionDefinitionContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#loopStatement}.
+ * Exit a parse tree produced by {@link ImperativeParser#functionDefinition}.
* @param ctx the parse tree
*/
- void exitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx);
+ void exitFunctionDefinition(@NotNull ImperativeParser.FunctionDefinitionContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#init}.
+ * Enter a parse tree produced by {@link ImperativeParser#formalParameters}.
* @param ctx the parse tree
*/
- void enterInit(@NotNull ImperativeParser.InitContext ctx);
+ void enterFormalParameters(@NotNull ImperativeParser.FormalParametersContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#init}.
+ * Exit a parse tree produced by {@link ImperativeParser#formalParameters}.
* @param ctx the parse tree
*/
- void exitInit(@NotNull ImperativeParser.InitContext ctx);
+ void exitFormalParameters(@NotNull ImperativeParser.FormalParametersContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#skip}.
+ * Enter a parse tree produced by {@link ImperativeParser#sequence}.
* @param ctx the parse tree
*/
- void enterSkip(@NotNull ImperativeParser.SkipContext ctx);
+ void enterSequence(@NotNull ImperativeParser.SequenceContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#skip}.
+ * Exit a parse tree produced by {@link ImperativeParser#sequence}.
* @param ctx the parse tree
*/
- void exitSkip(@NotNull ImperativeParser.SkipContext ctx);
+ void exitSequence(@NotNull ImperativeParser.SequenceContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#actualParameters}.
+ * Enter a parse tree produced by {@link ImperativeParser#procedureDefinition}.
* @param ctx the parse tree
*/
- void enterActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx);
+ void enterProcedureDefinition(@NotNull ImperativeParser.ProcedureDefinitionContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#actualParameters}.
+ * Exit a parse tree produced by {@link ImperativeParser#procedureDefinition}.
* @param ctx the parse tree
*/
- void exitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx);
+ void exitProcedureDefinition(@NotNull ImperativeParser.ProcedureDefinitionContext ctx);
/**
- * Enter a parse tree produced by {@link ImperativeParser#ifStatement}.
+ * Enter a parse tree produced by {@link ImperativeParser#actualParameters}.
* @param ctx the parse tree
*/
- void enterIfStatement(@NotNull ImperativeParser.IfStatementContext ctx);
+ void enterActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx);
/**
- * Exit a parse tree produced by {@link ImperativeParser#ifStatement}.
+ * Exit a parse tree produced by {@link ImperativeParser#actualParameters}.
* @param ctx the parse tree
*/
- void exitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx);
+ void exitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx);
}
\ No newline at end of file
diff --git a/grammar-imperative/src/ImperativeParser$ActualParametersContext.class b/grammar-imperative/src/ImperativeParser$ActualParametersContext.class
index b8f8767..4a8971a 100644
Binary files a/grammar-imperative/src/ImperativeParser$ActualParametersContext.class and b/grammar-imperative/src/ImperativeParser$ActualParametersContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$AssignmentContext.class b/grammar-imperative/src/ImperativeParser$AssignmentContext.class
index 7b832ec..de0e157 100644
Binary files a/grammar-imperative/src/ImperativeParser$AssignmentContext.class and b/grammar-imperative/src/ImperativeParser$AssignmentContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$ConstantContext.class b/grammar-imperative/src/ImperativeParser$ConstantContext.class
index 07c3f21..016d0f0 100644
Binary files a/grammar-imperative/src/ImperativeParser$ConstantContext.class and b/grammar-imperative/src/ImperativeParser$ConstantContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$ExpressionContext.class b/grammar-imperative/src/ImperativeParser$ExpressionContext.class
index 22b8db6..f0ac852 100644
Binary files a/grammar-imperative/src/ImperativeParser$ExpressionContext.class and b/grammar-imperative/src/ImperativeParser$ExpressionContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$FormalParametersContext.class b/grammar-imperative/src/ImperativeParser$FormalParametersContext.class
new file mode 100644
index 0000000..650b8ef
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$FormalParametersContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$FunctionCallContext.class b/grammar-imperative/src/ImperativeParser$FunctionCallContext.class
index 7ad3ee1..40fd73a 100644
Binary files a/grammar-imperative/src/ImperativeParser$FunctionCallContext.class and b/grammar-imperative/src/ImperativeParser$FunctionCallContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$FunctionDefinitionContext.class b/grammar-imperative/src/ImperativeParser$FunctionDefinitionContext.class
new file mode 100644
index 0000000..5ae8c62
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$FunctionDefinitionContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$IfStatementContext.class b/grammar-imperative/src/ImperativeParser$IfStatementContext.class
index 4185ded..1848a1a 100644
Binary files a/grammar-imperative/src/ImperativeParser$IfStatementContext.class and b/grammar-imperative/src/ImperativeParser$IfStatementContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$InitContext.class b/grammar-imperative/src/ImperativeParser$InitContext.class
index cf00bbd..6b87b94 100644
Binary files a/grammar-imperative/src/ImperativeParser$InitContext.class and b/grammar-imperative/src/ImperativeParser$InitContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$LoopStatementContext.class b/grammar-imperative/src/ImperativeParser$LoopStatementContext.class
index bc0b31e..9ee409e 100644
Binary files a/grammar-imperative/src/ImperativeParser$LoopStatementContext.class and b/grammar-imperative/src/ImperativeParser$LoopStatementContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$ProcedureDefinitionContext.class b/grammar-imperative/src/ImperativeParser$ProcedureDefinitionContext.class
new file mode 100644
index 0000000..7dbd7ad
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$ProcedureDefinitionContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$ReturnStatementContext.class b/grammar-imperative/src/ImperativeParser$ReturnStatementContext.class
new file mode 100644
index 0000000..54c3fcd
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$ReturnStatementContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$SequenceContext.class b/grammar-imperative/src/ImperativeParser$SequenceContext.class
new file mode 100644
index 0000000..d5a6fa9
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$SequenceContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$SkipContext.class b/grammar-imperative/src/ImperativeParser$SkipContext.class
index b0a7c0b..5e61c68 100644
Binary files a/grammar-imperative/src/ImperativeParser$SkipContext.class and b/grammar-imperative/src/ImperativeParser$SkipContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$StatementContext.class b/grammar-imperative/src/ImperativeParser$StatementContext.class
index 6a270a6..432bfe3 100644
Binary files a/grammar-imperative/src/ImperativeParser$StatementContext.class and b/grammar-imperative/src/ImperativeParser$StatementContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser.class b/grammar-imperative/src/ImperativeParser.class
index e9d1d63..209ea64 100644
Binary files a/grammar-imperative/src/ImperativeParser.class and b/grammar-imperative/src/ImperativeParser.class differ
diff --git a/grammar-imperative/src/ImperativeParser.java b/grammar-imperative/src/ImperativeParser.java
index 43663b2..79ad44e 100644
--- a/grammar-imperative/src/ImperativeParser.java
+++ b/grammar-imperative/src/ImperativeParser.java
@@ -14,23 +14,28 @@ public class ImperativeParser extends Parser {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
- T__23=1, T__22=2, T__21=3, T__20=4, T__19=5, T__18=6, T__17=7, T__16=8,
- T__15=9, T__14=10, T__13=11, T__12=12, T__11=13, T__10=14, T__9=15, T__8=16,
- T__7=17, T__6=18, T__5=19, T__4=20, T__3=21, T__2=22, T__1=23, T__0=24,
- BOOLEAN=25, STRING=26, NUMBER=27, ID=28, WHITESPACE=29, NEW_LINE=30;
+ T__30=1, T__29=2, T__28=3, T__27=4, T__26=5, T__25=6, T__24=7, T__23=8,
+ T__22=9, T__21=10, T__20=11, T__19=12, T__18=13, T__17=14, T__16=15, T__15=16,
+ T__14=17, T__13=18, T__12=19, T__11=20, T__10=21, T__9=22, T__8=23, T__7=24,
+ T__6=25, T__5=26, T__4=27, T__3=28, T__2=29, T__1=30, T__0=31, BOOLEAN=32,
+ STRING=33, NUMBER=34, ID=35, WHITESPACE=36, NEW_LINE=37;
public static final String[] tokenNames = {
- "", "'do'", "'loop'", "'endif'", "')'", "','", "'+'", "'-'",
- "'*'", "'or'", "'not'", "'('", "'if'", "'<'", "'!='", "'<='", "'>'", "'and'",
- "':='", "'then'", "'/'", "'=='", "'skip'", "'>='", "'end'", "BOOLEAN",
- "STRING", "NUMBER", "ID", "WHITESPACE", "NEW_LINE"
+ "", "'endif'", "','", "'*'", "'-'", "'endfunction'", "'or'",
+ "'not'", "'('", "':'", "'if'", "'<'", "'!='", "'<='", "'and'", "'skip'",
+ "'endloop'", "'do'", "'loop'", "'function'", "')'", "'procedure'", "'+'",
+ "'return'", "'>'", "':='", "'then'", "'begin'", "'/'", "'returns'", "'=='",
+ "'>='", "BOOLEAN", "STRING", "NUMBER", "ID", "WHITESPACE", "NEW_LINE"
};
public static final int
- RULE_init = 0, RULE_statement = 1, RULE_skip = 2, RULE_assignment = 3,
- RULE_ifStatement = 4, RULE_loopStatement = 5, RULE_functionCall = 6, RULE_actualParameters = 7,
- RULE_expression = 8, RULE_constant = 9;
+ RULE_init = 0, RULE_functionDefinition = 1, RULE_procedureDefinition = 2,
+ RULE_formalParameters = 3, RULE_statement = 4, RULE_returnStatement = 5,
+ RULE_sequence = 6, RULE_skip = 7, RULE_assignment = 8, RULE_ifStatement = 9,
+ RULE_loopStatement = 10, RULE_functionCall = 11, RULE_actualParameters = 12,
+ RULE_expression = 13, RULE_constant = 14;
public static final String[] ruleNames = {
- "init", "statement", "skip", "assignment", "ifStatement", "loopStatement",
- "functionCall", "actualParameters", "expression", "constant"
+ "init", "functionDefinition", "procedureDefinition", "formalParameters",
+ "statement", "returnStatement", "sequence", "skip", "assignment", "ifStatement",
+ "loopStatement", "functionCall", "actualParameters", "expression", "constant"
};
@Override
@@ -50,11 +55,14 @@ public ImperativeParser(TokenStream input) {
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class InitContext extends ParserRuleContext {
- public List statement() {
- return getRuleContexts(StatementContext.class);
+ public ProcedureDefinitionContext procedureDefinition() {
+ return getRuleContext(ProcedureDefinitionContext.class,0);
}
- public StatementContext statement(int i) {
- return getRuleContext(StatementContext.class,i);
+ public SequenceContext sequence() {
+ return getRuleContext(SequenceContext.class,0);
+ }
+ public FunctionDefinitionContext functionDefinition() {
+ return getRuleContext(FunctionDefinitionContext.class,0);
}
public InitContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
@@ -78,23 +86,229 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final InitContext init() throws RecognitionException {
InitContext _localctx = new InitContext(_ctx, getState());
enterRule(_localctx, 0, RULE_init);
+ try {
+ setState(33);
+ switch (_input.LA(1)) {
+ case 10:
+ case 15:
+ case 18:
+ case 23:
+ case ID:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(30); sequence();
+ }
+ break;
+ case 19:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(31); functionDefinition();
+ }
+ break;
+ case 21:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(32); procedureDefinition();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class FunctionDefinitionContext extends ParserRuleContext {
+ public List ID() { return getTokens(ImperativeParser.ID); }
+ public FormalParametersContext formalParameters() {
+ return getRuleContext(FormalParametersContext.class,0);
+ }
+ public SequenceContext sequence() {
+ return getRuleContext(SequenceContext.class,0);
+ }
+ public TerminalNode ID(int i) {
+ return getToken(ImperativeParser.ID, i);
+ }
+ public FunctionDefinitionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_functionDefinition; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterFunctionDefinition(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitFunctionDefinition(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitFunctionDefinition(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final FunctionDefinitionContext functionDefinition() throws RecognitionException {
+ FunctionDefinitionContext _localctx = new FunctionDefinitionContext(_ctx, getState());
+ enterRule(_localctx, 2, RULE_functionDefinition);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(35); match(19);
+ setState(36); match(ID);
+ setState(37); match(8);
+ setState(39);
+ _la = _input.LA(1);
+ if (_la==ID) {
+ {
+ setState(38); formalParameters();
+ }
+ }
+
+ setState(41); match(20);
+ setState(42); match(29);
+ setState(43); match(ID);
+ setState(44); match(27);
+ setState(45); sequence();
+ setState(46); match(5);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class ProcedureDefinitionContext extends ParserRuleContext {
+ public TerminalNode ID() { return getToken(ImperativeParser.ID, 0); }
+ public FormalParametersContext formalParameters() {
+ return getRuleContext(FormalParametersContext.class,0);
+ }
+ public SequenceContext sequence() {
+ return getRuleContext(SequenceContext.class,0);
+ }
+ public ProcedureDefinitionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_procedureDefinition; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterProcedureDefinition(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitProcedureDefinition(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitProcedureDefinition(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ProcedureDefinitionContext procedureDefinition() throws RecognitionException {
+ ProcedureDefinitionContext _localctx = new ProcedureDefinitionContext(_ctx, getState());
+ enterRule(_localctx, 4, RULE_procedureDefinition);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(48); match(21);
+ setState(49); match(ID);
+ setState(50); match(8);
+ setState(52);
+ _la = _input.LA(1);
+ if (_la==ID) {
+ {
+ setState(51); formalParameters();
+ }
+ }
+
+ setState(54); match(20);
+ setState(55); match(27);
+ setState(56); sequence();
+ setState(57); match(5);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class FormalParametersContext extends ParserRuleContext {
+ public List ID() { return getTokens(ImperativeParser.ID); }
+ public TerminalNode ID(int i) {
+ return getToken(ImperativeParser.ID, i);
+ }
+ public FormalParametersContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_formalParameters; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterFormalParameters(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitFormalParameters(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitFormalParameters(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final FormalParametersContext formalParameters() throws RecognitionException {
+ FormalParametersContext _localctx = new FormalParametersContext(_ctx, getState());
+ enterRule(_localctx, 6, RULE_formalParameters);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
- setState(21);
+ {
+ setState(59); match(ID);
+ setState(60); match(9);
+ setState(61); match(ID);
+ }
+ setState(69);
_errHandler.sync(this);
_la = _input.LA(1);
- do {
+ while (_la==2) {
+ {
{
+ setState(63); match(2);
{
- setState(20); statement();
+ setState(64); match(ID);
+ setState(65); match(9);
+ setState(66); match(ID);
}
}
- setState(23);
+ }
+ setState(71);
_errHandler.sync(this);
_la = _input.LA(1);
- } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 2) | (1L << 12) | (1L << 22) | (1L << ID))) != 0) );
+ }
}
}
catch (RecognitionException re) {
@@ -121,6 +335,9 @@ public FunctionCallContext functionCall() {
public AssignmentContext assignment() {
return getRuleContext(AssignmentContext.class,0);
}
+ public ReturnStatementContext returnStatement() {
+ return getRuleContext(ReturnStatementContext.class,0);
+ }
public LoopStatementContext loopStatement() {
return getRuleContext(LoopStatementContext.class,0);
}
@@ -145,42 +362,49 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final StatementContext statement() throws RecognitionException {
StatementContext _localctx = new StatementContext(_ctx, getState());
- enterRule(_localctx, 2, RULE_statement);
+ enterRule(_localctx, 8, RULE_statement);
try {
- setState(30);
- switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
+ setState(78);
+ switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
- setState(25); skip();
+ setState(72); skip();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
- setState(26); assignment();
+ setState(73); assignment();
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
- setState(27); functionCall();
+ setState(74); returnStatement();
}
break;
case 4:
enterOuterAlt(_localctx, 4);
{
- setState(28); ifStatement();
+ setState(75); functionCall();
}
break;
case 5:
enterOuterAlt(_localctx, 5);
{
- setState(29); loopStatement();
+ setState(76); ifStatement();
+ }
+ break;
+
+ case 6:
+ enterOuterAlt(_localctx, 6);
+ {
+ setState(77); loopStatement();
}
break;
}
@@ -196,6 +420,109 @@ public final StatementContext statement() throws RecognitionException {
return _localctx;
}
+ public static class ReturnStatementContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public ReturnStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_returnStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterReturnStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitReturnStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitReturnStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ReturnStatementContext returnStatement() throws RecognitionException {
+ ReturnStatementContext _localctx = new ReturnStatementContext(_ctx, getState());
+ enterRule(_localctx, 10, RULE_returnStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(80); match(23);
+ setState(81); expression(0);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class SequenceContext extends ParserRuleContext {
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public SequenceContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_sequence; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterSequence(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitSequence(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitSequence(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final SequenceContext sequence() throws RecognitionException {
+ SequenceContext _localctx = new SequenceContext(_ctx, getState());
+ enterRule(_localctx, 12, RULE_sequence);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(84);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ do {
+ {
+ {
+ setState(83); statement();
+ }
+ }
+ setState(86);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 10) | (1L << 15) | (1L << 18) | (1L << 23) | (1L << ID))) != 0) );
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
public static class SkipContext extends ParserRuleContext {
public SkipContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
@@ -218,11 +545,11 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final SkipContext skip() throws RecognitionException {
SkipContext _localctx = new SkipContext(_ctx, getState());
- enterRule(_localctx, 4, RULE_skip);
+ enterRule(_localctx, 14, RULE_skip);
try {
enterOuterAlt(_localctx, 1);
{
- setState(32); match(22);
+ setState(88); match(15);
}
}
catch (RecognitionException re) {
@@ -262,13 +589,13 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final AssignmentContext assignment() throws RecognitionException {
AssignmentContext _localctx = new AssignmentContext(_ctx, getState());
- enterRule(_localctx, 6, RULE_assignment);
+ enterRule(_localctx, 16, RULE_assignment);
try {
enterOuterAlt(_localctx, 1);
{
- setState(34); match(ID);
- setState(35); match(18);
- setState(36); expression(0);
+ setState(90); match(ID);
+ setState(91); match(25);
+ setState(92); expression(0);
}
}
catch (RecognitionException re) {
@@ -283,14 +610,11 @@ public final AssignmentContext assignment() throws RecognitionException {
}
public static class IfStatementContext extends ParserRuleContext {
- public List statement() {
- return getRuleContexts(StatementContext.class);
- }
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
- public StatementContext statement(int i) {
- return getRuleContext(StatementContext.class,i);
+ public SequenceContext sequence() {
+ return getRuleContext(SequenceContext.class,0);
}
public IfStatementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
@@ -313,30 +637,17 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final IfStatementContext ifStatement() throws RecognitionException {
IfStatementContext _localctx = new IfStatementContext(_ctx, getState());
- enterRule(_localctx, 8, RULE_ifStatement);
- int _la;
+ enterRule(_localctx, 18, RULE_ifStatement);
try {
enterOuterAlt(_localctx, 1);
{
- setState(38); match(12);
- setState(39); match(11);
- setState(40); expression(0);
- setState(41); match(4);
- setState(42); match(19);
- setState(44);
- _errHandler.sync(this);
- _la = _input.LA(1);
- do {
- {
- {
- setState(43); statement();
- }
- }
- setState(46);
- _errHandler.sync(this);
- _la = _input.LA(1);
- } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 2) | (1L << 12) | (1L << 22) | (1L << ID))) != 0) );
- setState(48); match(3);
+ setState(94); match(10);
+ setState(95); match(8);
+ setState(96); expression(0);
+ setState(97); match(20);
+ setState(98); match(26);
+ setState(99); sequence();
+ setState(100); match(1);
}
}
catch (RecognitionException re) {
@@ -351,14 +662,11 @@ public final IfStatementContext ifStatement() throws RecognitionException {
}
public static class LoopStatementContext extends ParserRuleContext {
- public List statement() {
- return getRuleContexts(StatementContext.class);
- }
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
- public StatementContext statement(int i) {
- return getRuleContext(StatementContext.class,i);
+ public SequenceContext sequence() {
+ return getRuleContext(SequenceContext.class,0);
}
public LoopStatementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
@@ -381,31 +689,17 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final LoopStatementContext loopStatement() throws RecognitionException {
LoopStatementContext _localctx = new LoopStatementContext(_ctx, getState());
- enterRule(_localctx, 10, RULE_loopStatement);
- int _la;
+ enterRule(_localctx, 20, RULE_loopStatement);
try {
enterOuterAlt(_localctx, 1);
{
- setState(50); match(2);
- setState(51); match(11);
- setState(52); expression(0);
- setState(53); match(4);
- setState(54); match(1);
- setState(56);
- _errHandler.sync(this);
- _la = _input.LA(1);
- do {
- {
- {
- setState(55); statement();
- }
- }
- setState(58);
- _errHandler.sync(this);
- _la = _input.LA(1);
- } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 2) | (1L << 12) | (1L << 22) | (1L << ID))) != 0) );
- setState(60); match(24);
- setState(61); match(2);
+ setState(102); match(18);
+ setState(103); match(8);
+ setState(104); expression(0);
+ setState(105); match(20);
+ setState(106); match(17);
+ setState(107); sequence();
+ setState(108); match(16);
}
}
catch (RecognitionException re) {
@@ -445,14 +739,14 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final FunctionCallContext functionCall() throws RecognitionException {
FunctionCallContext _localctx = new FunctionCallContext(_ctx, getState());
- enterRule(_localctx, 12, RULE_functionCall);
+ enterRule(_localctx, 22, RULE_functionCall);
try {
enterOuterAlt(_localctx, 1);
{
- setState(63); match(ID);
- setState(64); match(11);
- setState(65); actualParameters();
- setState(66); match(4);
+ setState(110); match(ID);
+ setState(111); match(8);
+ setState(112); actualParameters();
+ setState(113); match(20);
}
}
catch (RecognitionException re) {
@@ -494,23 +788,23 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final ActualParametersContext actualParameters() throws RecognitionException {
ActualParametersContext _localctx = new ActualParametersContext(_ctx, getState());
- enterRule(_localctx, 14, RULE_actualParameters);
+ enterRule(_localctx, 24, RULE_actualParameters);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
- setState(68); expression(0);
- setState(73);
+ setState(115); expression(0);
+ setState(120);
_errHandler.sync(this);
_la = _input.LA(1);
- while (_la==5) {
+ while (_la==2) {
{
{
- setState(69); match(5);
- setState(70); expression(0);
+ setState(116); match(2);
+ setState(117); expression(0);
}
}
- setState(75);
+ setState(122);
_errHandler.sync(this);
_la = _input.LA(1);
}
@@ -568,49 +862,49 @@ public final ExpressionContext expression(int _p) throws RecognitionException {
int _parentState = getState();
ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState, _p);
ExpressionContext _prevctx = _localctx;
- int _startState = 16;
+ int _startState = 26;
enterRecursionRule(_localctx, RULE_expression);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
- setState(82);
- switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
+ setState(129);
+ switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
case 1:
{
- setState(77);
+ setState(124);
_la = _input.LA(1);
- if ( !(_la==7 || _la==10) ) {
+ if ( !(_la==4 || _la==7) ) {
_errHandler.recoverInline(this);
}
consume();
- setState(78); expression(2);
+ setState(125); expression(2);
}
break;
case 2:
{
- setState(79); constant();
+ setState(126); constant();
}
break;
case 3:
{
- setState(80); match(ID);
+ setState(127); match(ID);
}
break;
case 4:
{
- setState(81); functionCall();
+ setState(128); functionCall();
}
break;
}
_ctx.stop = _input.LT(-1);
- setState(89);
+ setState(136);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,6,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,8,_ctx);
while ( _alt!=2 && _alt!=-1 ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
@@ -619,21 +913,21 @@ public final ExpressionContext expression(int _p) throws RecognitionException {
{
_localctx = new ExpressionContext(_parentctx, _parentState, _p);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
- setState(84);
+ setState(131);
if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p");
- setState(85);
+ setState(132);
_la = _input.LA(1);
- if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 6) | (1L << 7) | (1L << 8) | (1L << 9) | (1L << 13) | (1L << 14) | (1L << 15) | (1L << 16) | (1L << 17) | (1L << 20) | (1L << 21) | (1L << 23))) != 0)) ) {
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 3) | (1L << 4) | (1L << 6) | (1L << 11) | (1L << 12) | (1L << 13) | (1L << 14) | (1L << 22) | (1L << 24) | (1L << 28) | (1L << 30) | (1L << 31))) != 0)) ) {
_errHandler.recoverInline(this);
}
consume();
- setState(86); expression(2);
+ setState(133); expression(2);
}
}
}
- setState(91);
+ setState(138);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,6,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,8,_ctx);
}
}
}
@@ -673,12 +967,12 @@ public T accept(ParseTreeVisitor extends T> visitor) {
public final ConstantContext constant() throws RecognitionException {
ConstantContext _localctx = new ConstantContext(_ctx, getState());
- enterRule(_localctx, 18, RULE_constant);
+ enterRule(_localctx, 28, RULE_constant);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
- setState(92);
+ setState(139);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BOOLEAN) | (1L << STRING) | (1L << NUMBER))) != 0)) ) {
_errHandler.recoverInline(this);
@@ -699,7 +993,7 @@ public final ConstantContext constant() throws RecognitionException {
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
- case 8: return expression_sempred((ExpressionContext)_localctx, predIndex);
+ case 13: return expression_sempred((ExpressionContext)_localctx, predIndex);
}
return true;
}
@@ -711,30 +1005,44 @@ private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
}
public static final String _serializedATN =
- "\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\3 a\4\2\t\2\4\3\t\3"+
- "\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\3\2"+
- "\6\2\30\n\2\r\2\16\2\31\3\3\3\3\3\3\3\3\3\3\5\3!\n\3\3\4\3\4\3\5\3\5\3"+
- "\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\6\6/\n\6\r\6\16\6\60\3\6\3\6\3\7\3\7\3"+
- "\7\3\7\3\7\3\7\6\7;\n\7\r\7\16\7<\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\t"+
- "\3\t\3\t\7\tJ\n\t\f\t\16\tM\13\t\3\n\3\n\3\n\3\n\3\n\3\n\5\nU\n\n\3\n"+
- "\3\n\3\n\7\nZ\n\n\f\n\16\n]\13\n\3\13\3\13\3\13\2\f\2\4\6\b\n\f\16\20"+
- "\22\24\2\5\4\2\t\t\f\f\6\2\b\13\17\23\26\27\31\31\3\2\33\35b\2\27\3\2"+
- "\2\2\4 \3\2\2\2\6\"\3\2\2\2\b$\3\2\2\2\n(\3\2\2\2\f\64\3\2\2\2\16A\3\2"+
- "\2\2\20F\3\2\2\2\22T\3\2\2\2\24^\3\2\2\2\26\30\5\4\3\2\27\26\3\2\2\2\30"+
- "\31\3\2\2\2\31\27\3\2\2\2\31\32\3\2\2\2\32\3\3\2\2\2\33!\5\6\4\2\34!\5"+
- "\b\5\2\35!\5\16\b\2\36!\5\n\6\2\37!\5\f\7\2 \33\3\2\2\2 \34\3\2\2\2 \35"+
- "\3\2\2\2 \36\3\2\2\2 \37\3\2\2\2!\5\3\2\2\2\"#\7\30\2\2#\7\3\2\2\2$%\7"+
- "\36\2\2%&\7\24\2\2&\'\5\22\n\2\'\t\3\2\2\2()\7\16\2\2)*\7\r\2\2*+\5\22"+
- "\n\2+,\7\6\2\2,.\7\25\2\2-/\5\4\3\2.-\3\2\2\2/\60\3\2\2\2\60.\3\2\2\2"+
- "\60\61\3\2\2\2\61\62\3\2\2\2\62\63\7\5\2\2\63\13\3\2\2\2\64\65\7\4\2\2"+
- "\65\66\7\r\2\2\66\67\5\22\n\2\678\7\6\2\28:\7\3\2\29;\5\4\3\2:9\3\2\2"+
- "\2;<\3\2\2\2<:\3\2\2\2<=\3\2\2\2=>\3\2\2\2>?\7\32\2\2?@\7\4\2\2@\r\3\2"+
- "\2\2AB\7\36\2\2BC\7\r\2\2CD\5\20\t\2DE\7\6\2\2E\17\3\2\2\2FK\5\22\n\2"+
- "GH\7\7\2\2HJ\5\22\n\2IG\3\2\2\2JM\3\2\2\2KI\3\2\2\2KL\3\2\2\2L\21\3\2"+
- "\2\2MK\3\2\2\2NO\b\n\1\2OP\t\2\2\2PU\5\22\n\2QU\5\24\13\2RU\7\36\2\2S"+
- "U\5\16\b\2TN\3\2\2\2TQ\3\2\2\2TR\3\2\2\2TS\3\2\2\2U[\3\2\2\2VW\6\n\2\3"+
- "WX\t\3\2\2XZ\5\22\n\2YV\3\2\2\2Z]\3\2\2\2[Y\3\2\2\2[\\\3\2\2\2\\\23\3"+
- "\2\2\2][\3\2\2\2^_\t\4\2\2_\25\3\2\2\2\t\31 \60\7%\2"+
+ "\2>?\7\13\2\2?@\7%\2\2@G\3\2\2\2AB\7\4\2\2BC\7%\2\2CD\7\13\2\2DF\7%\2"+
+ "\2EA\3\2\2\2FI\3\2\2\2GE\3\2\2\2GH\3\2\2\2H\t\3\2\2\2IG\3\2\2\2JQ\5\20"+
+ "\t\2KQ\5\22\n\2LQ\5\f\7\2MQ\5\30\r\2NQ\5\24\13\2OQ\5\26\f\2PJ\3\2\2\2"+
+ "PK\3\2\2\2PL\3\2\2\2PM\3\2\2\2PN\3\2\2\2PO\3\2\2\2Q\13\3\2\2\2RS\7\31"+
+ "\2\2ST\5\34\17\2T\r\3\2\2\2UW\5\n\6\2VU\3\2\2\2WX\3\2\2\2XV\3\2\2\2XY"+
+ "\3\2\2\2Y\17\3\2\2\2Z[\7\21\2\2[\21\3\2\2\2\\]\7%\2\2]^\7\33\2\2^_\5\34"+
+ "\17\2_\23\3\2\2\2`a\7\f\2\2ab\7\n\2\2bc\5\34\17\2cd\7\26\2\2de\7\34\2"+
+ "\2ef\5\16\b\2fg\7\3\2\2g\25\3\2\2\2hi\7\24\2\2ij\7\n\2\2jk\5\34\17\2k"+
+ "l\7\26\2\2lm\7\23\2\2mn\5\16\b\2no\7\22\2\2o\27\3\2\2\2pq\7%\2\2qr\7\n"+
+ "\2\2rs\5\32\16\2st\7\26\2\2t\31\3\2\2\2uz\5\34\17\2vw\7\4\2\2wy\5\34\17"+
+ "\2xv\3\2\2\2y|\3\2\2\2zx\3\2\2\2z{\3\2\2\2{\33\3\2\2\2|z\3\2\2\2}~\b\17"+
+ "\1\2~\177\t\2\2\2\177\u0084\5\34\17\2\u0080\u0084\5\36\20\2\u0081\u0084"+
+ "\7%\2\2\u0082\u0084\5\30\r\2\u0083}\3\2\2\2\u0083\u0080\3\2\2\2\u0083"+
+ "\u0081\3\2\2\2\u0083\u0082\3\2\2\2\u0084\u008a\3\2\2\2\u0085\u0086\6\17"+
+ "\2\3\u0086\u0087\t\3\2\2\u0087\u0089\5\34\17\2\u0088\u0085\3\2\2\2\u0089"+
+ "\u008c\3\2\2\2\u008a\u0088\3\2\2\2\u008a\u008b\3\2\2\2\u008b\35\3\2\2"+
+ "\2\u008c\u008a\3\2\2\2\u008d\u008e\t\4\2\2\u008e\37\3\2\2\2\13#)\66GP"+
+ "Xz\u0083\u008a";
public static final ATN _ATN =
ATNSimulator.deserialize(_serializedATN.toCharArray());
static {
diff --git a/grammar-imperative/src/ImperativeVisitor.class b/grammar-imperative/src/ImperativeVisitor.class
index dc13771..4cf1e31 100644
Binary files a/grammar-imperative/src/ImperativeVisitor.class and b/grammar-imperative/src/ImperativeVisitor.class differ
diff --git a/grammar-imperative/src/ImperativeVisitor.java b/grammar-imperative/src/ImperativeVisitor.java
index 64d4908..fafb281 100644
--- a/grammar-imperative/src/ImperativeVisitor.java
+++ b/grammar-imperative/src/ImperativeVisitor.java
@@ -18,18 +18,53 @@ public interface ImperativeVisitor extends ParseTreeVisitor {
T visitExpression(@NotNull ImperativeParser.ExpressionContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#statement}.
+ * Visit a parse tree produced by {@link ImperativeParser#constant}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitStatement(@NotNull ImperativeParser.StatementContext ctx);
+ T visitConstant(@NotNull ImperativeParser.ConstantContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#functionCall}.
+ * Visit a parse tree produced by {@link ImperativeParser#loopStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
+ T visitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#returnStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitReturnStatement(@NotNull ImperativeParser.ReturnStatementContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#init}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitInit(@NotNull ImperativeParser.InitContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#skip}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitSkip(@NotNull ImperativeParser.SkipContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#ifStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#statement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitStatement(@NotNull ImperativeParser.StatementContext ctx);
/**
* Visit a parse tree produced by {@link ImperativeParser#assignment}.
@@ -39,44 +74,44 @@ public interface ImperativeVisitor extends ParseTreeVisitor {
T visitAssignment(@NotNull ImperativeParser.AssignmentContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#constant}.
+ * Visit a parse tree produced by {@link ImperativeParser#functionCall}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitConstant(@NotNull ImperativeParser.ConstantContext ctx);
+ T visitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#loopStatement}.
+ * Visit a parse tree produced by {@link ImperativeParser#functionDefinition}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx);
+ T visitFunctionDefinition(@NotNull ImperativeParser.FunctionDefinitionContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#init}.
+ * Visit a parse tree produced by {@link ImperativeParser#formalParameters}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitInit(@NotNull ImperativeParser.InitContext ctx);
+ T visitFormalParameters(@NotNull ImperativeParser.FormalParametersContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#skip}.
+ * Visit a parse tree produced by {@link ImperativeParser#sequence}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitSkip(@NotNull ImperativeParser.SkipContext ctx);
+ T visitSequence(@NotNull ImperativeParser.SequenceContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#actualParameters}.
+ * Visit a parse tree produced by {@link ImperativeParser#procedureDefinition}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx);
+ T visitProcedureDefinition(@NotNull ImperativeParser.ProcedureDefinitionContext ctx);
/**
- * Visit a parse tree produced by {@link ImperativeParser#ifStatement}.
+ * Visit a parse tree produced by {@link ImperativeParser#actualParameters}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitIfStatement(@NotNull ImperativeParser.IfStatementContext ctx);
+ T visitActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx);
}
\ No newline at end of file