<reponame>hrjakobsen/piste
# Generated from /home/mathias/gitrepos/piste/compiler/piste.g4 by ANTLR 4.9.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\66")
        buf.write("\u0153\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\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")
        buf.write("\t\16\4\17\t\17\3\2\7\2 \n\2\f\2\16\2#\13\2\3\2\7\2&\n")
        buf.write("\2\f\2\16\2)\13\2\3\2\5\2,\n\2\3\3\3\3\3\3\3\4\3\4\3\4")
        buf.write("\5\4\64\n\4\3\5\3\5\3\5\3\5\3\5\3\5\7\5<\n\5\f\5\16\5")
        buf.write("?\13\5\5\5A\n\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3")
        buf.write("\6\7\6M\n\6\f\6\16\6P\13\6\5\6R\n\6\3\6\3\6\3\6\3\6\3")
        buf.write("\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\7\7")
        buf.write("e\n\7\f\7\16\7h\13\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3")
        buf.write("\b\5\bs\n\b\3\t\3\t\3\t\3\t\7\ty\n\t\f\t\16\t|\13\t\3")
        buf.write("\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u0087\n\n\f\n\16")
        buf.write("\n\u008a\13\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u0094")
        buf.write("\n\n\f\n\16\n\u0097\13\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3")
        buf.write("\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u00aa\n\n\f")
        buf.write("\n\16\n\u00ad\13\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\7\n\u00bd\n\n\f\n\16\n\u00c0\13\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\5\n\u00ce")
        buf.write("\n\n\3\n\3\n\3\n\3\n\7\n\u00d4\n\n\f\n\16\n\u00d7\13\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7")
        buf.write("\n\u00e6\n\n\f\n\16\n\u00e9\13\n\5\n\u00eb\n\n\3\n\3\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\n\5\n\u00f6\n\n\3\n\3\n\3\n")
        buf.write("\7\n\u00fb\n\n\f\n\16\n\u00fe\13\n\3\13\3\13\3\13\5\13")
        buf.write("\u0103\n\13\3\13\3\13\3\13\3\13\3\13\7\13\u010a\n\13\f")
        buf.write("\13\16\13\u010d\13\13\5\13\u010f\n\13\3\13\3\13\3\13\3")
        buf.write("\13\3\13\3\13\5\13\u0117\n\13\3\f\3\f\3\f\5\f\u011c\n")
        buf.write("\f\3\r\3\r\3\r\3\r\3\r\3\r\5\r\u0124\n\r\3\r\3\r\3\r\3")
        buf.write("\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\7\r\u0135")
        buf.write("\n\r\f\r\16\r\u0138\13\r\3\16\3\16\3\16\3\16\3\16\3\16")
        buf.write("\5\16\u0140\n\16\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3")
        buf.write("\17\7\17\u014a\n\17\f\17\16\17\u014d\13\17\3\17\3\17\3")
        buf.write("\17\3\17\3\17\2\4\22\30\20\2\4\6\b\n\f\16\20\22\24\26")
        buf.write("\30\32\34\2\6\3\2\5\6\3\2\7\b\3\2\t\n\3\2\13\f\2\u0178")
        buf.write("\2!\3\2\2\2\4-\3\2\2\2\6\63\3\2\2\2\b\65\3\2\2\2\nF\3")
        buf.write("\2\2\2\fZ\3\2\2\2\16r\3\2\2\2\20t\3\2\2\2\22\u00f5\3\2")
        buf.write("\2\2\24\u0116\3\2\2\2\26\u0118\3\2\2\2\30\u0123\3\2\2")
        buf.write("\2\32\u013f\3\2\2\2\34\u0141\3\2\2\2\36 \5\4\3\2\37\36")
        buf.write("\3\2\2\2 #\3\2\2\2!\37\3\2\2\2!\"\3\2\2\2\"\'\3\2\2\2")
        buf.write("#!\3\2\2\2$&\5\6\4\2%$\3\2\2\2&)\3\2\2\2\'%\3\2\2\2\'")
        buf.write("(\3\2\2\2(+\3\2\2\2)\'\3\2\2\2*,\5\22\n\2+*\3\2\2\2+,")
        buf.write("\3\2\2\2,\3\3\2\2\2-.\7\31\2\2./\7\61\2\2/\5\3\2\2\2\60")
        buf.write("\64\5\f\7\2\61\64\5\b\5\2\62\64\5\n\6\2\63\60\3\2\2\2")
        buf.write("\63\61\3\2\2\2\63\62\3\2\2\2\64\7\3\2\2\2\65\66\7\30\2")
        buf.write("\2\66\67\7\63\2\2\67@\7&\2\28=\5\26\f\29:\7\33\2\2:<\5")
        buf.write("\26\f\2;9\3\2\2\2<?\3\2\2\2=;\3\2\2\2=>\3\2\2\2>A\3\2")
        buf.write("\2\2?=\3\2\2\2@8\3\2\2\2@A\3\2\2\2AB\3\2\2\2BC\7\'\2\2")
        buf.write("CD\7\27\2\2DE\5\22\n\2E\t\3\2\2\2FG\7\23\2\2GH\7\63\2")
        buf.write("\2HQ\7\"\2\2IN\5\16\b\2JK\7\33\2\2KM\5\16\b\2LJ\3\2\2")
        buf.write("\2MP\3\2\2\2NL\3\2\2\2NO\3\2\2\2OR\3\2\2\2PN\3\2\2\2Q")
        buf.write("I\3\2\2\2QR\3\2\2\2RS\3\2\2\2ST\7#\2\2TU\7\r\2\2UV\5\16")
        buf.write("\b\2VW\7\21\2\2WX\7\22\2\2XY\7\63\2\2Y\13\3\2\2\2Z[\7")
        buf.write(",\2\2[\\\7\63\2\2\\]\7$\2\2]^\7\63\2\2^_\7\r\2\2_f\5\16")
        buf.write("\b\2`a\7\33\2\2ab\7\63\2\2bc\7\r\2\2ce\5\16\b\2d`\3\2")
        buf.write("\2\2eh\3\2\2\2fd\3\2\2\2fg\3\2\2\2gi\3\2\2\2hf\3\2\2\2")
        buf.write("ij\7%\2\2j\r\3\2\2\2ks\7-\2\2ls\7.\2\2ms\7\60\2\2ns\7")
        buf.write("/\2\2op\7\3\2\2ps\5\20\t\2qs\7\63\2\2rk\3\2\2\2rl\3\2")
        buf.write("\2\2rm\3\2\2\2rn\3\2\2\2ro\3\2\2\2rq\3\2\2\2s\17\3\2\2")
        buf.write("\2tu\7&\2\2uz\5\16\b\2vw\7\33\2\2wy\5\16\b\2xv\3\2\2\2")
        buf.write("y|\3\2\2\2zx\3\2\2\2z{\3\2\2\2{}\3\2\2\2|z\3\2\2\2}~\7")
        buf.write("\'\2\2~\21\3\2\2\2\177\u0080\b\n\1\2\u0080\u0081\5\30")
        buf.write("\r\2\u0081\u0082\7\34\2\2\u0082\u0083\7&\2\2\u0083\u0088")
        buf.write("\5\30\r\2\u0084\u0085\7\33\2\2\u0085\u0087\5\30\r\2\u0086")
        buf.write("\u0084\3\2\2\2\u0087\u008a\3\2\2\2\u0088\u0086\3\2\2\2")
        buf.write("\u0088\u0089\3\2\2\2\u0089\u008b\3\2\2\2\u008a\u0088\3")
        buf.write("\2\2\2\u008b\u008c\7\'\2\2\u008c\u00f6\3\2\2\2\u008d\u008e")
        buf.write("\5\30\r\2\u008e\u008f\7\36\2\2\u008f\u0090\7&\2\2\u0090")
        buf.write("\u0095\5\26\f\2\u0091\u0092\7\33\2\2\u0092\u0094\5\26")
        buf.write("\f\2\u0093\u0091\3\2\2\2\u0094\u0097\3\2\2\2\u0095\u0093")
        buf.write("\3\2\2\2\u0095\u0096\3\2\2\2\u0096\u0098\3\2\2\2\u0097")
        buf.write("\u0095\3\2\2\2\u0098\u0099\7\'\2\2\u0099\u009a\7\27\2")
        buf.write("\2\u009a\u009b\5\22\n\r\u009b\u00f6\3\2\2\2\u009c\u009d")
        buf.write("\7\37\2\2\u009d\u009e\7\63\2\2\u009e\u009f\7\r\2\2\u009f")
        buf.write("\u00a0\5\16\b\2\u00a0\u00a1\7 \2\2\u00a1\u00a2\5\22\n")
        buf.write("\f\u00a2\u00f6\3\2\2\2\u00a3\u00a4\5\30\r\2\u00a4\u00a5")
        buf.write("\7\35\2\2\u00a5\u00a6\7&\2\2\u00a6\u00ab\5\26\f\2\u00a7")
        buf.write("\u00a8\7\33\2\2\u00a8\u00aa\5\26\f\2\u00a9\u00a7\3\2\2")
        buf.write("\2\u00aa\u00ad\3\2\2\2\u00ab\u00a9\3\2\2\2\u00ab\u00ac")
        buf.write("\3\2\2\2\u00ac\u00ae\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ae")
        buf.write("\u00af\7\'\2\2\u00af\u00b0\7\27\2\2\u00b0\u00b1\5\22\n")
        buf.write("\13\u00b1\u00f6\3\2\2\2\u00b2\u00b3\7\"\2\2\u00b3\u00b4")
        buf.write("\5\22\n\2\u00b4\u00b5\7#\2\2\u00b5\u00f6\3\2\2\2\u00b6")
        buf.write("\u00b7\7\30\2\2\u00b7\u00b8\7\63\2\2\u00b8\u00b9\7&\2")
        buf.write("\2\u00b9\u00be\5\26\f\2\u00ba\u00bb\7\33\2\2\u00bb\u00bd")
        buf.write("\5\26\f\2\u00bc\u00ba\3\2\2\2\u00bd\u00c0\3\2\2\2\u00be")
        buf.write("\u00bc\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf\u00c1\3\2\2\2")
        buf.write("\u00c0\u00be\3\2\2\2\u00c1\u00c2\7\'\2\2\u00c2\u00c3\7")
        buf.write("\27\2\2\u00c3\u00c4\5\22\n\2\u00c4\u00c5\5\22\n\t\u00c5")
        buf.write("\u00f6\3\2\2\2\u00c6\u00f6\7+\2\2\u00c7\u00c8\7\24\2\2")
        buf.write("\u00c8\u00c9\5\30\r\2\u00c9\u00ca\7\26\2\2\u00ca\u00cd")
        buf.write("\5\22\n\2\u00cb\u00cc\7\25\2\2\u00cc\u00ce\5\22\n\2\u00cd")
        buf.write("\u00cb\3\2\2\2\u00cd\u00ce\3\2\2\2\u00ce\u00f6\3\2\2\2")
        buf.write("\u00cf\u00d0\7\20\2\2\u00d0\u00d5\5\24\13\2\u00d1\u00d2")
        buf.write("\7\33\2\2\u00d2\u00d4\5\24\13\2\u00d3\u00d1\3\2\2\2\u00d4")
        buf.write("\u00d7\3\2\2\2\u00d5\u00d3\3\2\2\2\u00d5\u00d6\3\2\2\2")
        buf.write("\u00d6\u00d8\3\2\2\2\u00d7\u00d5\3\2\2\2\u00d8\u00d9\7")
        buf.write(" \2\2\u00d9\u00da\5\22\n\6\u00da\u00f6\3\2\2\2\u00db\u00dc")
        buf.write("\7\32\2\2\u00dc\u00dd\7\63\2\2\u00dd\u00ea\7\"\2\2\u00de")
        buf.write("\u00df\7\63\2\2\u00df\u00e0\7\r\2\2\u00e0\u00e7\5\16\b")
        buf.write("\2\u00e1\u00e2\7\33\2\2\u00e2\u00e3\7\63\2\2\u00e3\u00e4")
        buf.write("\7\r\2\2\u00e4\u00e6\5\16\b\2\u00e5\u00e1\3\2\2\2\u00e6")
        buf.write("\u00e9\3\2\2\2\u00e7\u00e5\3\2\2\2\u00e7\u00e8\3\2\2\2")
        buf.write("\u00e8\u00eb\3\2\2\2\u00e9\u00e7\3\2\2\2\u00ea\u00de\3")
        buf.write("\2\2\2\u00ea\u00eb\3\2\2\2\u00eb\u00ec\3\2\2\2\u00ec\u00ed")
        buf.write("\7#\2\2\u00ed\u00ee\7\r\2\2\u00ee\u00ef\5\16\b\2\u00ef")
        buf.write("\u00f0\7\27\2\2\u00f0\u00f1\5\22\n\2\u00f1\u00f2\5\22")
        buf.write("\n\5\u00f2\u00f6\3\2\2\2\u00f3\u00f4\7\17\2\2\u00f4\u00f6")
        buf.write("\5\30\r\2\u00f5\177\3\2\2\2\u00f5\u008d\3\2\2\2\u00f5")
        buf.write("\u009c\3\2\2\2\u00f5\u00a3\3\2\2\2\u00f5\u00b2\3\2\2\2")
        buf.write("\u00f5\u00b6\3\2\2\2\u00f5\u00c6\3\2\2\2\u00f5\u00c7\3")
        buf.write("\2\2\2\u00f5\u00cf\3\2\2\2\u00f5\u00db\3\2\2\2\u00f5\u00f3")
        buf.write("\3\2\2\2\u00f6\u00fc\3\2\2\2\u00f7\u00f8\f\3\2\2\u00f8")
        buf.write("\u00f9\7(\2\2\u00f9\u00fb\5\22\n\3\u00fa\u00f7\3\2\2\2")
        buf.write("\u00fb\u00fe\3\2\2\2\u00fc\u00fa\3\2\2\2\u00fc\u00fd\3")
        buf.write("\2\2\2\u00fd\23\3\2\2\2\u00fe\u00fc\3\2\2\2\u00ff\u0100")
        buf.write("\5\26\f\2\u0100\u0101\7\27\2\2\u0101\u0103\3\2\2\2\u0102")
        buf.write("\u00ff\3\2\2\2\u0102\u0103\3\2\2\2\u0103\u0104\3\2\2\2")
        buf.write("\u0104\u0105\5\30\r\2\u0105\u010e\7\"\2\2\u0106\u010b")
        buf.write("\5\30\r\2\u0107\u0108\7\33\2\2\u0108\u010a\5\30\r\2\u0109")
        buf.write("\u0107\3\2\2\2\u010a\u010d\3\2\2\2\u010b\u0109\3\2\2\2")
        buf.write("\u010b\u010c\3\2\2\2\u010c\u010f\3\2\2\2\u010d\u010b\3")
        buf.write("\2\2\2\u010e\u0106\3\2\2\2\u010e\u010f\3\2\2\2\u010f\u0110")
        buf.write("\3\2\2\2\u0110\u0111\7#\2\2\u0111\u0117\3\2\2\2\u0112")
        buf.write("\u0113\5\26\f\2\u0113\u0114\7\27\2\2\u0114\u0115\5\30")
        buf.write("\r\2\u0115\u0117\3\2\2\2\u0116\u0102\3\2\2\2\u0116\u0112")
        buf.write("\3\2\2\2\u0117\25\3\2\2\2\u0118\u011b\7\63\2\2\u0119\u011a")
        buf.write("\7\r\2\2\u011a\u011c\5\16\b\2\u011b\u0119\3\2\2\2\u011b")
        buf.write("\u011c\3\2\2\2\u011c\27\3\2\2\2\u011d\u011e\b\r\1\2\u011e")
        buf.write("\u011f\7\"\2\2\u011f\u0120\5\30\r\2\u0120\u0121\7#\2\2")
        buf.write("\u0121\u0124\3\2\2\2\u0122\u0124\5\32\16\2\u0123\u011d")
        buf.write("\3\2\2\2\u0123\u0122\3\2\2\2\u0124\u0136\3\2\2\2\u0125")
        buf.write("\u0126\f\7\2\2\u0126\u0127\7\4\2\2\u0127\u0135\5\30\r")
        buf.write("\b\u0128\u0129\f\6\2\2\u0129\u012a\t\2\2\2\u012a\u0135")
        buf.write("\5\30\r\7\u012b\u012c\f\5\2\2\u012c\u012d\t\3\2\2\u012d")
        buf.write("\u0135\5\30\r\6\u012e\u012f\f\4\2\2\u012f\u0130\t\4\2")
        buf.write("\2\u0130\u0135\5\30\r\5\u0131\u0132\f\3\2\2\u0132\u0133")
        buf.write("\t\5\2\2\u0133\u0135\5\30\r\4\u0134\u0125\3\2\2\2\u0134")
        buf.write("\u0128\3\2\2\2\u0134\u012b\3\2\2\2\u0134\u012e\3\2\2\2")
        buf.write("\u0134\u0131\3\2\2\2\u0135\u0138\3\2\2\2\u0136\u0134\3")
        buf.write("\2\2\2\u0136\u0137\3\2\2\2\u0137\31\3\2\2\2\u0138\u0136")
        buf.write("\3\2\2\2\u0139\u0140\7)\2\2\u013a\u0140\7*\2\2\u013b\u0140")
        buf.write("\7\61\2\2\u013c\u0140\7\63\2\2\u013d\u0140\5\34\17\2\u013e")
        buf.write("\u0140\7\62\2\2\u013f\u0139\3\2\2\2\u013f\u013a\3\2\2")
        buf.write("\2\u013f\u013b\3\2\2\2\u013f\u013c\3\2\2\2\u013f\u013d")
        buf.write("\3\2\2\2\u013f\u013e\3\2\2\2\u0140\33\3\2\2\2\u0141\u0142")
        buf.write("\7$\2\2\u0142\u0143\7\63\2\2\u0143\u0144\7\27\2\2\u0144")
        buf.write("\u014b\5\30\r\2\u0145\u0146\7\33\2\2\u0146\u0147\7\63")
        buf.write("\2\2\u0147\u0148\7\27\2\2\u0148\u014a\5\30\r\2\u0149\u0145")
        buf.write("\3\2\2\2\u014a\u014d\3\2\2\2\u014b\u0149\3\2\2\2\u014b")
        buf.write("\u014c\3\2\2\2\u014c\u014e\3\2\2\2\u014d\u014b\3\2\2\2")
        buf.write("\u014e\u014f\7%\2\2\u014f\u0150\7\16\2\2\u0150\u0151\7")
        buf.write("\63\2\2\u0151\35\3\2\2\2!!\'+\63=@NQfrz\u0088\u0095\u00ab")
        buf.write("\u00be\u00cd\u00d5\u00e7\u00ea\u00f5\u00fc\u0102\u010b")
        buf.write("\u010e\u0116\u011b\u0123\u0134\u0136\u013f\u014b")
        return buf.getvalue()


