diff --git a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/Klang.interp b/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/Klang.interp deleted file mode 100644 index e4cbc42..0000000 --- a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/Klang.interp +++ /dev/null @@ -1,43 +0,0 @@ -token literal names: -null -'print' -'if' -'else' -';' -'{' -'}' -'*' -'+' -'-' -'%' -null -null - -token symbolic names: -null -PRINT -IF -ELSE -SCOL -OBRK -CBRK -MULT -ADD -SUB -MOD -INTEGER_LITERAL -WS - -rule names: -parse -block -braced_block -statement -print -if_statement -expression -atom - - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 14, 70, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 3, 2, 3, 2, 3, 3, 7, 3, 22, 10, 3, 12, 3, 14, 3, 25, 11, 3, 3, 4, 3, 4, 7, 4, 29, 10, 4, 12, 4, 14, 4, 32, 11, 4, 3, 4, 3, 4, 3, 5, 3, 5, 5, 5, 38, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 49, 10, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 66, 10, 8, 3, 9, 3, 9, 3, 9, 2, 2, 10, 2, 4, 6, 8, 10, 12, 14, 16, 2, 3, 3, 2, 10, 11, 2, 69, 2, 18, 3, 2, 2, 2, 4, 23, 3, 2, 2, 2, 6, 26, 3, 2, 2, 2, 8, 37, 3, 2, 2, 2, 10, 39, 3, 2, 2, 2, 12, 43, 3, 2, 2, 2, 14, 65, 3, 2, 2, 2, 16, 67, 3, 2, 2, 2, 18, 19, 5, 4, 3, 2, 19, 3, 3, 2, 2, 2, 20, 22, 5, 8, 5, 2, 21, 20, 3, 2, 2, 2, 22, 25, 3, 2, 2, 2, 23, 21, 3, 2, 2, 2, 23, 24, 3, 2, 2, 2, 24, 5, 3, 2, 2, 2, 25, 23, 3, 2, 2, 2, 26, 30, 7, 7, 2, 2, 27, 29, 5, 8, 5, 2, 28, 27, 3, 2, 2, 2, 29, 32, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 30, 31, 3, 2, 2, 2, 31, 33, 3, 2, 2, 2, 32, 30, 3, 2, 2, 2, 33, 34, 7, 8, 2, 2, 34, 7, 3, 2, 2, 2, 35, 38, 5, 10, 6, 2, 36, 38, 5, 12, 7, 2, 37, 35, 3, 2, 2, 2, 37, 36, 3, 2, 2, 2, 38, 9, 3, 2, 2, 2, 39, 40, 7, 3, 2, 2, 40, 41, 5, 14, 8, 2, 41, 42, 7, 6, 2, 2, 42, 11, 3, 2, 2, 2, 43, 44, 7, 4, 2, 2, 44, 45, 5, 14, 8, 2, 45, 48, 5, 6, 4, 2, 46, 47, 7, 5, 2, 2, 47, 49, 5, 6, 4, 2, 48, 46, 3, 2, 2, 2, 48, 49, 3, 2, 2, 2, 49, 13, 3, 2, 2, 2, 50, 51, 5, 16, 9, 2, 51, 52, 7, 9, 2, 2, 52, 53, 5, 16, 9, 2, 53, 66, 3, 2, 2, 2, 54, 55, 5, 16, 9, 2, 55, 56, 9, 2, 2, 2, 56, 57, 5, 16, 9, 2, 57, 66, 3, 2, 2, 2, 58, 59, 5, 16, 9, 2, 59, 60, 7, 12, 2, 2, 60, 61, 5, 16, 9, 2, 61, 66, 3, 2, 2, 2, 62, 63, 7, 11, 2, 2, 63, 66, 5, 16, 9, 2, 64, 66, 5, 16, 9, 2, 65, 50, 3, 2, 2, 2, 65, 54, 3, 2, 2, 2, 65, 58, 3, 2, 2, 2, 65, 62, 3, 2, 2, 2, 65, 64, 3, 2, 2, 2, 66, 15, 3, 2, 2, 2, 67, 68, 7, 13, 2, 2, 68, 17, 3, 2, 2, 2, 7, 23, 30, 37, 48, 65] \ No newline at end of file diff --git a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/Klang.tokens b/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/Klang.tokens deleted file mode 100644 index bcfa984..0000000 --- a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/Klang.tokens +++ /dev/null @@ -1,22 +0,0 @@ -PRINT=1 -IF=2 -ELSE=3 -SCOL=4 -OBRK=5 -CBRK=6 -MULT=7 -ADD=8 -SUB=9 -MOD=10 -INTEGER_LITERAL=11 -WS=12 -'print'=1 -'if'=2 -'else'=3 -';'=4 -'{'=5 -'}'=6 -'*'=7 -'+'=8 -'-'=9 -'%'=10 diff --git a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.interp b/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.interp deleted file mode 100644 index 74fc623..0000000 --- a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.interp +++ /dev/null @@ -1,53 +0,0 @@ -token literal names: -null -'print' -'if' -'else' -';' -'{' -'}' -'*' -'+' -'-' -'%' -null -null - -token symbolic names: -null -PRINT -IF -ELSE -SCOL -OBRK -CBRK -MULT -ADD -SUB -MOD -INTEGER_LITERAL -WS - -rule names: -PRINT -IF -ELSE -SCOL -OBRK -CBRK -MULT -ADD -SUB -MOD -INTEGER_LITERAL -WS - -channel names: -DEFAULT_TOKEN_CHANNEL -HIDDEN - -mode names: -DEFAULT_MODE - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 14, 64, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 6, 12, 57, 10, 12, 13, 12, 14, 12, 58, 3, 13, 3, 13, 3, 13, 3, 13, 2, 2, 14, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 3, 2, 4, 3, 2, 50, 59, 5, 2, 11, 12, 15, 15, 34, 34, 2, 64, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 3, 27, 3, 2, 2, 2, 5, 33, 3, 2, 2, 2, 7, 36, 3, 2, 2, 2, 9, 41, 3, 2, 2, 2, 11, 43, 3, 2, 2, 2, 13, 45, 3, 2, 2, 2, 15, 47, 3, 2, 2, 2, 17, 49, 3, 2, 2, 2, 19, 51, 3, 2, 2, 2, 21, 53, 3, 2, 2, 2, 23, 56, 3, 2, 2, 2, 25, 60, 3, 2, 2, 2, 27, 28, 7, 114, 2, 2, 28, 29, 7, 116, 2, 2, 29, 30, 7, 107, 2, 2, 30, 31, 7, 112, 2, 2, 31, 32, 7, 118, 2, 2, 32, 4, 3, 2, 2, 2, 33, 34, 7, 107, 2, 2, 34, 35, 7, 104, 2, 2, 35, 6, 3, 2, 2, 2, 36, 37, 7, 103, 2, 2, 37, 38, 7, 110, 2, 2, 38, 39, 7, 117, 2, 2, 39, 40, 7, 103, 2, 2, 40, 8, 3, 2, 2, 2, 41, 42, 7, 61, 2, 2, 42, 10, 3, 2, 2, 2, 43, 44, 7, 125, 2, 2, 44, 12, 3, 2, 2, 2, 45, 46, 7, 127, 2, 2, 46, 14, 3, 2, 2, 2, 47, 48, 7, 44, 2, 2, 48, 16, 3, 2, 2, 2, 49, 50, 7, 45, 2, 2, 50, 18, 3, 2, 2, 2, 51, 52, 7, 47, 2, 2, 52, 20, 3, 2, 2, 2, 53, 54, 7, 39, 2, 2, 54, 22, 3, 2, 2, 2, 55, 57, 9, 2, 2, 2, 56, 55, 3, 2, 2, 2, 57, 58, 3, 2, 2, 2, 58, 56, 3, 2, 2, 2, 58, 59, 3, 2, 2, 2, 59, 24, 3, 2, 2, 2, 60, 61, 9, 3, 2, 2, 61, 62, 3, 2, 2, 2, 62, 63, 8, 13, 2, 2, 63, 26, 3, 2, 2, 2, 4, 2, 58, 3, 8, 2, 2] \ No newline at end of file diff --git a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.java b/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.java deleted file mode 100644 index 327ea28..0000000 --- a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.java +++ /dev/null @@ -1,125 +0,0 @@ -// Generated from /home/nitrix/Development/hsrm/cb/klang/src/main/antlr4/de/hsrm/compiler/Klang/Klang.g4 by ANTLR 4.7.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 KlangLexer extends Lexer { - static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - PRINT=1, IF=2, ELSE=3, SCOL=4, OBRK=5, CBRK=6, MULT=7, ADD=8, SUB=9, MOD=10, - INTEGER_LITERAL=11, WS=12; - public static String[] channelNames = { - "DEFAULT_TOKEN_CHANNEL", "HIDDEN" - }; - - public static String[] modeNames = { - "DEFAULT_MODE" - }; - - public static final String[] ruleNames = { - "PRINT", "IF", "ELSE", "SCOL", "OBRK", "CBRK", "MULT", "ADD", "SUB", "MOD", - "INTEGER_LITERAL", "WS" - }; - - private static final String[] _LITERAL_NAMES = { - null, "'print'", "'if'", "'else'", "';'", "'{'", "'}'", "'*'", "'+'", - "'-'", "'%'" - }; - private static final String[] _SYMBOLIC_NAMES = { - null, "PRINT", "IF", "ELSE", "SCOL", "OBRK", "CBRK", "MULT", "ADD", "SUB", - "MOD", "INTEGER_LITERAL", "WS" - }; - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - - public KlangLexer(CharStream input) { - super(input); - _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - - @Override - public String getGrammarFileName() { return "Klang.g4"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public String[] getChannelNames() { return channelNames; } - - @Override - public String[] getModeNames() { return modeNames; } - - @Override - public ATN getATN() { return _ATN; } - - public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\16@\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\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\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\13\3\13\3\f\6"+ - "\f9\n\f\r\f\16\f:\3\r\3\r\3\r\3\r\2\2\16\3\3\5\4\7\5\t\6\13\7\r\b\17\t"+ - "\21\n\23\13\25\f\27\r\31\16\3\2\4\3\2\62;\5\2\13\f\17\17\"\"\2@\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\3\33\3\2\2\2\5!\3\2\2\2\7$\3\2\2\2\t)\3\2\2\2\13+\3\2\2\2\r-\3"+ - "\2\2\2\17/\3\2\2\2\21\61\3\2\2\2\23\63\3\2\2\2\25\65\3\2\2\2\278\3\2\2"+ - "\2\31<\3\2\2\2\33\34\7r\2\2\34\35\7t\2\2\35\36\7k\2\2\36\37\7p\2\2\37"+ - " \7v\2\2 \4\3\2\2\2!\"\7k\2\2\"#\7h\2\2#\6\3\2\2\2$%\7g\2\2%&\7n\2\2&"+ - "\'\7u\2\2\'(\7g\2\2(\b\3\2\2\2)*\7=\2\2*\n\3\2\2\2+,\7}\2\2,\f\3\2\2\2"+ - "-.\7\177\2\2.\16\3\2\2\2/\60\7,\2\2\60\20\3\2\2\2\61\62\7-\2\2\62\22\3"+ - "\2\2\2\63\64\7/\2\2\64\24\3\2\2\2\65\66\7\'\2\2\66\26\3\2\2\2\679\t\2"+ - "\2\28\67\3\2\2\29:\3\2\2\2:8\3\2\2\2:;\3\2\2\2;\30\3\2\2\2<=\t\3\2\2="+ - ">\3\2\2\2>?\b\r\2\2?\32\3\2\2\2\4\2:\3\b\2\2"; - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } -} \ No newline at end of file diff --git a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.tokens b/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.tokens deleted file mode 100644 index bcfa984..0000000 --- a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangLexer.tokens +++ /dev/null @@ -1,22 +0,0 @@ -PRINT=1 -IF=2 -ELSE=3 -SCOL=4 -OBRK=5 -CBRK=6 -MULT=7 -ADD=8 -SUB=9 -MOD=10 -INTEGER_LITERAL=11 -WS=12 -'print'=1 -'if'=2 -'else'=3 -';'=4 -'{'=5 -'}'=6 -'*'=7 -'+'=8 -'-'=9 -'%'=10 diff --git a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangParser.java b/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangParser.java deleted file mode 100644 index 18b8bfd..0000000 --- a/src/main/antlr4/de/hsrm/compiler/Klang/.antlr/KlangParser.java +++ /dev/null @@ -1,565 +0,0 @@ -// Generated from /home/nitrix/Development/hsrm/cb/klang/src/main/antlr4/de/hsrm/compiler/Klang/Klang.g4 by ANTLR 4.7.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 KlangParser extends Parser { - static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - PRINT=1, IF=2, ELSE=3, SCOL=4, OBRK=5, CBRK=6, MULT=7, ADD=8, SUB=9, MOD=10, - INTEGER_LITERAL=11, WS=12; - public static final int - RULE_parse = 0, RULE_block = 1, RULE_braced_block = 2, RULE_statement = 3, - RULE_print = 4, RULE_if_statement = 5, RULE_expression = 6, RULE_atom = 7; - public static final String[] ruleNames = { - "parse", "block", "braced_block", "statement", "print", "if_statement", - "expression", "atom" - }; - - private static final String[] _LITERAL_NAMES = { - null, "'print'", "'if'", "'else'", "';'", "'{'", "'}'", "'*'", "'+'", - "'-'", "'%'" - }; - private static final String[] _SYMBOLIC_NAMES = { - null, "PRINT", "IF", "ELSE", "SCOL", "OBRK", "CBRK", "MULT", "ADD", "SUB", - "MOD", "INTEGER_LITERAL", "WS" - }; - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - @Override - public String getGrammarFileName() { return "Klang.g4"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public ATN getATN() { return _ATN; } - - public KlangParser(TokenStream input) { - super(input); - _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - public static class ParseContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public ParseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_parse; } - } - - public final ParseContext parse() throws RecognitionException { - ParseContext _localctx = new ParseContext(_ctx, getState()); - enterRule(_localctx, 0, RULE_parse); - try { - enterOuterAlt(_localctx, 1); - { - setState(16); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class BlockContext extends ParserRuleContext { - public List statement() { - return getRuleContexts(StatementContext.class); - } - public StatementContext statement(int i) { - return getRuleContext(StatementContext.class,i); - } - public BlockContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_block; } - } - - public final BlockContext block() throws RecognitionException { - BlockContext _localctx = new BlockContext(_ctx, getState()); - enterRule(_localctx, 2, RULE_block); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(21); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==PRINT || _la==IF) { - { - { - setState(18); - statement(); - } - } - setState(23); - _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 Braced_blockContext extends ParserRuleContext { - public TerminalNode OBRK() { return getToken(KlangParser.OBRK, 0); } - public TerminalNode CBRK() { return getToken(KlangParser.CBRK, 0); } - public List statement() { - return getRuleContexts(StatementContext.class); - } - public StatementContext statement(int i) { - return getRuleContext(StatementContext.class,i); - } - public Braced_blockContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_braced_block; } - } - - public final Braced_blockContext braced_block() throws RecognitionException { - Braced_blockContext _localctx = new Braced_blockContext(_ctx, getState()); - enterRule(_localctx, 4, RULE_braced_block); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(24); - match(OBRK); - setState(28); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==PRINT || _la==IF) { - { - { - setState(25); - statement(); - } - } - setState(30); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(31); - match(CBRK); - } - } - 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 PrintContext print() { - return getRuleContext(PrintContext.class,0); - } - public If_statementContext if_statement() { - return getRuleContext(If_statementContext.class,0); - } - public StatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statement; } - } - - public final StatementContext statement() throws RecognitionException { - StatementContext _localctx = new StatementContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_statement); - try { - setState(35); - _errHandler.sync(this); - switch (_input.LA(1)) { - case PRINT: - enterOuterAlt(_localctx, 1); - { - setState(33); - print(); - } - break; - case IF: - enterOuterAlt(_localctx, 2); - { - setState(34); - if_statement(); - } - 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 PrintContext extends ParserRuleContext { - public TerminalNode PRINT() { return getToken(KlangParser.PRINT, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode SCOL() { return getToken(KlangParser.SCOL, 0); } - public PrintContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_print; } - } - - public final PrintContext print() throws RecognitionException { - PrintContext _localctx = new PrintContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_print); - try { - enterOuterAlt(_localctx, 1); - { - setState(37); - match(PRINT); - setState(38); - expression(); - setState(39); - match(SCOL); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class If_statementContext extends ParserRuleContext { - public TerminalNode IF() { return getToken(KlangParser.IF, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public List braced_block() { - return getRuleContexts(Braced_blockContext.class); - } - public Braced_blockContext braced_block(int i) { - return getRuleContext(Braced_blockContext.class,i); - } - public TerminalNode ELSE() { return getToken(KlangParser.ELSE, 0); } - public If_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_if_statement; } - } - - public final If_statementContext if_statement() throws RecognitionException { - If_statementContext _localctx = new If_statementContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_if_statement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(41); - match(IF); - setState(42); - expression(); - setState(43); - braced_block(); - setState(46); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ELSE) { - { - setState(44); - match(ELSE); - setState(45); - braced_block(); - } - } - - } - } - 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 ExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_expression; } - - public ExpressionContext() { } - public void copyFrom(ExpressionContext ctx) { - super.copyFrom(ctx); - } - } - public static class AdditiveExpressionContext extends ExpressionContext { - public Token op; - public List atom() { - return getRuleContexts(AtomContext.class); - } - public AtomContext atom(int i) { - return getRuleContext(AtomContext.class,i); - } - public TerminalNode ADD() { return getToken(KlangParser.ADD, 0); } - public TerminalNode SUB() { return getToken(KlangParser.SUB, 0); } - public AdditiveExpressionContext(ExpressionContext ctx) { copyFrom(ctx); } - } - public static class ModuloExpressionContext extends ExpressionContext { - public List atom() { - return getRuleContexts(AtomContext.class); - } - public AtomContext atom(int i) { - return getRuleContext(AtomContext.class,i); - } - public TerminalNode MOD() { return getToken(KlangParser.MOD, 0); } - public ModuloExpressionContext(ExpressionContext ctx) { copyFrom(ctx); } - } - public static class UnaryNegateExpressionContext extends ExpressionContext { - public TerminalNode SUB() { return getToken(KlangParser.SUB, 0); } - public AtomContext atom() { - return getRuleContext(AtomContext.class,0); - } - public UnaryNegateExpressionContext(ExpressionContext ctx) { copyFrom(ctx); } - } - public static class AtomExpressionContext extends ExpressionContext { - public AtomContext atom() { - return getRuleContext(AtomContext.class,0); - } - public AtomExpressionContext(ExpressionContext ctx) { copyFrom(ctx); } - } - public static class MultiplicationExpressionContext extends ExpressionContext { - public List atom() { - return getRuleContexts(AtomContext.class); - } - public AtomContext atom(int i) { - return getRuleContext(AtomContext.class,i); - } - public TerminalNode MULT() { return getToken(KlangParser.MULT, 0); } - public MultiplicationExpressionContext(ExpressionContext ctx) { copyFrom(ctx); } - } - - public final ExpressionContext expression() throws RecognitionException { - ExpressionContext _localctx = new ExpressionContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_expression); - int _la; - try { - setState(63); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) { - case 1: - _localctx = new MultiplicationExpressionContext(_localctx); - enterOuterAlt(_localctx, 1); - { - setState(48); - atom(); - setState(49); - match(MULT); - setState(50); - atom(); - } - break; - case 2: - _localctx = new AdditiveExpressionContext(_localctx); - enterOuterAlt(_localctx, 2); - { - setState(52); - atom(); - setState(53); - ((AdditiveExpressionContext)_localctx).op = _input.LT(1); - _la = _input.LA(1); - if ( !(_la==ADD || _la==SUB) ) { - ((AdditiveExpressionContext)_localctx).op = (Token)_errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(54); - atom(); - } - break; - case 3: - _localctx = new ModuloExpressionContext(_localctx); - enterOuterAlt(_localctx, 3); - { - setState(56); - atom(); - setState(57); - match(MOD); - setState(58); - atom(); - } - break; - case 4: - _localctx = new UnaryNegateExpressionContext(_localctx); - enterOuterAlt(_localctx, 4); - { - setState(60); - match(SUB); - setState(61); - atom(); - } - break; - case 5: - _localctx = new AtomExpressionContext(_localctx); - enterOuterAlt(_localctx, 5); - { - setState(62); - atom(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class AtomContext extends ParserRuleContext { - public AtomContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_atom; } - - public AtomContext() { } - public void copyFrom(AtomContext ctx) { - super.copyFrom(ctx); - } - } - public static class IntAtomContext extends AtomContext { - public TerminalNode INTEGER_LITERAL() { return getToken(KlangParser.INTEGER_LITERAL, 0); } - public IntAtomContext(AtomContext ctx) { copyFrom(ctx); } - } - - public final AtomContext atom() throws RecognitionException { - AtomContext _localctx = new AtomContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_atom); - try { - _localctx = new IntAtomContext(_localctx); - enterOuterAlt(_localctx, 1); - { - setState(65); - match(INTEGER_LITERAL); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\16F\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\3\2\3\2\3\3\7\3\26"+ - "\n\3\f\3\16\3\31\13\3\3\4\3\4\7\4\35\n\4\f\4\16\4 \13\4\3\4\3\4\3\5\3"+ - "\5\5\5&\n\5\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\5\7\61\n\7\3\b\3\b\3\b"+ - "\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\5\bB\n\b\3\t\3\t\3\t"+ - "\2\2\n\2\4\6\b\n\f\16\20\2\3\3\2\n\13\2E\2\22\3\2\2\2\4\27\3\2\2\2\6\32"+ - "\3\2\2\2\b%\3\2\2\2\n\'\3\2\2\2\f+\3\2\2\2\16A\3\2\2\2\20C\3\2\2\2\22"+ - "\23\5\4\3\2\23\3\3\2\2\2\24\26\5\b\5\2\25\24\3\2\2\2\26\31\3\2\2\2\27"+ - "\25\3\2\2\2\27\30\3\2\2\2\30\5\3\2\2\2\31\27\3\2\2\2\32\36\7\7\2\2\33"+ - "\35\5\b\5\2\34\33\3\2\2\2\35 \3\2\2\2\36\34\3\2\2\2\36\37\3\2\2\2\37!"+ - "\3\2\2\2 \36\3\2\2\2!\"\7\b\2\2\"\7\3\2\2\2#&\5\n\6\2$&\5\f\7\2%#\3\2"+ - "\2\2%$\3\2\2\2&\t\3\2\2\2\'(\7\3\2\2()\5\16\b\2)*\7\6\2\2*\13\3\2\2\2"+ - "+,\7\4\2\2,-\5\16\b\2-\60\5\6\4\2./\7\5\2\2/\61\5\6\4\2\60.\3\2\2\2\60"+ - "\61\3\2\2\2\61\r\3\2\2\2\62\63\5\20\t\2\63\64\7\t\2\2\64\65\5\20\t\2\65"+ - "B\3\2\2\2\66\67\5\20\t\2\678\t\2\2\289\5\20\t\29B\3\2\2\2:;\5\20\t\2;"+ - "<\7\f\2\2<=\5\20\t\2=B\3\2\2\2>?\7\13\2\2?B\5\20\t\2@B\5\20\t\2A\62\3"+ - "\2\2\2A\66\3\2\2\2A:\3\2\2\2A>\3\2\2\2A@\3\2\2\2B\17\3\2\2\2CD\7\r\2\2"+ - "D\21\3\2\2\2\7\27\36%\60A"; - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } -} \ No newline at end of file