From 0e96e69659c7c31927b7eee5c40d017b035a6471 Mon Sep 17 00:00:00 2001 From: Erik Oosting Date: Mon, 11 Dec 2023 15:25:24 +0100 Subject: Initial commit Adding grammar --- gen/ANFLexer.py | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 gen/ANFLexer.py (limited to 'gen/ANFLexer.py') diff --git a/gen/ANFLexer.py b/gen/ANFLexer.py new file mode 100644 index 0000000..5200e78 --- /dev/null +++ b/gen/ANFLexer.py @@ -0,0 +1,87 @@ +# Generated from /home/erik/PycharmProjects/pythonProject/grammar/ANF.g4 by ANTLR 4.13.1 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,14,82,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2, + 6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13, + 7,13,2,14,7,14,2,15,7,15,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4, + 1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,10,1,10,1,10,1, + 11,1,11,1,11,5,11,62,8,11,10,11,12,11,65,9,11,1,12,4,12,68,8,12, + 11,12,12,12,69,1,13,1,13,1,14,1,14,1,15,4,15,77,8,15,11,15,12,15, + 78,1,15,1,15,0,0,16,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10, + 21,11,23,12,25,13,27,0,29,0,31,14,1,0,2,2,0,65,90,97,122,3,0,9,10, + 13,13,32,32,83,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0, + 9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0, + 19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,31,1,0,0,0,1, + 33,1,0,0,0,3,35,1,0,0,0,5,37,1,0,0,0,7,39,1,0,0,0,9,41,1,0,0,0,11, + 43,1,0,0,0,13,45,1,0,0,0,15,47,1,0,0,0,17,49,1,0,0,0,19,53,1,0,0, + 0,21,55,1,0,0,0,23,58,1,0,0,0,25,67,1,0,0,0,27,71,1,0,0,0,29,73, + 1,0,0,0,31,76,1,0,0,0,33,34,5,43,0,0,34,2,1,0,0,0,35,36,5,45,0,0, + 36,4,1,0,0,0,37,38,5,42,0,0,38,6,1,0,0,0,39,40,5,47,0,0,40,8,1,0, + 0,0,41,42,5,40,0,0,42,10,1,0,0,0,43,44,5,58,0,0,44,12,1,0,0,0,45, + 46,5,41,0,0,46,14,1,0,0,0,47,48,5,44,0,0,48,16,1,0,0,0,49,50,5,108, + 0,0,50,51,5,101,0,0,51,52,5,116,0,0,52,18,1,0,0,0,53,54,5,61,0,0, + 54,20,1,0,0,0,55,56,5,105,0,0,56,57,5,110,0,0,57,22,1,0,0,0,58,63, + 3,27,13,0,59,62,3,27,13,0,60,62,3,29,14,0,61,59,1,0,0,0,61,60,1, + 0,0,0,62,65,1,0,0,0,63,61,1,0,0,0,63,64,1,0,0,0,64,24,1,0,0,0,65, + 63,1,0,0,0,66,68,3,29,14,0,67,66,1,0,0,0,68,69,1,0,0,0,69,67,1,0, + 0,0,69,70,1,0,0,0,70,26,1,0,0,0,71,72,7,0,0,0,72,28,1,0,0,0,73,74, + 2,48,57,0,74,30,1,0,0,0,75,77,7,1,0,0,76,75,1,0,0,0,77,78,1,0,0, + 0,78,76,1,0,0,0,78,79,1,0,0,0,79,80,1,0,0,0,80,81,6,15,0,0,81,32, + 1,0,0,0,5,0,61,63,69,78,1,6,0,0 + ] + +class ANFLexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + T__0 = 1 + T__1 = 2 + T__2 = 3 + T__3 = 4 + T__4 = 5 + T__5 = 6 + T__6 = 7 + T__7 = 8 + T__8 = 9 + T__9 = 10 + T__10 = 11 + IDENT = 12 + NUMBER = 13 + WS = 14 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE" ] + + literalNames = [ "", + "'+'", "'-'", "'*'", "'/'", "'('", "':'", "')'", "','", "'let'", + "'='", "'in'" ] + + symbolicNames = [ "", + "IDENT", "NUMBER", "WS" ] + + ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", + "T__7", "T__8", "T__9", "T__10", "IDENT", "NUMBER", "Letter", + "Digit", "WS" ] + + grammarFileName = "ANF.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.1") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + -- cgit 1.4.1-2-gfad0