class pisteParser ( Parser ):

    grammarFileName = "piste.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'^'", "'**'", "'*'", "'/'", "'+'", "'-'", 
                     "'=='", "'!='", "'&&'", "'||'", "':'", "'as'", "'return'", 
                     "'let'", "'bound'", "'to'", "'extern'", "'if'", "'else'", 
                     "'then'", "'='", "'def'", "'import'", "'fun'", "','", 
                     "'!'", "'?*'", "'?'", "'channel'", "'in'", "'.'", "'('", 
                     "')'", "'{'", "'}'", "'['", "']'", "'|'", "'true'", 
                     "'false'", "'skip'", "'record'", "'int'", "'bool'", 
                     "'string'", "'void'" ]

    symbolicNames = [ "<INVALID>", "CARET", "POW", "MULT", "DIV", "ADD", 
                      "SUB", "EQEQ", "NEQ", "AND", "OR", "COLON", "AS", 
                      "RETURN", "LET", "BOUND", "TO", "EXTERN", "IF", "ELSE", 
                      "THEN", "EQ", "DEF", "IMPORT", "FUN", "COMMA", "SEND", 
                      "RECEIVE_REPLICATED", "RECEIVE", "CHANNEL", "IN", 
                      "DOT", "PAREN_LEFT", "PAREN_RIGHT", "BRACE_LEFT", 
                      "BRACE_RIGHT", "SQUARE_LEFT", "SQUARE_RIGHT", "PARALLEL", 
                      "TRUE", "FALSE", "INACTION", "RECORD", "INT_T", "BOOL_T", 
                      "STRING_T", "VOID_T", "STRING", "INTEGER", "IDENTIFIER", 
                      "SYMBOL_IDENTIFIER", "WS", "COMMENT" ]

    RULE_program = 0
    RULE_import_statement = 1
    RULE_declaration = 2
    RULE_process_declaration = 3
    RULE_extern_declaration = 4
    RULE_record_declaration = 5
    RULE_type_name = 6
    RULE_message_type = 7
    RULE_process = 8
    RULE_value_binding = 9
    RULE_identifier_with_type = 10
    RULE_expression = 11
    RULE_value = 12
    RULE_record = 13

    ruleNames =  [ "program", "import_statement", "declaration", "process_declaration", 
                   "extern_declaration", "record_declaration", "type_name", 
                   "message_type", "process", "value_binding", "identifier_with_type", 
                   "expression", "value", "record" ]

    EOF = Token.EOF
    CARET=1
    POW=2
    MULT=3
    DIV=4
    ADD=5
    SUB=6
    EQEQ=7
    NEQ=8
    AND=9
    OR=10
    COLON=11
    AS=12
    RETURN=13
    LET=14
    BOUND=15
    TO=16
    EXTERN=17
    IF=18
    ELSE=19
    THEN=20
    EQ=21
    DEF=22
    IMPORT=23
    FUN=24
    COMMA=25
    SEND=26
    RECEIVE_REPLICATED=27
    RECEIVE=28
    CHANNEL=29
    IN=30
    DOT=31
    PAREN_LEFT=32
    PAREN_RIGHT=33
    BRACE_LEFT=34
    BRACE_RIGHT=35
    SQUARE_LEFT=36
    SQUARE_RIGHT=37
    PARALLEL=38
    TRUE=39
    FALSE=40
    INACTION=41
    RECORD=42
    INT_T=43
    BOOL_T=44
    STRING_T=45
    VOID_T=46
    STRING=47
    INTEGER=48
    IDENTIFIER=49
    SYMBOL_IDENTIFIER=50
    WS=51
    COMMENT=52

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.9.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class ProgramContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def import_statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Import_statementContext)
            else:
                return self.getTypedRuleContext(pisteParser.Import_statementContext,i)


        def declaration(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.DeclarationContext)
            else:
                return self.getTypedRuleContext(pisteParser.DeclarationContext,i)


        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)


        def getRuleIndex(self):
            return pisteParser.RULE_program

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProgram" ):
                return visitor.visitProgram(self)
            else:
                return visitor.visitChildren(self)




    def program(self):

        localctx = pisteParser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 31
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.IMPORT:
                self.state = 28
                self.import_statement()
                self.state = 33
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 37
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,1,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 34
                    self.declaration() 
                self.state = 39
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,1,self._ctx)

            self.state = 41
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << pisteParser.RETURN) | (1 << pisteParser.LET) | (1 << pisteParser.IF) | (1 << pisteParser.DEF) | (1 << pisteParser.FUN) | (1 << pisteParser.CHANNEL) | (1 << pisteParser.PAREN_LEFT) | (1 << pisteParser.BRACE_LEFT) | (1 << pisteParser.TRUE) | (1 << pisteParser.FALSE) | (1 << pisteParser.INACTION) | (1 << pisteParser.STRING) | (1 << pisteParser.INTEGER) | (1 << pisteParser.IDENTIFIER))) != 0):
                self.state = 40
                self.process(0)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Import_statementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IMPORT(self):
            return self.getToken(pisteParser.IMPORT, 0)

        def STRING(self):
            return self.getToken(pisteParser.STRING, 0)

        def getRuleIndex(self):
            return pisteParser.RULE_import_statement

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitImport_statement" ):
                return visitor.visitImport_statement(self)
            else:
                return visitor.visitChildren(self)




    def import_statement(self):

        localctx = pisteParser.Import_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_import_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 43
            self.match(pisteParser.IMPORT)
            self.state = 44
            self.match(pisteParser.STRING)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def record_declaration(self):
            return self.getTypedRuleContext(pisteParser.Record_declarationContext,0)


        def process_declaration(self):
            return self.getTypedRuleContext(pisteParser.Process_declarationContext,0)


        def extern_declaration(self):
            return self.getTypedRuleContext(pisteParser.Extern_declarationContext,0)


        def getRuleIndex(self):
            return pisteParser.RULE_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDeclaration" ):
                return visitor.visitDeclaration(self)
            else:
                return visitor.visitChildren(self)




    def declaration(self):

        localctx = pisteParser.DeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_declaration)
        try:
            self.state = 49
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.RECORD]:
                self.enterOuterAlt(localctx, 1)
                self.state = 46
                self.record_declaration()
                pass
            elif token in [pisteParser.DEF]:
                self.enterOuterAlt(localctx, 2)
                self.state = 47
                self.process_declaration()
                pass
            elif token in [pisteParser.EXTERN]:
                self.enterOuterAlt(localctx, 3)
                self.state = 48
                self.extern_declaration()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Process_declarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.body = None # ProcessContext

        def DEF(self):
            return self.getToken(pisteParser.DEF, 0)

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)

        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)


        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_process_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProcess_declaration" ):
                return visitor.visitProcess_declaration(self)
            else:
                return visitor.visitChildren(self)




    def process_declaration(self):

        localctx = pisteParser.Process_declarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_process_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 51
            self.match(pisteParser.DEF)
            self.state = 52
            self.match(pisteParser.IDENTIFIER)
            self.state = 53
            self.match(pisteParser.SQUARE_LEFT)
            self.state = 62
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==pisteParser.IDENTIFIER:
                self.state = 54
                self.identifier_with_type()
                self.state = 59
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 55
                    self.match(pisteParser.COMMA)
                    self.state = 56
                    self.identifier_with_type()
                    self.state = 61
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 64
            self.match(pisteParser.SQUARE_RIGHT)
            self.state = 65
            self.match(pisteParser.EQ)
            self.state = 66
            localctx.body = self.process(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Extern_declarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EXTERN(self):
            return self.getToken(pisteParser.EXTERN, 0)

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)

        def COLON(self):
            return self.getToken(pisteParser.COLON, 0)

        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)


        def BOUND(self):
            return self.getToken(pisteParser.BOUND, 0)

        def TO(self):
            return self.getToken(pisteParser.TO, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_extern_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExtern_declaration" ):
                return visitor.visitExtern_declaration(self)
            else:
                return visitor.visitChildren(self)




    def extern_declaration(self):

        localctx = pisteParser.Extern_declarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_extern_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 68
            self.match(pisteParser.EXTERN)
            self.state = 69
            self.match(pisteParser.IDENTIFIER)
            self.state = 70
            self.match(pisteParser.PAREN_LEFT)
            self.state = 79
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << pisteParser.CARET) | (1 << pisteParser.INT_T) | (1 << pisteParser.BOOL_T) | (1 << pisteParser.STRING_T) | (1 << pisteParser.VOID_T) | (1 << pisteParser.IDENTIFIER))) != 0):
                self.state = 71
                self.type_name()
                self.state = 76
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 72
                    self.match(pisteParser.COMMA)
                    self.state = 73
                    self.type_name()
                    self.state = 78
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 81
            self.match(pisteParser.PAREN_RIGHT)
            self.state = 82
            self.match(pisteParser.COLON)
            self.state = 83
            self.type_name()
            self.state = 84
            self.match(pisteParser.BOUND)
            self.state = 85
            self.match(pisteParser.TO)
            self.state = 86
            self.match(pisteParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Record_declarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def RECORD(self):
            return self.getToken(pisteParser.RECORD, 0)

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)

        def BRACE_LEFT(self):
            return self.getToken(pisteParser.BRACE_LEFT, 0)

        def COLON(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COLON)
            else:
                return self.getToken(pisteParser.COLON, i)

        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)


        def BRACE_RIGHT(self):
            return self.getToken(pisteParser.BRACE_RIGHT, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_record_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRecord_declaration" ):
                return visitor.visitRecord_declaration(self)
            else:
                return visitor.visitChildren(self)




    def record_declaration(self):

        localctx = pisteParser.Record_declarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_record_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 88
            self.match(pisteParser.RECORD)
            self.state = 89
            self.match(pisteParser.IDENTIFIER)
            self.state = 90
            self.match(pisteParser.BRACE_LEFT)
            self.state = 91
            self.match(pisteParser.IDENTIFIER)
            self.state = 92
            self.match(pisteParser.COLON)
            self.state = 93
            self.type_name()
            self.state = 100
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.COMMA:
                self.state = 94
                self.match(pisteParser.COMMA)
                self.state = 95
                self.match(pisteParser.IDENTIFIER)
                self.state = 96
                self.match(pisteParser.COLON)
                self.state = 97
                self.type_name()
                self.state = 102
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 103
            self.match(pisteParser.BRACE_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Type_nameContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_type_name

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Type_stringContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def STRING_T(self):
            return self.getToken(pisteParser.STRING_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_string" ):
                return visitor.visitType_string(self)
            else:
                return visitor.visitChildren(self)


    class Type_boolContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def BOOL_T(self):
            return self.getToken(pisteParser.BOOL_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_bool" ):
                return visitor.visitType_bool(self)
            else:
                return visitor.visitChildren(self)


    class Type_voidContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def VOID_T(self):
            return self.getToken(pisteParser.VOID_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_void" ):
                return visitor.visitType_void(self)
            else:
                return visitor.visitChildren(self)


    class Type_channelContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CARET(self):
            return self.getToken(pisteParser.CARET, 0)
        def message_type(self):
            return self.getTypedRuleContext(pisteParser.Message_typeContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_channel" ):
                return visitor.visitType_channel(self)
            else:
                return visitor.visitChildren(self)


    class Type_identifierContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_identifier" ):
                return visitor.visitType_identifier(self)
            else:
                return visitor.visitChildren(self)


    class Type_intContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INT_T(self):
            return self.getToken(pisteParser.INT_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_int" ):
                return visitor.visitType_int(self)
            else:
                return visitor.visitChildren(self)



    def type_name(self):

        localctx = pisteParser.Type_nameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_type_name)
        try:
            self.state = 112
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.INT_T]:
                localctx = pisteParser.Type_intContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 105
                self.match(pisteParser.INT_T)
                pass
            elif token in [pisteParser.BOOL_T]:
                localctx = pisteParser.Type_boolContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 106
                self.match(pisteParser.BOOL_T)
                pass
            elif token in [pisteParser.VOID_T]:
                localctx = pisteParser.Type_voidContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 107
                self.match(pisteParser.VOID_T)
                pass
            elif token in [pisteParser.STRING_T]:
                localctx = pisteParser.Type_stringContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 108
                self.match(pisteParser.STRING_T)
                pass
            elif token in [pisteParser.CARET]:
                localctx = pisteParser.Type_channelContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 109
                self.match(pisteParser.CARET)
                self.state = 110
                self.message_type()
                pass
            elif token in [pisteParser.IDENTIFIER]:
                localctx = pisteParser.Type_identifierContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 111
                self.match(pisteParser.IDENTIFIER)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Message_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)

        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)


        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_message_type

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMessage_type" ):
                return visitor.visitMessage_type(self)
            else:
                return visitor.visitChildren(self)




    def message_type(self):

        localctx = pisteParser.Message_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_message_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(pisteParser.SQUARE_LEFT)
            self.state = 115
            self.type_name()
            self.state = 120
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.COMMA:
                self.state = 116
                self.match(pisteParser.COMMA)
                self.state = 117
                self.type_name()
                self.state = 122
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 123
            self.match(pisteParser.SQUARE_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ProcessContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_process

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class OutputContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.receiver = None # ExpressionContext
            self.copyFrom(ctx)

        def SEND(self):
            return self.getToken(pisteParser.SEND, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOutput" ):
                return visitor.visitOutput(self)
            else:
                return visitor.visitChildren(self)


    class Replicated_inputContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def RECEIVE_REPLICATED(self):
            return self.getToken(pisteParser.RECEIVE_REPLICATED, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReplicated_input" ):
                return visitor.visitReplicated_input(self)
            else:
                return visitor.visitChildren(self)


    class Function_defContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.body = None # ProcessContext
            self.continuation = None # ProcessContext
            self.copyFrom(ctx)

        def FUN(self):
            return self.getToken(pisteParser.FUN, 0)
        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)
        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)
        def COLON(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COLON)
            else:
                return self.getToken(pisteParser.COLON, i)
        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunction_def" ):
                return visitor.visitFunction_def(self)
            else:
                return visitor.visitChildren(self)


    class InputContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def RECEIVE(self):
            return self.getToken(pisteParser.RECEIVE, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitInput" ):
                return visitor.visitInput(self)
            else:
                return visitor.visitChildren(self)


    class ParenContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitParen" ):
                return visitor.visitParen(self)
            else:
                return visitor.visitChildren(self)


    class Process_defContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.body = None # ProcessContext
            self.continuation = None # ProcessContext
            self.copyFrom(ctx)

        def DEF(self):
            return self.getToken(pisteParser.DEF, 0)
        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProcess_def" ):
                return visitor.visitProcess_def(self)
            else:
                return visitor.visitChildren(self)


    class Let_bindingContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LET(self):
            return self.getToken(pisteParser.LET, 0)
        def value_binding(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Value_bindingContext)
            else:
                return self.getTypedRuleContext(pisteParser.Value_bindingContext,i)

        def IN(self):
            return self.getToken(pisteParser.IN, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLet_binding" ):
                return visitor.visitLet_binding(self)
            else:
                return visitor.visitChildren(self)


    class InactionContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INACTION(self):
            return self.getToken(pisteParser.INACTION, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitInaction" ):
                return visitor.visitInaction(self)
            else:
                return visitor.visitChildren(self)


    class ConditionalContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.true_branch = None # ProcessContext
            self.false_branch = None # ProcessContext
            self.copyFrom(ctx)

        def IF(self):
            return self.getToken(pisteParser.IF, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def THEN(self):
            return self.getToken(pisteParser.THEN, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)

        def ELSE(self):
            return self.getToken(pisteParser.ELSE, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitConditional" ):
                return visitor.visitConditional(self)
            else:
                return visitor.visitChildren(self)


    class ParallelContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.left = None # ProcessContext
            self.right = None # ProcessContext
            self.copyFrom(ctx)

        def PARALLEL(self):
            return self.getToken(pisteParser.PARALLEL, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitParallel" ):
                return visitor.visitParallel(self)
            else:
                return visitor.visitChildren(self)


    class RestrictionContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CHANNEL(self):
            return self.getToken(pisteParser.CHANNEL, 0)
        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)
        def COLON(self):
            return self.getToken(pisteParser.COLON, 0)
        def type_name(self):
            return self.getTypedRuleContext(pisteParser.Type_nameContext,0)

        def IN(self):
            return self.getToken(pisteParser.IN, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRestriction" ):
                return visitor.visitRestriction(self)
            else:
                return visitor.visitChildren(self)


    class ReturnContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def RETURN(self):
            return self.getToken(pisteParser.RETURN, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReturn" ):
                return visitor.visitReturn(self)
            else:
                return visitor.visitChildren(self)



    def process(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = pisteParser.ProcessContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 16
        self.enterRecursionRule(localctx, 16, self.RULE_process, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 243
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,19,self._ctx)
            if la_ == 1:
                localctx = pisteParser.OutputContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 126
                localctx.receiver = self.expression(0)
                self.state = 127
                self.match(pisteParser.SEND)
                self.state = 128
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 129
                self.expression(0)
                self.state = 134
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 130
                    self.match(pisteParser.COMMA)
                    self.state = 131
                    self.expression(0)
                    self.state = 136
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 137
                self.match(pisteParser.SQUARE_RIGHT)
                pass

            elif la_ == 2:
                localctx = pisteParser.InputContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 139
                self.expression(0)
                self.state = 140
                self.match(pisteParser.RECEIVE)
                self.state = 141
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 142
                self.identifier_with_type()
                self.state = 147
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 143
                    self.match(pisteParser.COMMA)
                    self.state = 144
                    self.identifier_with_type()
                    self.state = 149
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 150
                self.match(pisteParser.SQUARE_RIGHT)
                self.state = 151
                self.match(pisteParser.EQ)
                self.state = 152
                self.process(11)
                pass

            elif la_ == 3:
                localctx = pisteParser.RestrictionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 154
                self.match(pisteParser.CHANNEL)
                self.state = 155
                self.match(pisteParser.IDENTIFIER)
                self.state = 156
                self.match(pisteParser.COLON)
                self.state = 157
                self.type_name()
                self.state = 158
                self.match(pisteParser.IN)
                self.state = 159
                self.process(10)
                pass

            elif la_ == 4:
                localctx = pisteParser.Replicated_inputContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 161
                self.expression(0)
                self.state = 162
                self.match(pisteParser.RECEIVE_REPLICATED)
                self.state = 163
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 164
                self.identifier_with_type()
                self.state = 169
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 165
                    self.match(pisteParser.COMMA)
                    self.state = 166
                    self.identifier_with_type()
                    self.state = 171
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 172
                self.match(pisteParser.SQUARE_RIGHT)
                self.state = 173
                self.match(pisteParser.EQ)
                self.state = 174
                self.process(9)
                pass

            elif la_ == 5:
                localctx = pisteParser.ParenContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 176
                self.match(pisteParser.PAREN_LEFT)
                self.state = 177
                self.process(0)
                self.state = 178
                self.match(pisteParser.PAREN_RIGHT)
                pass

            elif la_ == 6:
                localctx = pisteParser.Process_defContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 180
                self.match(pisteParser.DEF)
                self.state = 181
                self.match(pisteParser.IDENTIFIER)
                self.state = 182
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 183
                self.identifier_with_type()
                self.state = 188
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 184
                    self.match(pisteParser.COMMA)
                    self.state = 185
                    self.identifier_with_type()
                    self.state = 190
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 191
                self.match(pisteParser.SQUARE_RIGHT)
                self.state = 192
                self.match(pisteParser.EQ)
                self.state = 193
                localctx.body = self.process(0)
                self.state = 194
                localctx.continuation = self.process(7)
                pass

            elif la_ == 7:
                localctx = pisteParser.InactionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 196
                self.match(pisteParser.INACTION)
                pass

            elif la_ == 8:
                localctx = pisteParser.ConditionalContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 197
                self.match(pisteParser.IF)
                self.state = 198
                self.expression(0)
                self.state = 199
                self.match(pisteParser.THEN)
                self.state = 200
                localctx.true_branch = self.process(0)
                self.state = 203
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
                if la_ == 1:
                    self.state = 201
                    self.match(pisteParser.ELSE)
                    self.state = 202
                    localctx.false_branch = self.process(0)


                pass

            elif la_ == 9:
                localctx = pisteParser.Let_bindingContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 205
                self.match(pisteParser.LET)
                self.state = 206
                self.value_binding()
                self.state = 211
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 207
                    self.match(pisteParser.COMMA)
                    self.state = 208
                    self.value_binding()
                    self.state = 213
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 214
                self.match(pisteParser.IN)
                self.state = 215
                self.process(4)
                pass

            elif la_ == 10:
                localctx = pisteParser.Function_defContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 217
                self.match(pisteParser.FUN)
                self.state = 218
                self.match(pisteParser.IDENTIFIER)
                self.state = 219
                self.match(pisteParser.PAREN_LEFT)
                self.state = 232
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==pisteParser.IDENTIFIER:
                    self.state = 220
                    self.match(pisteParser.IDENTIFIER)
                    self.state = 221
                    self.match(pisteParser.COLON)
                    self.state = 222
                    self.type_name()
                    self.state = 229
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==pisteParser.COMMA:
                        self.state = 223
                        self.match(pisteParser.COMMA)
                        self.state = 224
                        self.match(pisteParser.IDENTIFIER)
                        self.state = 225
                        self.match(pisteParser.COLON)
                        self.state = 226
                        self.type_name()
                        self.state = 231
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)



                self.state = 234
                self.match(pisteParser.PAREN_RIGHT)
                self.state = 235
                self.match(pisteParser.COLON)
                self.state = 236
                self.type_name()
                self.state = 237
                self.match(pisteParser.EQ)
                self.state = 238
                localctx.body = self.process(0)
                self.state = 239
                localctx.continuation = self.process(3)
                pass

            elif la_ == 11:
                localctx = pisteParser.ReturnContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 241
                self.match(pisteParser.RETURN)
                self.state = 242
                self.expression(0)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 250
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,20,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = pisteParser.ParallelContext(self, pisteParser.ProcessContext(self, _parentctx, _parentState))
                    localctx.left = _prevctx
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_process)
                    self.state = 245
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 246
                    self.match(pisteParser.PARALLEL)
                    self.state = 247
                    localctx.right = self.process(1) 
                self.state = 252
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,20,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class Value_bindingContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_value_binding

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Simple_value_bindingContext(Value_bindingContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Value_bindingContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def identifier_with_type(self):
            return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,0)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSimple_value_binding" ):
                return visitor.visitSimple_value_binding(self)
            else:
                return visitor.visitChildren(self)


    class Call_bindingContext(Value_bindingContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Value_bindingContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)
        def identifier_with_type(self):
            return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,0)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCall_binding" ):
                return visitor.visitCall_binding(self)
            else:
                return visitor.visitChildren(self)



    def value_binding(self):

        localctx = pisteParser.Value_bindingContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_value_binding)
        self._la = 0 # Token type
        try:
            self.state = 276
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,24,self._ctx)
            if la_ == 1:
                localctx = pisteParser.Call_bindingContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 256
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,21,self._ctx)
                if la_ == 1:
                    self.state = 253
                    self.identifier_with_type()
                    self.state = 254
                    self.match(pisteParser.EQ)


                self.state = 258
                self.expression(0)
                self.state = 259
                self.match(pisteParser.PAREN_LEFT)
                self.state = 268
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << pisteParser.PAREN_LEFT) | (1 << pisteParser.BRACE_LEFT) | (1 << pisteParser.TRUE) | (1 << pisteParser.FALSE) | (1 << pisteParser.STRING) | (1 << pisteParser.INTEGER) | (1 << pisteParser.IDENTIFIER))) != 0):
                    self.state = 260
                    self.expression(0)
                    self.state = 265
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==pisteParser.COMMA:
                        self.state = 261
                        self.match(pisteParser.COMMA)
                        self.state = 262
                        self.expression(0)
                        self.state = 267
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)



                self.state = 270
                self.match(pisteParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                localctx = pisteParser.Simple_value_bindingContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 272
                self.identifier_with_type()
                self.state = 273
                self.match(pisteParser.EQ)
                self.state = 274
                self.expression(0)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Identifier_with_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def COLON(self):
            return self.getToken(pisteParser.COLON, 0)

        def type_name(self):
            return self.getTypedRuleContext(pisteParser.Type_nameContext,0)


        def getRuleIndex(self):
            return pisteParser.RULE_identifier_with_type

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIdentifier_with_type" ):
                return visitor.visitIdentifier_with_type(self)
            else:
                return visitor.visitChildren(self)




    def identifier_with_type(self):

        localctx = pisteParser.Identifier_with_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_identifier_with_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 278
            self.match(pisteParser.IDENTIFIER)
            self.state = 281
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==pisteParser.COLON:
                self.state = 279
                self.match(pisteParser.COLON)
                self.state = 280
                self.type_name()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_expression

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class Paren_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitParen_expr" ):
                return visitor.visitParen_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_pow_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def POW(self):
            return self.getToken(pisteParser.POW, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_pow_expr" ):
                return visitor.visitOperator_pow_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_ao_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def AND(self):
            return self.getToken(pisteParser.AND, 0)
        def OR(self):
            return self.getToken(pisteParser.OR, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_ao_expr" ):
                return visitor.visitOperator_ao_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_as_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def ADD(self):
            return self.getToken(pisteParser.ADD, 0)
        def SUB(self):
            return self.getToken(pisteParser.SUB, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_as_expr" ):
                return visitor.visitOperator_as_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_md_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def MULT(self):
            return self.getToken(pisteParser.MULT, 0)
        def DIV(self):
            return self.getToken(pisteParser.DIV, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_md_expr" ):
                return visitor.visitOperator_md_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_en_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def EQEQ(self):
            return self.getToken(pisteParser.EQEQ, 0)
        def NEQ(self):
            return self.getToken(pisteParser.NEQ, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_en_expr" ):
                return visitor.visitOperator_en_expr(self)
            else:
                return visitor.visitChildren(self)


    class LiteralContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def value(self):
            return self.getTypedRuleContext(pisteParser.ValueContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteral" ):
                return visitor.visitLiteral(self)
            else:
                return visitor.visitChildren(self)



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = pisteParser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 22
        self.enterRecursionRule(localctx, 22, self.RULE_expression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 289
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.PAREN_LEFT]:
                localctx = pisteParser.Paren_exprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 284
                self.match(pisteParser.PAREN_LEFT)
                self.state = 285
                self.expression(0)
                self.state = 286
                self.match(pisteParser.PAREN_RIGHT)
                pass
            elif token in [pisteParser.BRACE_LEFT, pisteParser.TRUE, pisteParser.FALSE, pisteParser.STRING, pisteParser.INTEGER, pisteParser.IDENTIFIER]:
                localctx = pisteParser.LiteralContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 288
                self.value()
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 308
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,28,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 306
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
                    if la_ == 1:
                        localctx = pisteParser.Operator_pow_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 291
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 292
                        self.match(pisteParser.POW)
                        self.state = 293
                        self.expression(6)
                        pass

                    elif la_ == 2:
                        localctx = pisteParser.Operator_md_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 294
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 295
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.MULT or _la==pisteParser.DIV):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 296
                        self.expression(5)
                        pass

                    elif la_ == 3:
                        localctx = pisteParser.Operator_as_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 297
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 298
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.ADD or _la==pisteParser.SUB):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 299
                        self.expression(4)
                        pass

                    elif la_ == 4:
                        localctx = pisteParser.Operator_en_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 300
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 301
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.EQEQ or _la==pisteParser.NEQ):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 302
                        self.expression(3)
                        pass

                    elif la_ == 5:
                        localctx = pisteParser.Operator_ao_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 303
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 304
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.AND or _la==pisteParser.OR):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 305
                        self.expression(2)
                        pass

             
                self.state = 310
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,28,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class ValueContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_value

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class True_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TRUE(self):
            return self.getToken(pisteParser.TRUE, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTrue_val" ):
                return visitor.visitTrue_val(self)
            else:
                return visitor.visitChildren(self)


    class Record_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def record(self):
            return self.getTypedRuleContext(pisteParser.RecordContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRecord_val" ):
                return visitor.visitRecord_val(self)
            else:
                return visitor.visitChildren(self)


    class String_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def STRING(self):
            return self.getToken(pisteParser.STRING, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitString_val" ):
                return visitor.visitString_val(self)
            else:
                return visitor.visitChildren(self)


    class Int_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INTEGER(self):
            return self.getToken(pisteParser.INTEGER, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitInt_val" ):
                return visitor.visitInt_val(self)
            else:
                return visitor.visitChildren(self)


    class False_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def FALSE(self):
            return self.getToken(pisteParser.FALSE, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFalse_val" ):
                return visitor.visitFalse_val(self)
            else:
                return visitor.visitChildren(self)


    class Identifier_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIdentifier_val" ):
                return visitor.visitIdentifier_val(self)
            else:
                return visitor.visitChildren(self)



    def value(self):

        localctx = pisteParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_value)
        try:
            self.state = 317
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.TRUE]:
                localctx = pisteParser.True_valContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 311
                self.match(pisteParser.TRUE)
                pass
            elif token in [pisteParser.FALSE]:
                localctx = pisteParser.False_valContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 312
                self.match(pisteParser.FALSE)
                pass
            elif token in [pisteParser.STRING]:
                localctx = pisteParser.String_valContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 313
                self.match(pisteParser.STRING)
                pass
            elif token in [pisteParser.IDENTIFIER]:
                localctx = pisteParser.Identifier_valContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 314
                self.match(pisteParser.IDENTIFIER)
                pass
            elif token in [pisteParser.BRACE_LEFT]:
                localctx = pisteParser.Record_valContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 315
                self.record()
                pass
            elif token in [pisteParser.INTEGER]:
                localctx = pisteParser.Int_valContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 316
                self.match(pisteParser.INTEGER)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RecordContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BRACE_LEFT(self):
            return self.getToken(pisteParser.BRACE_LEFT, 0)

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)

        def EQ(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.EQ)
            else:
                return self.getToken(pisteParser.EQ, i)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)


        def BRACE_RIGHT(self):
            return self.getToken(pisteParser.BRACE_RIGHT, 0)

        def AS(self):
            return self.getToken(pisteParser.AS, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_record

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRecord" ):
                return visitor.visitRecord(self)
            else:
                return visitor.visitChildren(self)




    def record(self):

        localctx = pisteParser.RecordContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_record)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 319
            self.match(pisteParser.BRACE_LEFT)
            self.state = 320
            self.match(pisteParser.IDENTIFIER)
            self.state = 321
            self.match(pisteParser.EQ)
            self.state = 322
            self.expression(0)
            self.state = 329
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.COMMA:
                self.state = 323
                self.match(pisteParser.COMMA)
                self.state = 324
                self.match(pisteParser.IDENTIFIER)
                self.state = 325
                self.match(pisteParser.EQ)
                self.state = 326
                self.expression(0)
                self.state = 331
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 332
            self.match(pisteParser.BRACE_RIGHT)
            self.state = 333
            self.match(pisteParser.AS)
            self.state = 334
            self.match(pisteParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[8] = self.process_sempred
        self._predicates[11] = self.expression_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def process_sempred(self, localctx:ProcessContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 1)
         

    def expression_sempred(self, localctx:ExpressionContext, predIndex:int):
            if predIndex == 1:
                return self.precpred(self._ctx, 5)
         

            if predIndex == 2:
                return self.precpred(self._ctx, 4)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 1)
         





# Generated from /home/mathias/gitrepos/piste/compiler/piste.g4 by ANTLR 4.9.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\66")
        buf.write("\u0153\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\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")
        buf.write("\t\16\4\17\t\17\3\2\7\2 \n\2\f\2\16\2#\13\2\3\2\7\2&\n")
        buf.write("\2\f\2\16\2)\13\2\3\2\5\2,\n\2\3\3\3\3\3\3\3\4\3\4\3\4")
        buf.write("\5\4\64\n\4\3\5\3\5\3\5\3\5\3\5\3\5\7\5<\n\5\f\5\16\5")
        buf.write("?\13\5\5\5A\n\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3")
        buf.write("\6\7\6M\n\6\f\6\16\6P\13\6\5\6R\n\6\3\6\3\6\3\6\3\6\3")
        buf.write("\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\7\7")
        buf.write("e\n\7\f\7\16\7h\13\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3")
        buf.write("\b\5\bs\n\b\3\t\3\t\3\t\3\t\7\ty\n\t\f\t\16\t|\13\t\3")
        buf.write("\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u0087\n\n\f\n\16")
        buf.write("\n\u008a\13\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u0094")
        buf.write("\n\n\f\n\16\n\u0097\13\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3")
        buf.write("\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u00aa\n\n\f")
        buf.write("\n\16\n\u00ad\13\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\7\n\u00bd\n\n\f\n\16\n\u00c0\13\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\5\n\u00ce")
        buf.write("\n\n\3\n\3\n\3\n\3\n\7\n\u00d4\n\n\f\n\16\n\u00d7\13\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7")
        buf.write("\n\u00e6\n\n\f\n\16\n\u00e9\13\n\5\n\u00eb\n\n\3\n\3\n")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\n\5\n\u00f6\n\n\3\n\3\n\3\n")
        buf.write("\7\n\u00fb\n\n\f\n\16\n\u00fe\13\n\3\13\3\13\3\13\5\13")
        buf.write("\u0103\n\13\3\13\3\13\3\13\3\13\3\13\7\13\u010a\n\13\f")
        buf.write("\13\16\13\u010d\13\13\5\13\u010f\n\13\3\13\3\13\3\13\3")
        buf.write("\13\3\13\3\13\5\13\u0117\n\13\3\f\3\f\3\f\5\f\u011c\n")
        buf.write("\f\3\r\3\r\3\r\3\r\3\r\3\r\5\r\u0124\n\r\3\r\3\r\3\r\3")
        buf.write("\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\7\r\u0135")
        buf.write("\n\r\f\r\16\r\u0138\13\r\3\16\3\16\3\16\3\16\3\16\3\16")
        buf.write("\5\16\u0140\n\16\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3")
        buf.write("\17\7\17\u014a\n\17\f\17\16\17\u014d\13\17\3\17\3\17\3")
        buf.write("\17\3\17\3\17\2\4\22\30\20\2\4\6\b\n\f\16\20\22\24\26")
        buf.write("\30\32\34\2\6\3\2\5\6\3\2\7\b\3\2\t\n\3\2\13\f\2\u0178")
        buf.write("\2!\3\2\2\2\4-\3\2\2\2\6\63\3\2\2\2\b\65\3\2\2\2\nF\3")
        buf.write("\2\2\2\fZ\3\2\2\2\16r\3\2\2\2\20t\3\2\2\2\22\u00f5\3\2")
        buf.write("\2\2\24\u0116\3\2\2\2\26\u0118\3\2\2\2\30\u0123\3\2\2")
        buf.write("\2\32\u013f\3\2\2\2\34\u0141\3\2\2\2\36 \5\4\3\2\37\36")
        buf.write("\3\2\2\2 #\3\2\2\2!\37\3\2\2\2!\"\3\2\2\2\"\'\3\2\2\2")
        buf.write("#!\3\2\2\2$&\5\6\4\2%$\3\2\2\2&)\3\2\2\2\'%\3\2\2\2\'")
        buf.write("(\3\2\2\2(+\3\2\2\2)\'\3\2\2\2*,\5\22\n\2+*\3\2\2\2+,")
        buf.write("\3\2\2\2,\3\3\2\2\2-.\7\31\2\2./\7\61\2\2/\5\3\2\2\2\60")
        buf.write("\64\5\f\7\2\61\64\5\b\5\2\62\64\5\n\6\2\63\60\3\2\2\2")
        buf.write("\63\61\3\2\2\2\63\62\3\2\2\2\64\7\3\2\2\2\65\66\7\30\2")
        buf.write("\2\66\67\7\63\2\2\67@\7&\2\28=\5\26\f\29:\7\33\2\2:<\5")
        buf.write("\26\f\2;9\3\2\2\2<?\3\2\2\2=;\3\2\2\2=>\3\2\2\2>A\3\2")
        buf.write("\2\2?=\3\2\2\2@8\3\2\2\2@A\3\2\2\2AB\3\2\2\2BC\7\'\2\2")
        buf.write("CD\7\27\2\2DE\5\22\n\2E\t\3\2\2\2FG\7\23\2\2GH\7\63\2")
        buf.write("\2HQ\7\"\2\2IN\5\16\b\2JK\7\33\2\2KM\5\16\b\2LJ\3\2\2")
        buf.write("\2MP\3\2\2\2NL\3\2\2\2NO\3\2\2\2OR\3\2\2\2PN\3\2\2\2Q")
        buf.write("I\3\2\2\2QR\3\2\2\2RS\3\2\2\2ST\7#\2\2TU\7\r\2\2UV\5\16")
        buf.write("\b\2VW\7\21\2\2WX\7\22\2\2XY\7\63\2\2Y\13\3\2\2\2Z[\7")
        buf.write(",\2\2[\\\7\63\2\2\\]\7$\2\2]^\7\63\2\2^_\7\r\2\2_f\5\16")
        buf.write("\b\2`a\7\33\2\2ab\7\63\2\2bc\7\r\2\2ce\5\16\b\2d`\3\2")
        buf.write("\2\2eh\3\2\2\2fd\3\2\2\2fg\3\2\2\2gi\3\2\2\2hf\3\2\2\2")
        buf.write("ij\7%\2\2j\r\3\2\2\2ks\7-\2\2ls\7.\2\2ms\7\60\2\2ns\7")
        buf.write("/\2\2op\7\3\2\2ps\5\20\t\2qs\7\63\2\2rk\3\2\2\2rl\3\2")
        buf.write("\2\2rm\3\2\2\2rn\3\2\2\2ro\3\2\2\2rq\3\2\2\2s\17\3\2\2")
        buf.write("\2tu\7&\2\2uz\5\16\b\2vw\7\33\2\2wy\5\16\b\2xv\3\2\2\2")
        buf.write("y|\3\2\2\2zx\3\2\2\2z{\3\2\2\2{}\3\2\2\2|z\3\2\2\2}~\7")
        buf.write("\'\2\2~\21\3\2\2\2\177\u0080\b\n\1\2\u0080\u0081\5\30")
        buf.write("\r\2\u0081\u0082\7\34\2\2\u0082\u0083\7&\2\2\u0083\u0088")
        buf.write("\5\30\r\2\u0084\u0085\7\33\2\2\u0085\u0087\5\30\r\2\u0086")
        buf.write("\u0084\3\2\2\2\u0087\u008a\3\2\2\2\u0088\u0086\3\2\2\2")
        buf.write("\u0088\u0089\3\2\2\2\u0089\u008b\3\2\2\2\u008a\u0088\3")
        buf.write("\2\2\2\u008b\u008c\7\'\2\2\u008c\u00f6\3\2\2\2\u008d\u008e")
        buf.write("\5\30\r\2\u008e\u008f\7\36\2\2\u008f\u0090\7&\2\2\u0090")
        buf.write("\u0095\5\26\f\2\u0091\u0092\7\33\2\2\u0092\u0094\5\26")
        buf.write("\f\2\u0093\u0091\3\2\2\2\u0094\u0097\3\2\2\2\u0095\u0093")
        buf.write("\3\2\2\2\u0095\u0096\3\2\2\2\u0096\u0098\3\2\2\2\u0097")
        buf.write("\u0095\3\2\2\2\u0098\u0099\7\'\2\2\u0099\u009a\7\27\2")
        buf.write("\2\u009a\u009b\5\22\n\r\u009b\u00f6\3\2\2\2\u009c\u009d")
        buf.write("\7\37\2\2\u009d\u009e\7\63\2\2\u009e\u009f\7\r\2\2\u009f")
        buf.write("\u00a0\5\16\b\2\u00a0\u00a1\7 \2\2\u00a1\u00a2\5\22\n")
        buf.write("\f\u00a2\u00f6\3\2\2\2\u00a3\u00a4\5\30\r\2\u00a4\u00a5")
        buf.write("\7\35\2\2\u00a5\u00a6\7&\2\2\u00a6\u00ab\5\26\f\2\u00a7")
        buf.write("\u00a8\7\33\2\2\u00a8\u00aa\5\26\f\2\u00a9\u00a7\3\2\2")
        buf.write("\2\u00aa\u00ad\3\2\2\2\u00ab\u00a9\3\2\2\2\u00ab\u00ac")
        buf.write("\3\2\2\2\u00ac\u00ae\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ae")
        buf.write("\u00af\7\'\2\2\u00af\u00b0\7\27\2\2\u00b0\u00b1\5\22\n")
        buf.write("\13\u00b1\u00f6\3\2\2\2\u00b2\u00b3\7\"\2\2\u00b3\u00b4")
        buf.write("\5\22\n\2\u00b4\u00b5\7#\2\2\u00b5\u00f6\3\2\2\2\u00b6")
        buf.write("\u00b7\7\30\2\2\u00b7\u00b8\7\63\2\2\u00b8\u00b9\7&\2")
        buf.write("\2\u00b9\u00be\5\26\f\2\u00ba\u00bb\7\33\2\2\u00bb\u00bd")
        buf.write("\5\26\f\2\u00bc\u00ba\3\2\2\2\u00bd\u00c0\3\2\2\2\u00be")
        buf.write("\u00bc\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf\u00c1\3\2\2\2")
        buf.write("\u00c0\u00be\3\2\2\2\u00c1\u00c2\7\'\2\2\u00c2\u00c3\7")
        buf.write("\27\2\2\u00c3\u00c4\5\22\n\2\u00c4\u00c5\5\22\n\t\u00c5")
        buf.write("\u00f6\3\2\2\2\u00c6\u00f6\7+\2\2\u00c7\u00c8\7\24\2\2")
        buf.write("\u00c8\u00c9\5\30\r\2\u00c9\u00ca\7\26\2\2\u00ca\u00cd")
        buf.write("\5\22\n\2\u00cb\u00cc\7\25\2\2\u00cc\u00ce\5\22\n\2\u00cd")
        buf.write("\u00cb\3\2\2\2\u00cd\u00ce\3\2\2\2\u00ce\u00f6\3\2\2\2")
        buf.write("\u00cf\u00d0\7\20\2\2\u00d0\u00d5\5\24\13\2\u00d1\u00d2")
        buf.write("\7\33\2\2\u00d2\u00d4\5\24\13\2\u00d3\u00d1\3\2\2\2\u00d4")
        buf.write("\u00d7\3\2\2\2\u00d5\u00d3\3\2\2\2\u00d5\u00d6\3\2\2\2")
        buf.write("\u00d6\u00d8\3\2\2\2\u00d7\u00d5\3\2\2\2\u00d8\u00d9\7")
        buf.write(" \2\2\u00d9\u00da\5\22\n\6\u00da\u00f6\3\2\2\2\u00db\u00dc")
        buf.write("\7\32\2\2\u00dc\u00dd\7\63\2\2\u00dd\u00ea\7\"\2\2\u00de")
        buf.write("\u00df\7\63\2\2\u00df\u00e0\7\r\2\2\u00e0\u00e7\5\16\b")
        buf.write("\2\u00e1\u00e2\7\33\2\2\u00e2\u00e3\7\63\2\2\u00e3\u00e4")
        buf.write("\7\r\2\2\u00e4\u00e6\5\16\b\2\u00e5\u00e1\3\2\2\2\u00e6")
        buf.write("\u00e9\3\2\2\2\u00e7\u00e5\3\2\2\2\u00e7\u00e8\3\2\2\2")
        buf.write("\u00e8\u00eb\3\2\2\2\u00e9\u00e7\3\2\2\2\u00ea\u00de\3")
        buf.write("\2\2\2\u00ea\u00eb\3\2\2\2\u00eb\u00ec\3\2\2\2\u00ec\u00ed")
        buf.write("\7#\2\2\u00ed\u00ee\7\r\2\2\u00ee\u00ef\5\16\b\2\u00ef")
        buf.write("\u00f0\7\27\2\2\u00f0\u00f1\5\22\n\2\u00f1\u00f2\5\22")
        buf.write("\n\5\u00f2\u00f6\3\2\2\2\u00f3\u00f4\7\17\2\2\u00f4\u00f6")
        buf.write("\5\30\r\2\u00f5\177\3\2\2\2\u00f5\u008d\3\2\2\2\u00f5")
        buf.write("\u009c\3\2\2\2\u00f5\u00a3\3\2\2\2\u00f5\u00b2\3\2\2\2")
        buf.write("\u00f5\u00b6\3\2\2\2\u00f5\u00c6\3\2\2\2\u00f5\u00c7\3")
        buf.write("\2\2\2\u00f5\u00cf\3\2\2\2\u00f5\u00db\3\2\2\2\u00f5\u00f3")
        buf.write("\3\2\2\2\u00f6\u00fc\3\2\2\2\u00f7\u00f8\f\3\2\2\u00f8")
        buf.write("\u00f9\7(\2\2\u00f9\u00fb\5\22\n\3\u00fa\u00f7\3\2\2\2")
        buf.write("\u00fb\u00fe\3\2\2\2\u00fc\u00fa\3\2\2\2\u00fc\u00fd\3")
        buf.write("\2\2\2\u00fd\23\3\2\2\2\u00fe\u00fc\3\2\2\2\u00ff\u0100")
        buf.write("\5\26\f\2\u0100\u0101\7\27\2\2\u0101\u0103\3\2\2\2\u0102")
        buf.write("\u00ff\3\2\2\2\u0102\u0103\3\2\2\2\u0103\u0104\3\2\2\2")
        buf.write("\u0104\u0105\5\30\r\2\u0105\u010e\7\"\2\2\u0106\u010b")
        buf.write("\5\30\r\2\u0107\u0108\7\33\2\2\u0108\u010a\5\30\r\2\u0109")
        buf.write("\u0107\3\2\2\2\u010a\u010d\3\2\2\2\u010b\u0109\3\2\2\2")
        buf.write("\u010b\u010c\3\2\2\2\u010c\u010f\3\2\2\2\u010d\u010b\3")
        buf.write("\2\2\2\u010e\u0106\3\2\2\2\u010e\u010f\3\2\2\2\u010f\u0110")
        buf.write("\3\2\2\2\u0110\u0111\7#\2\2\u0111\u0117\3\2\2\2\u0112")
        buf.write("\u0113\5\26\f\2\u0113\u0114\7\27\2\2\u0114\u0115\5\30")
        buf.write("\r\2\u0115\u0117\3\2\2\2\u0116\u0102\3\2\2\2\u0116\u0112")
        buf.write("\3\2\2\2\u0117\25\3\2\2\2\u0118\u011b\7\63\2\2\u0119\u011a")
        buf.write("\7\r\2\2\u011a\u011c\5\16\b\2\u011b\u0119\3\2\2\2\u011b")
        buf.write("\u011c\3\2\2\2\u011c\27\3\2\2\2\u011d\u011e\b\r\1\2\u011e")
        buf.write("\u011f\7\"\2\2\u011f\u0120\5\30\r\2\u0120\u0121\7#\2\2")
        buf.write("\u0121\u0124\3\2\2\2\u0122\u0124\5\32\16\2\u0123\u011d")
        buf.write("\3\2\2\2\u0123\u0122\3\2\2\2\u0124\u0136\3\2\2\2\u0125")
        buf.write("\u0126\f\7\2\2\u0126\u0127\7\4\2\2\u0127\u0135\5\30\r")
        buf.write("\b\u0128\u0129\f\6\2\2\u0129\u012a\t\2\2\2\u012a\u0135")
        buf.write("\5\30\r\7\u012b\u012c\f\5\2\2\u012c\u012d\t\3\2\2\u012d")
        buf.write("\u0135\5\30\r\6\u012e\u012f\f\4\2\2\u012f\u0130\t\4\2")
        buf.write("\2\u0130\u0135\5\30\r\5\u0131\u0132\f\3\2\2\u0132\u0133")
        buf.write("\t\5\2\2\u0133\u0135\5\30\r\4\u0134\u0125\3\2\2\2\u0134")
        buf.write("\u0128\3\2\2\2\u0134\u012b\3\2\2\2\u0134\u012e\3\2\2\2")
        buf.write("\u0134\u0131\3\2\2\2\u0135\u0138\3\2\2\2\u0136\u0134\3")
        buf.write("\2\2\2\u0136\u0137\3\2\2\2\u0137\31\3\2\2\2\u0138\u0136")
        buf.write("\3\2\2\2\u0139\u0140\7)\2\2\u013a\u0140\7*\2\2\u013b\u0140")
        buf.write("\7\61\2\2\u013c\u0140\7\63\2\2\u013d\u0140\5\34\17\2\u013e")
        buf.write("\u0140\7\62\2\2\u013f\u0139\3\2\2\2\u013f\u013a\3\2\2")
        buf.write("\2\u013f\u013b\3\2\2\2\u013f\u013c\3\2\2\2\u013f\u013d")
        buf.write("\3\2\2\2\u013f\u013e\3\2\2\2\u0140\33\3\2\2\2\u0141\u0142")
        buf.write("\7$\2\2\u0142\u0143\7\63\2\2\u0143\u0144\7\27\2\2\u0144")
        buf.write("\u014b\5\30\r\2\u0145\u0146\7\33\2\2\u0146\u0147\7\63")
        buf.write("\2\2\u0147\u0148\7\27\2\2\u0148\u014a\5\30\r\2\u0149\u0145")
        buf.write("\3\2\2\2\u014a\u014d\3\2\2\2\u014b\u0149\3\2\2\2\u014b")
        buf.write("\u014c\3\2\2\2\u014c\u014e\3\2\2\2\u014d\u014b\3\2\2\2")
        buf.write("\u014e\u014f\7%\2\2\u014f\u0150\7\16\2\2\u0150\u0151\7")
        buf.write("\63\2\2\u0151\35\3\2\2\2!!\'+\63=@NQfrz\u0088\u0095\u00ab")
        buf.write("\u00be\u00cd\u00d5\u00e7\u00ea\u00f5\u00fc\u0102\u010b")
        buf.write("\u010e\u0116\u011b\u0123\u0134\u0136\u013f\u014b")
        return buf.getvalue()


class pisteParser ( Parser ):

    grammarFileName = "piste.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'^'", "'**'", "'*'", "'/'", "'+'", "'-'", 
                     "'=='", "'!='", "'&&'", "'||'", "':'", "'as'", "'return'", 
                     "'let'", "'bound'", "'to'", "'extern'", "'if'", "'else'", 
                     "'then'", "'='", "'def'", "'import'", "'fun'", "','", 
                     "'!'", "'?*'", "'?'", "'channel'", "'in'", "'.'", "'('", 
                     "')'", "'{'", "'}'", "'['", "']'", "'|'", "'true'", 
                     "'false'", "'skip'", "'record'", "'int'", "'bool'", 
                     "'string'", "'void'" ]

    symbolicNames = [ "<INVALID>", "CARET", "POW", "MULT", "DIV", "ADD", 
                      "SUB", "EQEQ", "NEQ", "AND", "OR", "COLON", "AS", 
                      "RETURN", "LET", "BOUND", "TO", "EXTERN", "IF", "ELSE", 
                      "THEN", "EQ", "DEF", "IMPORT", "FUN", "COMMA", "SEND", 
                      "RECEIVE_REPLICATED", "RECEIVE", "CHANNEL", "IN", 
                      "DOT", "PAREN_LEFT", "PAREN_RIGHT", "BRACE_LEFT", 
                      "BRACE_RIGHT", "SQUARE_LEFT", "SQUARE_RIGHT", "PARALLEL", 
                      "TRUE", "FALSE", "INACTION", "RECORD", "INT_T", "BOOL_T", 
                      "STRING_T", "VOID_T", "STRING", "INTEGER", "IDENTIFIER", 
                      "SYMBOL_IDENTIFIER", "WS", "COMMENT" ]

    RULE_program = 0
    RULE_import_statement = 1
    RULE_declaration = 2
    RULE_process_declaration = 3
    RULE_extern_declaration = 4
    RULE_record_declaration = 5
    RULE_type_name = 6
    RULE_message_type = 7
    RULE_process = 8
    RULE_value_binding = 9
    RULE_identifier_with_type = 10
    RULE_expression = 11
    RULE_value = 12
    RULE_record = 13

    ruleNames =  [ "program", "import_statement", "declaration", "process_declaration", 
                   "extern_declaration", "record_declaration", "type_name", 
                   "message_type", "process", "value_binding", "identifier_with_type", 
                   "expression", "value", "record" ]

    EOF = Token.EOF
    CARET=1
    POW=2
    MULT=3
    DIV=4
    ADD=5
    SUB=6
    EQEQ=7
    NEQ=8
    AND=9
    OR=10
    COLON=11
    AS=12
    RETURN=13
    LET=14
    BOUND=15
    TO=16
    EXTERN=17
    IF=18
    ELSE=19
    THEN=20
    EQ=21
    DEF=22
    IMPORT=23
    FUN=24
    COMMA=25
    SEND=26
    RECEIVE_REPLICATED=27
    RECEIVE=28
    CHANNEL=29
    IN=30
    DOT=31
    PAREN_LEFT=32
    PAREN_RIGHT=33
    BRACE_LEFT=34
    BRACE_RIGHT=35
    SQUARE_LEFT=36
    SQUARE_RIGHT=37
    PARALLEL=38
    TRUE=39
    FALSE=40
    INACTION=41
    RECORD=42
    INT_T=43
    BOOL_T=44
    STRING_T=45
    VOID_T=46
    STRING=47
    INTEGER=48
    IDENTIFIER=49
    SYMBOL_IDENTIFIER=50
    WS=51
    COMMENT=52

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.9.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class ProgramContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def import_statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Import_statementContext)
            else:
                return self.getTypedRuleContext(pisteParser.Import_statementContext,i)


        def declaration(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.DeclarationContext)
            else:
                return self.getTypedRuleContext(pisteParser.DeclarationContext,i)


        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)


        def getRuleIndex(self):
            return pisteParser.RULE_program

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProgram" ):
                return visitor.visitProgram(self)
            else:
                return visitor.visitChildren(self)




    def program(self):

        localctx = pisteParser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 31
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.IMPORT:
                self.state = 28
                self.import_statement()
                self.state = 33
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 37
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,1,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 34
                    self.declaration() 
                self.state = 39
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,1,self._ctx)

            self.state = 41
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << pisteParser.RETURN) | (1 << pisteParser.LET) | (1 << pisteParser.IF) | (1 << pisteParser.DEF) | (1 << pisteParser.FUN) | (1 << pisteParser.CHANNEL) | (1 << pisteParser.PAREN_LEFT) | (1 << pisteParser.BRACE_LEFT) | (1 << pisteParser.TRUE) | (1 << pisteParser.FALSE) | (1 << pisteParser.INACTION) | (1 << pisteParser.STRING) | (1 << pisteParser.INTEGER) | (1 << pisteParser.IDENTIFIER))) != 0):
                self.state = 40
                self.process(0)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Import_statementContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IMPORT(self):
            return self.getToken(pisteParser.IMPORT, 0)

        def STRING(self):
            return self.getToken(pisteParser.STRING, 0)

        def getRuleIndex(self):
            return pisteParser.RULE_import_statement

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitImport_statement" ):
                return visitor.visitImport_statement(self)
            else:
                return visitor.visitChildren(self)




    def import_statement(self):

        localctx = pisteParser.Import_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_import_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 43
            self.match(pisteParser.IMPORT)
            self.state = 44
            self.match(pisteParser.STRING)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def record_declaration(self):
            return self.getTypedRuleContext(pisteParser.Record_declarationContext,0)


        def process_declaration(self):
            return self.getTypedRuleContext(pisteParser.Process_declarationContext,0)


        def extern_declaration(self):
            return self.getTypedRuleContext(pisteParser.Extern_declarationContext,0)


        def getRuleIndex(self):
            return pisteParser.RULE_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDeclaration" ):
                return visitor.visitDeclaration(self)
            else:
                return visitor.visitChildren(self)




    def declaration(self):

        localctx = pisteParser.DeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_declaration)
        try:
            self.state = 49
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.RECORD]:
                self.enterOuterAlt(localctx, 1)
                self.state = 46
                self.record_declaration()
                pass
            elif token in [pisteParser.DEF]:
                self.enterOuterAlt(localctx, 2)
                self.state = 47
                self.process_declaration()
                pass
            elif token in [pisteParser.EXTERN]:
                self.enterOuterAlt(localctx, 3)
                self.state = 48
                self.extern_declaration()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Process_declarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.body = None # ProcessContext

        def DEF(self):
            return self.getToken(pisteParser.DEF, 0)

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)

        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)


        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_process_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProcess_declaration" ):
                return visitor.visitProcess_declaration(self)
            else:
                return visitor.visitChildren(self)




    def process_declaration(self):

        localctx = pisteParser.Process_declarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_process_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 51
            self.match(pisteParser.DEF)
            self.state = 52
            self.match(pisteParser.IDENTIFIER)
            self.state = 53
            self.match(pisteParser.SQUARE_LEFT)
            self.state = 62
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==pisteParser.IDENTIFIER:
                self.state = 54
                self.identifier_with_type()
                self.state = 59
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 55
                    self.match(pisteParser.COMMA)
                    self.state = 56
                    self.identifier_with_type()
                    self.state = 61
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 64
            self.match(pisteParser.SQUARE_RIGHT)
            self.state = 65
            self.match(pisteParser.EQ)
            self.state = 66
            localctx.body = self.process(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Extern_declarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EXTERN(self):
            return self.getToken(pisteParser.EXTERN, 0)

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)

        def COLON(self):
            return self.getToken(pisteParser.COLON, 0)

        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)


        def BOUND(self):
            return self.getToken(pisteParser.BOUND, 0)

        def TO(self):
            return self.getToken(pisteParser.TO, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_extern_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExtern_declaration" ):
                return visitor.visitExtern_declaration(self)
            else:
                return visitor.visitChildren(self)




    def extern_declaration(self):

        localctx = pisteParser.Extern_declarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_extern_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 68
            self.match(pisteParser.EXTERN)
            self.state = 69
            self.match(pisteParser.IDENTIFIER)
            self.state = 70
            self.match(pisteParser.PAREN_LEFT)
            self.state = 79
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << pisteParser.CARET) | (1 << pisteParser.INT_T) | (1 << pisteParser.BOOL_T) | (1 << pisteParser.STRING_T) | (1 << pisteParser.VOID_T) | (1 << pisteParser.IDENTIFIER))) != 0):
                self.state = 71
                self.type_name()
                self.state = 76
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 72
                    self.match(pisteParser.COMMA)
                    self.state = 73
                    self.type_name()
                    self.state = 78
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 81
            self.match(pisteParser.PAREN_RIGHT)
            self.state = 82
            self.match(pisteParser.COLON)
            self.state = 83
            self.type_name()
            self.state = 84
            self.match(pisteParser.BOUND)
            self.state = 85
            self.match(pisteParser.TO)
            self.state = 86
            self.match(pisteParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Record_declarationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def RECORD(self):
            return self.getToken(pisteParser.RECORD, 0)

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)

        def BRACE_LEFT(self):
            return self.getToken(pisteParser.BRACE_LEFT, 0)

        def COLON(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COLON)
            else:
                return self.getToken(pisteParser.COLON, i)

        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)


        def BRACE_RIGHT(self):
            return self.getToken(pisteParser.BRACE_RIGHT, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_record_declaration

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRecord_declaration" ):
                return visitor.visitRecord_declaration(self)
            else:
                return visitor.visitChildren(self)




    def record_declaration(self):

        localctx = pisteParser.Record_declarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_record_declaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 88
            self.match(pisteParser.RECORD)
            self.state = 89
            self.match(pisteParser.IDENTIFIER)
            self.state = 90
            self.match(pisteParser.BRACE_LEFT)
            self.state = 91
            self.match(pisteParser.IDENTIFIER)
            self.state = 92
            self.match(pisteParser.COLON)
            self.state = 93
            self.type_name()
            self.state = 100
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.COMMA:
                self.state = 94
                self.match(pisteParser.COMMA)
                self.state = 95
                self.match(pisteParser.IDENTIFIER)
                self.state = 96
                self.match(pisteParser.COLON)
                self.state = 97
                self.type_name()
                self.state = 102
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 103
            self.match(pisteParser.BRACE_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Type_nameContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_type_name

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Type_stringContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def STRING_T(self):
            return self.getToken(pisteParser.STRING_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_string" ):
                return visitor.visitType_string(self)
            else:
                return visitor.visitChildren(self)


    class Type_boolContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def BOOL_T(self):
            return self.getToken(pisteParser.BOOL_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_bool" ):
                return visitor.visitType_bool(self)
            else:
                return visitor.visitChildren(self)


    class Type_voidContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def VOID_T(self):
            return self.getToken(pisteParser.VOID_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_void" ):
                return visitor.visitType_void(self)
            else:
                return visitor.visitChildren(self)


    class Type_channelContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CARET(self):
            return self.getToken(pisteParser.CARET, 0)
        def message_type(self):
            return self.getTypedRuleContext(pisteParser.Message_typeContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_channel" ):
                return visitor.visitType_channel(self)
            else:
                return visitor.visitChildren(self)


    class Type_identifierContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_identifier" ):
                return visitor.visitType_identifier(self)
            else:
                return visitor.visitChildren(self)


    class Type_intContext(Type_nameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Type_nameContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INT_T(self):
            return self.getToken(pisteParser.INT_T, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_int" ):
                return visitor.visitType_int(self)
            else:
                return visitor.visitChildren(self)



    def type_name(self):

        localctx = pisteParser.Type_nameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_type_name)
        try:
            self.state = 112
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.INT_T]:
                localctx = pisteParser.Type_intContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 105
                self.match(pisteParser.INT_T)
                pass
            elif token in [pisteParser.BOOL_T]:
                localctx = pisteParser.Type_boolContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 106
                self.match(pisteParser.BOOL_T)
                pass
            elif token in [pisteParser.VOID_T]:
                localctx = pisteParser.Type_voidContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 107
                self.match(pisteParser.VOID_T)
                pass
            elif token in [pisteParser.STRING_T]:
                localctx = pisteParser.Type_stringContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 108
                self.match(pisteParser.STRING_T)
                pass
            elif token in [pisteParser.CARET]:
                localctx = pisteParser.Type_channelContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 109
                self.match(pisteParser.CARET)
                self.state = 110
                self.message_type()
                pass
            elif token in [pisteParser.IDENTIFIER]:
                localctx = pisteParser.Type_identifierContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 111
                self.match(pisteParser.IDENTIFIER)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Message_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)

        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)


        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_message_type

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMessage_type" ):
                return visitor.visitMessage_type(self)
            else:
                return visitor.visitChildren(self)




    def message_type(self):

        localctx = pisteParser.Message_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_message_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(pisteParser.SQUARE_LEFT)
            self.state = 115
            self.type_name()
            self.state = 120
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.COMMA:
                self.state = 116
                self.match(pisteParser.COMMA)
                self.state = 117
                self.type_name()
                self.state = 122
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 123
            self.match(pisteParser.SQUARE_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ProcessContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_process

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class OutputContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.receiver = None # ExpressionContext
            self.copyFrom(ctx)

        def SEND(self):
            return self.getToken(pisteParser.SEND, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOutput" ):
                return visitor.visitOutput(self)
            else:
                return visitor.visitChildren(self)


    class Replicated_inputContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def RECEIVE_REPLICATED(self):
            return self.getToken(pisteParser.RECEIVE_REPLICATED, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReplicated_input" ):
                return visitor.visitReplicated_input(self)
            else:
                return visitor.visitChildren(self)


    class Function_defContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.body = None # ProcessContext
            self.continuation = None # ProcessContext
            self.copyFrom(ctx)

        def FUN(self):
            return self.getToken(pisteParser.FUN, 0)
        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)
        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)
        def COLON(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COLON)
            else:
                return self.getToken(pisteParser.COLON, i)
        def type_name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Type_nameContext)
            else:
                return self.getTypedRuleContext(pisteParser.Type_nameContext,i)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFunction_def" ):
                return visitor.visitFunction_def(self)
            else:
                return visitor.visitChildren(self)


    class InputContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def RECEIVE(self):
            return self.getToken(pisteParser.RECEIVE, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitInput" ):
                return visitor.visitInput(self)
            else:
                return visitor.visitChildren(self)


    class ParenContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitParen" ):
                return visitor.visitParen(self)
            else:
                return visitor.visitChildren(self)


    class Process_defContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.body = None # ProcessContext
            self.continuation = None # ProcessContext
            self.copyFrom(ctx)

        def DEF(self):
            return self.getToken(pisteParser.DEF, 0)
        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)
        def SQUARE_LEFT(self):
            return self.getToken(pisteParser.SQUARE_LEFT, 0)
        def identifier_with_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Identifier_with_typeContext)
            else:
                return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,i)

        def SQUARE_RIGHT(self):
            return self.getToken(pisteParser.SQUARE_RIGHT, 0)
        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProcess_def" ):
                return visitor.visitProcess_def(self)
            else:
                return visitor.visitChildren(self)


    class Let_bindingContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LET(self):
            return self.getToken(pisteParser.LET, 0)
        def value_binding(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.Value_bindingContext)
            else:
                return self.getTypedRuleContext(pisteParser.Value_bindingContext,i)

        def IN(self):
            return self.getToken(pisteParser.IN, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLet_binding" ):
                return visitor.visitLet_binding(self)
            else:
                return visitor.visitChildren(self)


    class InactionContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INACTION(self):
            return self.getToken(pisteParser.INACTION, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitInaction" ):
                return visitor.visitInaction(self)
            else:
                return visitor.visitChildren(self)


    class ConditionalContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.true_branch = None # ProcessContext
            self.false_branch = None # ProcessContext
            self.copyFrom(ctx)

        def IF(self):
            return self.getToken(pisteParser.IF, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def THEN(self):
            return self.getToken(pisteParser.THEN, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)

        def ELSE(self):
            return self.getToken(pisteParser.ELSE, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitConditional" ):
                return visitor.visitConditional(self)
            else:
                return visitor.visitChildren(self)


    class ParallelContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.left = None # ProcessContext
            self.right = None # ProcessContext
            self.copyFrom(ctx)

        def PARALLEL(self):
            return self.getToken(pisteParser.PARALLEL, 0)
        def process(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ProcessContext)
            else:
                return self.getTypedRuleContext(pisteParser.ProcessContext,i)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitParallel" ):
                return visitor.visitParallel(self)
            else:
                return visitor.visitChildren(self)


    class RestrictionContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CHANNEL(self):
            return self.getToken(pisteParser.CHANNEL, 0)
        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)
        def COLON(self):
            return self.getToken(pisteParser.COLON, 0)
        def type_name(self):
            return self.getTypedRuleContext(pisteParser.Type_nameContext,0)

        def IN(self):
            return self.getToken(pisteParser.IN, 0)
        def process(self):
            return self.getTypedRuleContext(pisteParser.ProcessContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRestriction" ):
                return visitor.visitRestriction(self)
            else:
                return visitor.visitChildren(self)


    class ReturnContext(ProcessContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ProcessContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def RETURN(self):
            return self.getToken(pisteParser.RETURN, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReturn" ):
                return visitor.visitReturn(self)
            else:
                return visitor.visitChildren(self)



    def process(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = pisteParser.ProcessContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 16
        self.enterRecursionRule(localctx, 16, self.RULE_process, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 243
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,19,self._ctx)
            if la_ == 1:
                localctx = pisteParser.OutputContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 126
                localctx.receiver = self.expression(0)
                self.state = 127
                self.match(pisteParser.SEND)
                self.state = 128
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 129
                self.expression(0)
                self.state = 134
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 130
                    self.match(pisteParser.COMMA)
                    self.state = 131
                    self.expression(0)
                    self.state = 136
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 137
                self.match(pisteParser.SQUARE_RIGHT)
                pass

            elif la_ == 2:
                localctx = pisteParser.InputContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 139
                self.expression(0)
                self.state = 140
                self.match(pisteParser.RECEIVE)
                self.state = 141
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 142
                self.identifier_with_type()
                self.state = 147
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 143
                    self.match(pisteParser.COMMA)
                    self.state = 144
                    self.identifier_with_type()
                    self.state = 149
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 150
                self.match(pisteParser.SQUARE_RIGHT)
                self.state = 151
                self.match(pisteParser.EQ)
                self.state = 152
                self.process(11)
                pass

            elif la_ == 3:
                localctx = pisteParser.RestrictionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 154
                self.match(pisteParser.CHANNEL)
                self.state = 155
                self.match(pisteParser.IDENTIFIER)
                self.state = 156
                self.match(pisteParser.COLON)
                self.state = 157
                self.type_name()
                self.state = 158
                self.match(pisteParser.IN)
                self.state = 159
                self.process(10)
                pass

            elif la_ == 4:
                localctx = pisteParser.Replicated_inputContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 161
                self.expression(0)
                self.state = 162
                self.match(pisteParser.RECEIVE_REPLICATED)
                self.state = 163
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 164
                self.identifier_with_type()
                self.state = 169
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 165
                    self.match(pisteParser.COMMA)
                    self.state = 166
                    self.identifier_with_type()
                    self.state = 171
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 172
                self.match(pisteParser.SQUARE_RIGHT)
                self.state = 173
                self.match(pisteParser.EQ)
                self.state = 174
                self.process(9)
                pass

            elif la_ == 5:
                localctx = pisteParser.ParenContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 176
                self.match(pisteParser.PAREN_LEFT)
                self.state = 177
                self.process(0)
                self.state = 178
                self.match(pisteParser.PAREN_RIGHT)
                pass

            elif la_ == 6:
                localctx = pisteParser.Process_defContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 180
                self.match(pisteParser.DEF)
                self.state = 181
                self.match(pisteParser.IDENTIFIER)
                self.state = 182
                self.match(pisteParser.SQUARE_LEFT)
                self.state = 183
                self.identifier_with_type()
                self.state = 188
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 184
                    self.match(pisteParser.COMMA)
                    self.state = 185
                    self.identifier_with_type()
                    self.state = 190
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 191
                self.match(pisteParser.SQUARE_RIGHT)
                self.state = 192
                self.match(pisteParser.EQ)
                self.state = 193
                localctx.body = self.process(0)
                self.state = 194
                localctx.continuation = self.process(7)
                pass

            elif la_ == 7:
                localctx = pisteParser.InactionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 196
                self.match(pisteParser.INACTION)
                pass

            elif la_ == 8:
                localctx = pisteParser.ConditionalContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 197
                self.match(pisteParser.IF)
                self.state = 198
                self.expression(0)
                self.state = 199
                self.match(pisteParser.THEN)
                self.state = 200
                localctx.true_branch = self.process(0)
                self.state = 203
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
                if la_ == 1:
                    self.state = 201
                    self.match(pisteParser.ELSE)
                    self.state = 202
                    localctx.false_branch = self.process(0)


                pass

            elif la_ == 9:
                localctx = pisteParser.Let_bindingContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 205
                self.match(pisteParser.LET)
                self.state = 206
                self.value_binding()
                self.state = 211
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==pisteParser.COMMA:
                    self.state = 207
                    self.match(pisteParser.COMMA)
                    self.state = 208
                    self.value_binding()
                    self.state = 213
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 214
                self.match(pisteParser.IN)
                self.state = 215
                self.process(4)
                pass

            elif la_ == 10:
                localctx = pisteParser.Function_defContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 217
                self.match(pisteParser.FUN)
                self.state = 218
                self.match(pisteParser.IDENTIFIER)
                self.state = 219
                self.match(pisteParser.PAREN_LEFT)
                self.state = 232
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==pisteParser.IDENTIFIER:
                    self.state = 220
                    self.match(pisteParser.IDENTIFIER)
                    self.state = 221
                    self.match(pisteParser.COLON)
                    self.state = 222
                    self.type_name()
                    self.state = 229
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==pisteParser.COMMA:
                        self.state = 223
                        self.match(pisteParser.COMMA)
                        self.state = 224
                        self.match(pisteParser.IDENTIFIER)
                        self.state = 225
                        self.match(pisteParser.COLON)
                        self.state = 226
                        self.type_name()
                        self.state = 231
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)



                self.state = 234
                self.match(pisteParser.PAREN_RIGHT)
                self.state = 235
                self.match(pisteParser.COLON)
                self.state = 236
                self.type_name()
                self.state = 237
                self.match(pisteParser.EQ)
                self.state = 238
                localctx.body = self.process(0)
                self.state = 239
                localctx.continuation = self.process(3)
                pass

            elif la_ == 11:
                localctx = pisteParser.ReturnContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 241
                self.match(pisteParser.RETURN)
                self.state = 242
                self.expression(0)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 250
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,20,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = pisteParser.ParallelContext(self, pisteParser.ProcessContext(self, _parentctx, _parentState))
                    localctx.left = _prevctx
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_process)
                    self.state = 245
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 246
                    self.match(pisteParser.PARALLEL)
                    self.state = 247
                    localctx.right = self.process(1) 
                self.state = 252
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,20,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class Value_bindingContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_value_binding

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class Simple_value_bindingContext(Value_bindingContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Value_bindingContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def identifier_with_type(self):
            return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,0)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSimple_value_binding" ):
                return visitor.visitSimple_value_binding(self)
            else:
                return visitor.visitChildren(self)


    class Call_bindingContext(Value_bindingContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.Value_bindingContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)
        def identifier_with_type(self):
            return self.getTypedRuleContext(pisteParser.Identifier_with_typeContext,0)

        def EQ(self):
            return self.getToken(pisteParser.EQ, 0)
        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCall_binding" ):
                return visitor.visitCall_binding(self)
            else:
                return visitor.visitChildren(self)



    def value_binding(self):

        localctx = pisteParser.Value_bindingContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_value_binding)
        self._la = 0 # Token type
        try:
            self.state = 276
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,24,self._ctx)
            if la_ == 1:
                localctx = pisteParser.Call_bindingContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 256
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,21,self._ctx)
                if la_ == 1:
                    self.state = 253
                    self.identifier_with_type()
                    self.state = 254
                    self.match(pisteParser.EQ)


                self.state = 258
                self.expression(0)
                self.state = 259
                self.match(pisteParser.PAREN_LEFT)
                self.state = 268
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << pisteParser.PAREN_LEFT) | (1 << pisteParser.BRACE_LEFT) | (1 << pisteParser.TRUE) | (1 << pisteParser.FALSE) | (1 << pisteParser.STRING) | (1 << pisteParser.INTEGER) | (1 << pisteParser.IDENTIFIER))) != 0):
                    self.state = 260
                    self.expression(0)
                    self.state = 265
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==pisteParser.COMMA:
                        self.state = 261
                        self.match(pisteParser.COMMA)
                        self.state = 262
                        self.expression(0)
                        self.state = 267
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)



                self.state = 270
                self.match(pisteParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                localctx = pisteParser.Simple_value_bindingContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 272
                self.identifier_with_type()
                self.state = 273
                self.match(pisteParser.EQ)
                self.state = 274
                self.expression(0)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Identifier_with_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def COLON(self):
            return self.getToken(pisteParser.COLON, 0)

        def type_name(self):
            return self.getTypedRuleContext(pisteParser.Type_nameContext,0)


        def getRuleIndex(self):
            return pisteParser.RULE_identifier_with_type

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIdentifier_with_type" ):
                return visitor.visitIdentifier_with_type(self)
            else:
                return visitor.visitChildren(self)




    def identifier_with_type(self):

        localctx = pisteParser.Identifier_with_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_identifier_with_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 278
            self.match(pisteParser.IDENTIFIER)
            self.state = 281
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==pisteParser.COLON:
                self.state = 279
                self.match(pisteParser.COLON)
                self.state = 280
                self.type_name()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_expression

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class Paren_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(pisteParser.PAREN_LEFT, 0)
        def expression(self):
            return self.getTypedRuleContext(pisteParser.ExpressionContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(pisteParser.PAREN_RIGHT, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitParen_expr" ):
                return visitor.visitParen_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_pow_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def POW(self):
            return self.getToken(pisteParser.POW, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_pow_expr" ):
                return visitor.visitOperator_pow_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_ao_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def AND(self):
            return self.getToken(pisteParser.AND, 0)
        def OR(self):
            return self.getToken(pisteParser.OR, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_ao_expr" ):
                return visitor.visitOperator_ao_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_as_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def ADD(self):
            return self.getToken(pisteParser.ADD, 0)
        def SUB(self):
            return self.getToken(pisteParser.SUB, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_as_expr" ):
                return visitor.visitOperator_as_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_md_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def MULT(self):
            return self.getToken(pisteParser.MULT, 0)
        def DIV(self):
            return self.getToken(pisteParser.DIV, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_md_expr" ):
                return visitor.visitOperator_md_expr(self)
            else:
                return visitor.visitChildren(self)


    class Operator_en_exprContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)

        def EQEQ(self):
            return self.getToken(pisteParser.EQEQ, 0)
        def NEQ(self):
            return self.getToken(pisteParser.NEQ, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOperator_en_expr" ):
                return visitor.visitOperator_en_expr(self)
            else:
                return visitor.visitChildren(self)


    class LiteralContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def value(self):
            return self.getTypedRuleContext(pisteParser.ValueContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteral" ):
                return visitor.visitLiteral(self)
            else:
                return visitor.visitChildren(self)



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = pisteParser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 22
        self.enterRecursionRule(localctx, 22, self.RULE_expression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 289
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.PAREN_LEFT]:
                localctx = pisteParser.Paren_exprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 284
                self.match(pisteParser.PAREN_LEFT)
                self.state = 285
                self.expression(0)
                self.state = 286
                self.match(pisteParser.PAREN_RIGHT)
                pass
            elif token in [pisteParser.BRACE_LEFT, pisteParser.TRUE, pisteParser.FALSE, pisteParser.STRING, pisteParser.INTEGER, pisteParser.IDENTIFIER]:
                localctx = pisteParser.LiteralContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 288
                self.value()
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 308
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,28,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 306
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
                    if la_ == 1:
                        localctx = pisteParser.Operator_pow_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 291
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 292
                        self.match(pisteParser.POW)
                        self.state = 293
                        self.expression(6)
                        pass

                    elif la_ == 2:
                        localctx = pisteParser.Operator_md_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 294
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 295
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.MULT or _la==pisteParser.DIV):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 296
                        self.expression(5)
                        pass

                    elif la_ == 3:
                        localctx = pisteParser.Operator_as_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 297
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 298
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.ADD or _la==pisteParser.SUB):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 299
                        self.expression(4)
                        pass

                    elif la_ == 4:
                        localctx = pisteParser.Operator_en_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 300
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 301
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.EQEQ or _la==pisteParser.NEQ):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 302
                        self.expression(3)
                        pass

                    elif la_ == 5:
                        localctx = pisteParser.Operator_ao_exprContext(self, pisteParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 303
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 304
                        _la = self._input.LA(1)
                        if not(_la==pisteParser.AND or _la==pisteParser.OR):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 305
                        self.expression(2)
                        pass

             
                self.state = 310
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,28,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class ValueContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return pisteParser.RULE_value

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class True_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TRUE(self):
            return self.getToken(pisteParser.TRUE, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTrue_val" ):
                return visitor.visitTrue_val(self)
            else:
                return visitor.visitChildren(self)


    class Record_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def record(self):
            return self.getTypedRuleContext(pisteParser.RecordContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRecord_val" ):
                return visitor.visitRecord_val(self)
            else:
                return visitor.visitChildren(self)


    class String_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def STRING(self):
            return self.getToken(pisteParser.STRING, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitString_val" ):
                return visitor.visitString_val(self)
            else:
                return visitor.visitChildren(self)


    class Int_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def INTEGER(self):
            return self.getToken(pisteParser.INTEGER, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitInt_val" ):
                return visitor.visitInt_val(self)
            else:
                return visitor.visitChildren(self)


    class False_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def FALSE(self):
            return self.getToken(pisteParser.FALSE, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFalse_val" ):
                return visitor.visitFalse_val(self)
            else:
                return visitor.visitChildren(self)


    class Identifier_valContext(ValueContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a pisteParser.ValueContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(pisteParser.IDENTIFIER, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIdentifier_val" ):
                return visitor.visitIdentifier_val(self)
            else:
                return visitor.visitChildren(self)



    def value(self):

        localctx = pisteParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_value)
        try:
            self.state = 317
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [pisteParser.TRUE]:
                localctx = pisteParser.True_valContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 311
                self.match(pisteParser.TRUE)
                pass
            elif token in [pisteParser.FALSE]:
                localctx = pisteParser.False_valContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 312
                self.match(pisteParser.FALSE)
                pass
            elif token in [pisteParser.STRING]:
                localctx = pisteParser.String_valContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 313
                self.match(pisteParser.STRING)
                pass
            elif token in [pisteParser.IDENTIFIER]:
                localctx = pisteParser.Identifier_valContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 314
                self.match(pisteParser.IDENTIFIER)
                pass
            elif token in [pisteParser.BRACE_LEFT]:
                localctx = pisteParser.Record_valContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 315
                self.record()
                pass
            elif token in [pisteParser.INTEGER]:
                localctx = pisteParser.Int_valContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 316
                self.match(pisteParser.INTEGER)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RecordContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BRACE_LEFT(self):
            return self.getToken(pisteParser.BRACE_LEFT, 0)

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.IDENTIFIER)
            else:
                return self.getToken(pisteParser.IDENTIFIER, i)

        def EQ(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.EQ)
            else:
                return self.getToken(pisteParser.EQ, i)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(pisteParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(pisteParser.ExpressionContext,i)


        def BRACE_RIGHT(self):
            return self.getToken(pisteParser.BRACE_RIGHT, 0)

        def AS(self):
            return self.getToken(pisteParser.AS, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(pisteParser.COMMA)
            else:
                return self.getToken(pisteParser.COMMA, i)

        def getRuleIndex(self):
            return pisteParser.RULE_record

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRecord" ):
                return visitor.visitRecord(self)
            else:
                return visitor.visitChildren(self)




    def record(self):

        localctx = pisteParser.RecordContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_record)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 319
            self.match(pisteParser.BRACE_LEFT)
            self.state = 320
            self.match(pisteParser.IDENTIFIER)
            self.state = 321
            self.match(pisteParser.EQ)
            self.state = 322
            self.expression(0)
            self.state = 329
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==pisteParser.COMMA:
                self.state = 323
                self.match(pisteParser.COMMA)
                self.state = 324
                self.match(pisteParser.IDENTIFIER)
                self.state = 325
                self.match(pisteParser.EQ)
                self.state = 326
                self.expression(0)
                self.state = 331
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 332
            self.match(pisteParser.BRACE_RIGHT)
            self.state = 333
            self.match(pisteParser.AS)
            self.state = 334
            self.match(pisteParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[8] = self.process_sempred
        self._predicates[11] = self.expression_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def process_sempred(self, localctx:ProcessContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 1)
         

    def expression_sempred(self, localctx:ExpressionContext, predIndex:int):
            if predIndex == 1:
                return self.precpred(self._ctx, 5)
         

            if predIndex == 2:
                return self.precpred(self._ctx, 4)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 1)
# Generated from /home/mathias/gitrepos/piste/compiler/piste.g4 by ANTLR 4.9.2 # encoding: utf-8 #\13\2\3\2\7\2&\n") #\3\2\2\2!\37\3\2\2\2!\"\3\2\2\2\"\'\3\2\2\2") #\2\2TU\7\r\2\2UV\5\16") #\2\2\u00b5\u00f6\3\2\2\2\u00b6") #\2\2\u00ed\u00ee\7\r\2\2\u00ee\u00ef\5\16\b\2\u00ef") #\2\2\u0111\u0117\3\2\2\2\u0112") #\2\2") # Token type # ProcessContext # Token type # Token type # Token type # actually a pisteParser.Type_nameContext # actually a pisteParser.Type_nameContext # actually a pisteParser.Type_nameContext # actually a pisteParser.Type_nameContext # actually a pisteParser.Type_nameContext # actually a pisteParser.Type_nameContext # Token type # actually a pisteParser.ProcessContext # ExpressionContext # actually a pisteParser.ProcessContext # actually a pisteParser.ProcessContext # ProcessContext # ProcessContext # actually a pisteParser.ProcessContext # actually a pisteParser.ProcessContext # actually a pisteParser.ProcessContext # ProcessContext # ProcessContext # actually a pisteParser.ProcessContext # actually a pisteParser.ProcessContext # actually a pisteParser.ProcessContext # ProcessContext # ProcessContext # actually a pisteParser.ProcessContext # ProcessContext # ProcessContext # actually a pisteParser.ProcessContext # actually a pisteParser.ProcessContext # Token type # actually a pisteParser.Value_bindingContext # actually a pisteParser.Value_bindingContext # Token type # Token type # actually a pisteParser.ExpressionContext # actually a pisteParser.ExpressionContext # actually a pisteParser.ExpressionContext # actually a pisteParser.ExpressionContext # actually a pisteParser.ExpressionContext # actually a pisteParser.ExpressionContext # actually a pisteParser.ExpressionContext # Token type # actually a pisteParser.ValueContext # actually a pisteParser.ValueContext # actually a pisteParser.ValueContext # actually a pisteParser.ValueContext # actually a pisteParser.ValueContext # actually a pisteParser.ValueContext # Token type