diff --git a/docs/Diplomamunka_Szabo_Tamas.docx b/docs/Diplomamunka_Szabo_Tamas.docx
index c4c12f5..2d13dc0 100644
Binary files a/docs/Diplomamunka_Szabo_Tamas.docx and b/docs/Diplomamunka_Szabo_Tamas.docx differ
diff --git a/docs/Diplomamunka_Szabo_Tamas.pdf b/docs/Diplomamunka_Szabo_Tamas.pdf
new file mode 100644
index 0000000..cffac3c
Binary files /dev/null and b/docs/Diplomamunka_Szabo_Tamas.pdf differ
diff --git a/docs/graphics/szintaxisfa.vsdx b/docs/graphics/szintaxisfa.vsdx
index 9d1508e..3e98366 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
new file mode 100644
index 0000000..9fe0af3
Binary files /dev/null and b/docs/graphics/~$$szintaxisfa.~vsdx differ
diff --git a/docs/~$akdolgozat_kovetelmenyek.docx b/docs/~$akdolgozat_kovetelmenyek.docx
new file mode 100644
index 0000000..0d2087e
Binary files /dev/null and b/docs/~$akdolgozat_kovetelmenyek.docx differ
diff --git a/grammar-imperative/Imperative.g4 b/grammar-imperative/Imperative.g4
new file mode 100644
index 0000000..ea72299
--- /dev/null
+++ b/grammar-imperative/Imperative.g4
@@ -0,0 +1,56 @@
+grammar Imperative;
+
+init: (statement)+;
+ //| functionDefinition
+ //| macroDefinition)*;
+
+ statement : skip
+ | assignment
+ | functionCall
+ | ifStatement
+ | loopStatement
+ ;
+
+skip : 'skip'
+ ;
+
+assignment : ID ':=' expression
+ ;
+
+ifStatement : 'if' '(' expression ')' 'then' statement+ 'endif'
+ ;
+
+loopStatement : 'loop' '(' expression ')' 'do' statement+ 'end' 'loop'
+ ;
+
+functionCall : ID '(' actualParameters ')'
+ ;
+
+actualParameters : expression (',' expression)*
+ ;
+
+expression : constant
+ | ID
+ | functionCall
+ | ('not' | '-') expression
+ | expression ('+'|'-'|'/'|'*'|'<'|'<='|'>'|'>='|'=='|'!='|'and'|'or') expression
+ ;
+
+constant : NUMBER | BOOLEAN | STRING
+ ;
+
+BOOLEAN : 'false' | 'true'
+ ;
+
+STRING : '"' .*? '"'
+ ;
+
+NUMBER : [0-9]+('.'[0-9]+)*
+ ;
+
+ID : ('_'|[a-zA-Z]) ([a-zA-Z0-9]|'_')*
+ ;
+
+WHITESPACE : [ \t]+ -> skip;
+
+NEW_LINE : '\r'? '\n' -> skip;
\ No newline at end of file
diff --git a/grammar-imperative/MetaCodeLexer.g4 b/grammar-imperative/MetaCodeLexer.g4
new file mode 100644
index 0000000..557b564
--- /dev/null
+++ b/grammar-imperative/MetaCodeLexer.g4
@@ -0,0 +1,23 @@
+lexer grammar MetaCodeLexer;
+
+WHITESPACE : [ \t]+ -> skip
+ ;
+NEWLINE : [\r]? [\n] -> skip
+ ;
+
+NUMBER : INT
+ | FLOAT
+ ;
+
+fragment
+INT : DIGIT+
+ ;
+
+fragment
+FLOAT : DIGIT+ [.] DIGIT*
+ | [.] DIGIT+
+ ;
+
+fragment
+DIGIT : [0-9]
+ ;
\ No newline at end of file
diff --git a/grammar-imperative/example.txt b/grammar-imperative/example.txt
new file mode 100644
index 0000000..91868c7
--- /dev/null
+++ b/grammar-imperative/example.txt
@@ -0,0 +1,7 @@
+print("Program futásának kezdete ...")
+i := 0
+loop (i < 10) do
+ print(toString(i) + " sor: ")
+ i := i + 1
+end loop
+print("Program futásának vége.")
\ No newline at end of file
diff --git a/grammar-imperative/metacode.sublime-workspace b/grammar-imperative/metacode.sublime-workspace
new file mode 100644
index 0000000..c542708
--- /dev/null
+++ b/grammar-imperative/metacode.sublime-workspace
@@ -0,0 +1,443 @@
+{
+ "auto_complete":
+ {
+ "selected_items":
+ [
+ [
+ "funct",
+ "functionDeclaration"
+ ],
+ [
+ "att",
+ "attributes"
+ ],
+ [
+ "functin",
+ "functionDeclaration"
+ ],
+ [
+ "satet",
+ "statements"
+ ],
+ [
+ "foreac",
+ "foreachExpression"
+ ],
+ [
+ "var",
+ "variableDeclaration"
+ ],
+ [
+ "state",
+ "statements"
+ ],
+ [
+ "stat",
+ "statements"
+ ],
+ [
+ "ex",
+ "exist"
+ ],
+ [
+ "exa",
+ "example"
+ ],
+ [
+ "in",
+ "include"
+ ],
+ [
+ "si",
+ "switches"
+ ],
+ [
+ "stae",
+ "statement"
+ ]
+ ]
+ },
+ "buffers":
+ [
+ {
+ "file": "MetaCode.g4",
+ "settings":
+ {
+ "buffer_size": 2180,
+ "line_ending": "Windows"
+ }
+ },
+ {
+ "file": "example.txt",
+ "settings":
+ {
+ "buffer_size": 388,
+ "line_ending": "Windows"
+ }
+ },
+ {
+ "file": "/E/Development/Projects/MetaCode/prototype/macro.meta",
+ "settings":
+ {
+ "buffer_size": 583,
+ "line_ending": "Windows"
+ }
+ },
+ {
+ "file": "MetaCodeLexer.g4",
+ "settings":
+ {
+ "buffer_size": 238,
+ "line_ending": "Windows"
+ }
+ },
+ {
+ "file": "run.rb",
+ "settings":
+ {
+ "buffer_size": 378,
+ "line_ending": "Windows"
+ }
+ }
+ ],
+ "build_system": "",
+ "command_palette":
+ {
+ "height": 58.0,
+ "selected_items":
+ [
+ [
+ "install",
+ "Package Control: Install Package"
+ ],
+ [
+ "antlr",
+ "Set Syntax: Antlr"
+ ],
+ [
+ "package",
+ "Package Control: Install Package"
+ ]
+ ],
+ "width": 472.0
+ },
+ "console":
+ {
+ "height": 146.0,
+ "history":
+ [
+ "system(\"dir\")",
+ "system('dir')",
+ "dir",
+ "import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)"
+ ]
+ },
+ "distraction_free":
+ {
+ "menu_visible": true,
+ "show_minimap": false,
+ "show_open_files": false,
+ "show_tabs": false,
+ "side_bar_visible": false,
+ "status_bar_visible": false
+ },
+ "file_history":
+ [
+ "/E/Development/Projects/MetaCode/grammar/MetaCodeLexer.",
+ "/E/Development/Projects/MetaCode/grammar/metacode.sublime-project",
+ "/E/Development/Projects/MetaCode/grammar/example.txt",
+ "/E/Development/Projects/MetaCode/grammar/MetaCode.g4",
+ "/C/Scripts/antlr4.rb",
+ "/E/Development/Projects/antlr/Calculator/example.txt",
+ "/E/Development/Projects/antlr/Calculator/Calculator.g4",
+ "/E/Development/Projects/antlr/Calculator/run.rb",
+ "/C/Scripts/grun.bat",
+ "/E/Development/Projects/antlr/Json/Json.g4",
+ "/E/Development/Projects/antlr/Meta/examples/macro.meta",
+ "/E/Development/Projects/antlr/Json/json.sublime-project",
+ "/E/Development/Projects/antlr/Json/run.rb",
+ "/E/Development/Projects/antlr/Json/example.txt",
+ "/E/Development/Projects/antlr/Json/JsonParser.java",
+ "/E/Development/Projects/antlr/ArrayInit/ArrayInit.g4",
+ "/E/Development/Projects/antlr/Expr/Expr.g4",
+ "/E/Development/Projects/antlr/Expr/ExprLexerRules.g4",
+ "/E/Development/Projects/antlr/Expr/run.bat",
+ "/E/Development/Projects/antlr/Expr/example.expr",
+ "/E/Development/Projects/antlr/Expr/example.txt",
+ "/E/Development/Projects/antlr/Expr/run.rb",
+ "/E/E-Books/ANTLR/antlr4.bat",
+ "/C/Program Files (x86)/scripts/antlr4.bat",
+ "/E/Development/Projects/antlr/Expr/ExprLexerRules",
+ "/E/Development/Projects/antlr/ArrayInit/example.txt",
+ "/E/Development/Projects/antlr/ArrayInit/run.bat",
+ "/E/Development/Projects/antlr/Fuzzy/example.txt",
+ "/E/Development/Projects/antlr/Fuzzy/Fuzzy.g4",
+ "/E/Development/Projects/antlr/FuzzyJava/FuzzyJava.g4",
+ "/E/Development/Projects/antlr/antlr4.bat",
+ "/E/Development/Projects/antlr/Hello.g4",
+ "/E/Development/Projects/antlr/grun.bat",
+ "/E/Development/Libraries/ANTLR/grun.bat"
+ ],
+ "find":
+ {
+ "height": 23.0
+ },
+ "find_in_files":
+ {
+ "height": 0.0,
+ "where_history":
+ [
+ ]
+ },
+ "find_state":
+ {
+ "case_sensitive": false,
+ "find_history":
+ [
+ "SKIP",
+ "foreachExpression",
+ "ADD"
+ ],
+ "highlight": true,
+ "in_selection": false,
+ "preserve_case": false,
+ "regex": false,
+ "replace_history":
+ [
+ ],
+ "reverse": false,
+ "show_context": true,
+ "use_buffer2": true,
+ "whole_word": false,
+ "wrap": true
+ },
+ "groups":
+ [
+ {
+ "selected": 0,
+ "sheets":
+ [
+ {
+ "buffer": 0,
+ "file": "MetaCode.g4",
+ "semi_transient": false,
+ "settings":
+ {
+ "buffer_size": 2180,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 1061,
+ 1061
+ ]
+ ],
+ "settings":
+ {
+ "syntax": "Packages/ANTLR syntax highlight/Antlr.tmLanguage",
+ "translate_tabs_to_spaces": false
+ },
+ "translation.x": 0.0,
+ "translation.y": 1800.0,
+ "zoom_level": 1.0
+ },
+ "stack_index": 0,
+ "type": "text"
+ },
+ {
+ "buffer": 1,
+ "file": "example.txt",
+ "semi_transient": false,
+ "settings":
+ {
+ "buffer_size": 388,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 369,
+ 369
+ ]
+ ],
+ "settings":
+ {
+ "syntax": "Packages/Text/Plain text.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "stack_index": 1,
+ "type": "text"
+ },
+ {
+ "buffer": 2,
+ "file": "/E/Development/Projects/MetaCode/prototype/macro.meta",
+ "semi_transient": false,
+ "settings":
+ {
+ "buffer_size": 583,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 583,
+ 583
+ ]
+ ],
+ "settings":
+ {
+ "syntax": "Packages/Text/Plain text.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "stack_index": 3,
+ "type": "text"
+ },
+ {
+ "buffer": 3,
+ "file": "MetaCodeLexer.g4",
+ "semi_transient": false,
+ "settings":
+ {
+ "buffer_size": 238,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 28,
+ 28
+ ]
+ ],
+ "settings":
+ {
+ "syntax": "Packages/ANTLR syntax highlight/Antlr.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "stack_index": 4,
+ "type": "text"
+ },
+ {
+ "buffer": 4,
+ "file": "run.rb",
+ "semi_transient": false,
+ "settings":
+ {
+ "buffer_size": 378,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 378,
+ 378
+ ]
+ ],
+ "settings":
+ {
+ "syntax": "Packages/Ruby/Ruby.tmLanguage",
+ "tab_size": 4,
+ "translate_tabs_to_spaces": true
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "stack_index": 2,
+ "type": "text"
+ }
+ ]
+ }
+ ],
+ "incremental_find":
+ {
+ "height": 23.0
+ },
+ "input":
+ {
+ "height": 0.0
+ },
+ "layout":
+ {
+ "cells":
+ [
+ [
+ 0,
+ 0,
+ 1,
+ 1
+ ]
+ ],
+ "cols":
+ [
+ 0.0,
+ 1.0
+ ],
+ "rows":
+ [
+ 0.0,
+ 1.0
+ ]
+ },
+ "menu_visible": true,
+ "output.find_results":
+ {
+ "height": 0.0
+ },
+ "project": "metacode.sublime-project",
+ "replace":
+ {
+ "height": 42.0
+ },
+ "save_all_on_build": true,
+ "select_file":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "select_project":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "select_symbol":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "settings":
+ {
+ },
+ "show_minimap": true,
+ "show_open_files": true,
+ "show_tabs": true,
+ "side_bar_visible": false,
+ "side_bar_width": 150.0,
+ "status_bar_visible": true,
+ "template_settings":
+ {
+ }
+}
diff --git a/grammar-imperative/run.rb b/grammar-imperative/run.rb
new file mode 100644
index 0000000..e637d19
--- /dev/null
+++ b/grammar-imperative/run.rb
@@ -0,0 +1,11 @@
+ example = if ARGV[0].nil?
+ File.open("example.txt", "w") if not File.exist?("example.txt")
+ "example.txt"
+ else
+ ARGV[0].to_s
+ end
+ puts "Running Imperative parser ..."
+ Dir.mkdir("src") if not Dir.exists? "src"
+ Dir.chdir("src")
+ system('call antlr4 "../Imperative.g4" -visitor')
+ system('call grun Imperative init -gui ..\\' + example)
diff --git a/grammar-imperative/src/Imperative.tokens b/grammar-imperative/src/Imperative.tokens
new file mode 100644
index 0000000..5e0d877
--- /dev/null
+++ b/grammar-imperative/src/Imperative.tokens
@@ -0,0 +1,54 @@
+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
diff --git a/grammar-imperative/src/ImperativeBaseListener.class b/grammar-imperative/src/ImperativeBaseListener.class
new file mode 100644
index 0000000..0a5c2da
Binary files /dev/null and b/grammar-imperative/src/ImperativeBaseListener.class differ
diff --git a/grammar-imperative/src/ImperativeBaseListener.java b/grammar-imperative/src/ImperativeBaseListener.java
new file mode 100644
index 0000000..bd244d7
--- /dev/null
+++ b/grammar-imperative/src/ImperativeBaseListener.java
@@ -0,0 +1,168 @@
+// Generated from ../Imperative.g4 by ANTLR 4.1
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+
+/**
+ * This class provides an empty implementation of {@link ImperativeListener},
+ * which can be extended to create a listener which only needs to handle a subset
+ * of the available methods.
+ */
+public class ImperativeBaseListener implements ImperativeListener {
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterExpression(@NotNull ImperativeParser.ExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitExpression(@NotNull ImperativeParser.ExpressionContext 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}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterAssignment(@NotNull ImperativeParser.AssignmentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitAssignment(@NotNull ImperativeParser.AssignmentContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterConstant(@NotNull ImperativeParser.ConstantContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitConstant(@NotNull ImperativeParser.ConstantContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLoopStatement(@NotNull ImperativeParser.LoopStatementContext 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 enterActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitActualParameters(@NotNull ImperativeParser.ActualParametersContext 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 enterEveryRule(@NotNull ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitEveryRule(@NotNull ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void visitTerminal(@NotNull TerminalNode node) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void visitErrorNode(@NotNull ErrorNode node) { }
+}
\ No newline at end of file
diff --git a/grammar-imperative/src/ImperativeBaseVisitor.class b/grammar-imperative/src/ImperativeBaseVisitor.class
new file mode 100644
index 0000000..adb4c57
Binary files /dev/null and b/grammar-imperative/src/ImperativeBaseVisitor.class differ
diff --git a/grammar-imperative/src/ImperativeBaseVisitor.java b/grammar-imperative/src/ImperativeBaseVisitor.java
new file mode 100644
index 0000000..336878d
--- /dev/null
+++ b/grammar-imperative/src/ImperativeBaseVisitor.java
@@ -0,0 +1,93 @@
+// Generated from ../Imperative.g4 by ANTLR 4.1
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
+
+/**
+ * This class provides an empty implementation of {@link ImperativeVisitor},
+ * which can be extended to create a visitor which only needs to handle a subset
+ * of the available methods.
+ *
+ * @param The return type of the visit operation. Use {@link Void} for
+ * operations with no return type.
+ */
+public class ImperativeBaseVisitor extends AbstractParseTreeVisitor implements ImperativeVisitor {
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitExpression(@NotNull ImperativeParser.ExpressionContext 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}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitAssignment(@NotNull ImperativeParser.AssignmentContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitConstant(@NotNull ImperativeParser.ConstantContext ctx) { return visitChildren(ctx); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code 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 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 visitActualParameters(@NotNull ImperativeParser.ActualParametersContext 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); }
+}
\ No newline at end of file
diff --git a/grammar-imperative/src/ImperativeLexer.class b/grammar-imperative/src/ImperativeLexer.class
new file mode 100644
index 0000000..019828f
Binary files /dev/null and b/grammar-imperative/src/ImperativeLexer.class differ
diff --git a/grammar-imperative/src/ImperativeLexer.java b/grammar-imperative/src/ImperativeLexer.java
new file mode 100644
index 0000000..88474ee
--- /dev/null
+++ b/grammar-imperative/src/ImperativeLexer.java
@@ -0,0 +1,149 @@
+// Generated from ../Imperative.g4 by ANTLR 4.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"})
+public class ImperativeLexer extends Lexer {
+ protected static final DFA[] _decisionToDFA;
+ 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;
+ 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"
+ };
+ 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"
+ };
+
+
+ public ImperativeLexer(CharStream input) {
+ super(input);
+ _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+
+ @Override
+ public String getGrammarFileName() { return "Imperative.g4"; }
+
+ @Override
+ public String[] getTokenNames() { return tokenNames; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String[] getModeNames() { return modeNames; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ @Override
+ public void action(RuleContext _localctx, int ruleIndex, int actionIndex) {
+ switch (ruleIndex) {
+ case 28: WHITESPACE_action((RuleContext)_localctx, actionIndex); break;
+
+ case 29: NEW_LINE_action((RuleContext)_localctx, actionIndex); break;
+ }
+ }
+ private void WHITESPACE_action(RuleContext _localctx, int actionIndex) {
+ switch (actionIndex) {
+ case 0: skip(); break;
+ }
+ }
+ private void NEW_LINE_action(RuleContext _localctx, int actionIndex) {
+ switch (actionIndex) {
+ case 1: skip(); break;
+ }
+ }
+
+ public static final String _serializedATN =
+ "\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\2 \u00c5\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";
+ public static final ATN _ATN =
+ ATNSimulator.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/grammar-imperative/src/ImperativeLexer.tokens b/grammar-imperative/src/ImperativeLexer.tokens
new file mode 100644
index 0000000..5e0d877
--- /dev/null
+++ b/grammar-imperative/src/ImperativeLexer.tokens
@@ -0,0 +1,54 @@
+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
diff --git a/grammar-imperative/src/ImperativeListener.class b/grammar-imperative/src/ImperativeListener.class
new file mode 100644
index 0000000..79509c7
Binary files /dev/null and b/grammar-imperative/src/ImperativeListener.class differ
diff --git a/grammar-imperative/src/ImperativeListener.java b/grammar-imperative/src/ImperativeListener.java
new file mode 100644
index 0000000..e886c54
--- /dev/null
+++ b/grammar-imperative/src/ImperativeListener.java
@@ -0,0 +1,119 @@
+// Generated from ../Imperative.g4 by ANTLR 4.1
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.tree.ParseTreeListener;
+
+/**
+ * This interface defines a complete listener for a parse tree produced by
+ * {@link ImperativeParser}.
+ */
+public interface ImperativeListener extends ParseTreeListener {
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#expression}.
+ * @param ctx the parse tree
+ */
+ void enterExpression(@NotNull ImperativeParser.ExpressionContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#expression}.
+ * @param ctx the parse tree
+ */
+ void exitExpression(@NotNull ImperativeParser.ExpressionContext 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#functionCall}.
+ * @param ctx the parse tree
+ */
+ void enterFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#functionCall}.
+ * @param ctx the parse tree
+ */
+ void exitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#assignment}.
+ * @param ctx the parse tree
+ */
+ void enterAssignment(@NotNull ImperativeParser.AssignmentContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#assignment}.
+ * @param ctx the parse tree
+ */
+ void exitAssignment(@NotNull ImperativeParser.AssignmentContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#constant}.
+ * @param ctx the parse tree
+ */
+ void enterConstant(@NotNull ImperativeParser.ConstantContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#constant}.
+ * @param ctx the parse tree
+ */
+ void exitConstant(@NotNull ImperativeParser.ConstantContext ctx);
+
+ /**
+ * Enter a parse tree produced by {@link ImperativeParser#loopStatement}.
+ * @param ctx the parse tree
+ */
+ void enterLoopStatement(@NotNull ImperativeParser.LoopStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#loopStatement}.
+ * @param ctx the parse tree
+ */
+ void exitLoopStatement(@NotNull ImperativeParser.LoopStatementContext 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#actualParameters}.
+ * @param ctx the parse tree
+ */
+ void enterActualParameters(@NotNull ImperativeParser.ActualParametersContext ctx);
+ /**
+ * Exit a parse tree produced by {@link ImperativeParser#actualParameters}.
+ * @param ctx the parse tree
+ */
+ void exitActualParameters(@NotNull ImperativeParser.ActualParametersContext 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);
+}
\ No newline at end of file
diff --git a/grammar-imperative/src/ImperativeParser$ActualParametersContext.class b/grammar-imperative/src/ImperativeParser$ActualParametersContext.class
new file mode 100644
index 0000000..b8f8767
Binary files /dev/null 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
new file mode 100644
index 0000000..7b832ec
Binary files /dev/null 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
new file mode 100644
index 0000000..07c3f21
Binary files /dev/null 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
new file mode 100644
index 0000000..22b8db6
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$ExpressionContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$FunctionCallContext.class b/grammar-imperative/src/ImperativeParser$FunctionCallContext.class
new file mode 100644
index 0000000..7ad3ee1
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$FunctionCallContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$IfStatementContext.class b/grammar-imperative/src/ImperativeParser$IfStatementContext.class
new file mode 100644
index 0000000..4185ded
Binary files /dev/null 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
new file mode 100644
index 0000000..cf00bbd
Binary files /dev/null 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
new file mode 100644
index 0000000..bc0b31e
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$LoopStatementContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser$SkipContext.class b/grammar-imperative/src/ImperativeParser$SkipContext.class
new file mode 100644
index 0000000..b0a7c0b
Binary files /dev/null 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
new file mode 100644
index 0000000..6a270a6
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser$StatementContext.class differ
diff --git a/grammar-imperative/src/ImperativeParser.class b/grammar-imperative/src/ImperativeParser.class
new file mode 100644
index 0000000..e9d1d63
Binary files /dev/null and b/grammar-imperative/src/ImperativeParser.class differ
diff --git a/grammar-imperative/src/ImperativeParser.java b/grammar-imperative/src/ImperativeParser.java
new file mode 100644
index 0000000..43663b2
--- /dev/null
+++ b/grammar-imperative/src/ImperativeParser.java
@@ -0,0 +1,746 @@
+// Generated from ../Imperative.g4 by ANTLR 4.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"})
+public class ImperativeParser extends Parser {
+ protected static final DFA[] _decisionToDFA;
+ 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;
+ public static final String[] tokenNames = {
+ "", "'do'", "'loop'", "'endif'", "')'", "','", "'+'", "'-'",
+ "'*'", "'or'", "'not'", "'('", "'if'", "'<'", "'!='", "'<='", "'>'", "'and'",
+ "':='", "'then'", "'/'", "'=='", "'skip'", "'>='", "'end'", "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;
+ public static final String[] ruleNames = {
+ "init", "statement", "skip", "assignment", "ifStatement", "loopStatement",
+ "functionCall", "actualParameters", "expression", "constant"
+ };
+
+ @Override
+ public String getGrammarFileName() { return "Imperative.g4"; }
+
+ @Override
+ public String[] getTokenNames() { return tokenNames; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public ImperativeParser(TokenStream input) {
+ super(input);
+ _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+ public static class InitContext extends ParserRuleContext {
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public InitContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_init; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterInit(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitInit(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitInit(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final InitContext init() throws RecognitionException {
+ InitContext _localctx = new InitContext(_ctx, getState());
+ enterRule(_localctx, 0, RULE_init);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(21);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ do {
+ {
+ {
+ setState(20); statement();
+ }
+ }
+ setState(23);
+ _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) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class StatementContext extends ParserRuleContext {
+ public SkipContext skip() {
+ return getRuleContext(SkipContext.class,0);
+ }
+ public IfStatementContext ifStatement() {
+ return getRuleContext(IfStatementContext.class,0);
+ }
+ public FunctionCallContext functionCall() {
+ return getRuleContext(FunctionCallContext.class,0);
+ }
+ public AssignmentContext assignment() {
+ return getRuleContext(AssignmentContext.class,0);
+ }
+ public LoopStatementContext loopStatement() {
+ return getRuleContext(LoopStatementContext.class,0);
+ }
+ public StatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_statement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final StatementContext statement() throws RecognitionException {
+ StatementContext _localctx = new StatementContext(_ctx, getState());
+ enterRule(_localctx, 2, RULE_statement);
+ try {
+ setState(30);
+ switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
+ case 1:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(25); skip();
+ }
+ break;
+
+ case 2:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(26); assignment();
+ }
+ break;
+
+ case 3:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(27); functionCall();
+ }
+ break;
+
+ case 4:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(28); ifStatement();
+ }
+ break;
+
+ case 5:
+ enterOuterAlt(_localctx, 5);
+ {
+ setState(29); loopStatement();
+ }
+ break;
+ }
+ }
+ 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);
+ }
+ @Override public int getRuleIndex() { return RULE_skip; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterSkip(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitSkip(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitSkip(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final SkipContext skip() throws RecognitionException {
+ SkipContext _localctx = new SkipContext(_ctx, getState());
+ enterRule(_localctx, 4, RULE_skip);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(32); match(22);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class AssignmentContext extends ParserRuleContext {
+ public TerminalNode ID() { return getToken(ImperativeParser.ID, 0); }
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public AssignmentContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_assignment; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterAssignment(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitAssignment(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitAssignment(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final AssignmentContext assignment() throws RecognitionException {
+ AssignmentContext _localctx = new AssignmentContext(_ctx, getState());
+ enterRule(_localctx, 6, RULE_assignment);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(34); match(ID);
+ setState(35); match(18);
+ setState(36); expression(0);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ 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 IfStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_ifStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterIfStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitIfStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitIfStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final IfStatementContext ifStatement() throws RecognitionException {
+ IfStatementContext _localctx = new IfStatementContext(_ctx, getState());
+ enterRule(_localctx, 8, RULE_ifStatement);
+ int _la;
+ 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);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ 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 LoopStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_loopStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterLoopStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitLoopStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitLoopStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final LoopStatementContext loopStatement() throws RecognitionException {
+ LoopStatementContext _localctx = new LoopStatementContext(_ctx, getState());
+ enterRule(_localctx, 10, RULE_loopStatement);
+ int _la;
+ 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);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class FunctionCallContext extends ParserRuleContext {
+ public ActualParametersContext actualParameters() {
+ return getRuleContext(ActualParametersContext.class,0);
+ }
+ public TerminalNode ID() { return getToken(ImperativeParser.ID, 0); }
+ public FunctionCallContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_functionCall; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterFunctionCall(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitFunctionCall(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitFunctionCall(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final FunctionCallContext functionCall() throws RecognitionException {
+ FunctionCallContext _localctx = new FunctionCallContext(_ctx, getState());
+ enterRule(_localctx, 12, RULE_functionCall);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(63); match(ID);
+ setState(64); match(11);
+ setState(65); actualParameters();
+ setState(66); match(4);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class ActualParametersContext extends ParserRuleContext {
+ public ExpressionContext expression(int i) {
+ return getRuleContext(ExpressionContext.class,i);
+ }
+ public List expression() {
+ return getRuleContexts(ExpressionContext.class);
+ }
+ public ActualParametersContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_actualParameters; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterActualParameters(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitActualParameters(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitActualParameters(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ActualParametersContext actualParameters() throws RecognitionException {
+ ActualParametersContext _localctx = new ActualParametersContext(_ctx, getState());
+ enterRule(_localctx, 14, RULE_actualParameters);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(68); expression(0);
+ setState(73);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==5) {
+ {
+ {
+ setState(69); match(5);
+ setState(70); expression(0);
+ }
+ }
+ setState(75);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class ExpressionContext extends ParserRuleContext {
+ public int _p;
+ public ExpressionContext expression(int i) {
+ return getRuleContext(ExpressionContext.class,i);
+ }
+ public FunctionCallContext functionCall() {
+ return getRuleContext(FunctionCallContext.class,0);
+ }
+ public TerminalNode ID() { return getToken(ImperativeParser.ID, 0); }
+ public List expression() {
+ return getRuleContexts(ExpressionContext.class);
+ }
+ public ConstantContext constant() {
+ return getRuleContext(ConstantContext.class,0);
+ }
+ public ExpressionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); }
+ public ExpressionContext(ParserRuleContext parent, int invokingState, int _p) {
+ super(parent, invokingState);
+ this._p = _p;
+ }
+ @Override public int getRuleIndex() { return RULE_expression; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterExpression(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitExpression(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitExpression(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ExpressionContext expression(int _p) throws RecognitionException {
+ ParserRuleContext _parentctx = _ctx;
+ int _parentState = getState();
+ ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState, _p);
+ ExpressionContext _prevctx = _localctx;
+ int _startState = 16;
+ enterRecursionRule(_localctx, RULE_expression);
+ int _la;
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(82);
+ switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
+ case 1:
+ {
+ setState(77);
+ _la = _input.LA(1);
+ if ( !(_la==7 || _la==10) ) {
+ _errHandler.recoverInline(this);
+ }
+ consume();
+ setState(78); expression(2);
+ }
+ break;
+
+ case 2:
+ {
+ setState(79); constant();
+ }
+ break;
+
+ case 3:
+ {
+ setState(80); match(ID);
+ }
+ break;
+
+ case 4:
+ {
+ setState(81); functionCall();
+ }
+ break;
+ }
+ _ctx.stop = _input.LT(-1);
+ setState(89);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,6,_ctx);
+ while ( _alt!=2 && _alt!=-1 ) {
+ if ( _alt==1 ) {
+ if ( _parseListeners!=null ) triggerExitRuleEvent();
+ _prevctx = _localctx;
+ {
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState, _p);
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(84);
+ if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p");
+ setState(85);
+ _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)) ) {
+ _errHandler.recoverInline(this);
+ }
+ consume();
+ setState(86); expression(2);
+ }
+ }
+ }
+ setState(91);
+ _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;
+ }
+
+ public static class ConstantContext extends ParserRuleContext {
+ public TerminalNode BOOLEAN() { return getToken(ImperativeParser.BOOLEAN, 0); }
+ public TerminalNode NUMBER() { return getToken(ImperativeParser.NUMBER, 0); }
+ public TerminalNode STRING() { return getToken(ImperativeParser.STRING, 0); }
+ public ConstantContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_constant; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).enterConstant(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof ImperativeListener ) ((ImperativeListener)listener).exitConstant(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof ImperativeVisitor ) return ((ImperativeVisitor extends T>)visitor).visitConstant(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ConstantContext constant() throws RecognitionException {
+ ConstantContext _localctx = new ConstantContext(_ctx, getState());
+ enterRule(_localctx, 18, RULE_constant);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(92);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BOOLEAN) | (1L << STRING) | (1L << NUMBER))) != 0)) ) {
+ _errHandler.recoverInline(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 8: return expression_sempred((ExpressionContext)_localctx, predIndex);
+ }
+ return true;
+ }
+ private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
+ switch (predIndex) {
+ case 0: return 1 >= _localctx._p;
+ }
+ return true;
+ }
+
+ 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 The return type of the visit operation. Use {@link Void} for
+ * operations with no return type.
+ */
+public interface ImperativeVisitor extends ParseTreeVisitor {
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#expression}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitExpression(@NotNull ImperativeParser.ExpressionContext 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#functionCall}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitFunctionCall(@NotNull ImperativeParser.FunctionCallContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#assignment}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitAssignment(@NotNull ImperativeParser.AssignmentContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#constant}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitConstant(@NotNull ImperativeParser.ConstantContext ctx);
+
+ /**
+ * Visit a parse tree produced by {@link ImperativeParser#loopStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitLoopStatement(@NotNull ImperativeParser.LoopStatementContext 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#actualParameters}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitActualParameters(@NotNull ImperativeParser.ActualParametersContext 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);
+}
\ No newline at end of file