# Generated from Glacier.g4 by ANTLR 4.8
# 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@")
        buf.write("\u016a\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\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\3\2\3\2\7\2-\n\2\f\2\16\2\60\13\2")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\5\38\n\3\3\3\7\3;\n\3\f\3\16")
        buf.write("\3>\13\3\3\3\3\3\3\3\7\3C\n\3\f\3\16\3F\13\3\3\3\3\3\3")
        buf.write("\4\3\4\3\4\3\4\7\4N\n\4\f\4\16\4Q\13\4\3\4\3\4\3\5\3\5")
        buf.write("\3\5\3\5\3\5\3\5\3\5\3\5\3\5\5\5^\n\5\3\5\3\5\3\5\3\5")
        buf.write("\5\5d\n\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5")
        buf.write("\3\5\7\5r\n\5\f\5\16\5u\13\5\5\5w\n\5\3\5\3\5\3\5\3\5")
        buf.write("\3\5\7\5~\n\5\f\5\16\5\u0081\13\5\3\5\3\5\3\5\3\5\3\5")
        buf.write("\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3")
        buf.write("\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5")
        buf.write("\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\7\5\u00ad\n\5")
        buf.write("\f\5\16\5\u00b0\13\5\3\5\3\5\5\5\u00b4\n\5\3\5\3\5\3\5")
        buf.write("\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\7\5\u00c2\n\5\f\5")
        buf.write("\16\5\u00c5\13\5\5\5\u00c7\n\5\3\5\3\5\3\5\3\5\3\5\3\5")
        buf.write("\7\5\u00cf\n\5\f\5\16\5\u00d2\13\5\3\6\3\6\3\6\7\6\u00d7")
        buf.write("\n\6\f\6\16\6\u00da\13\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3")
        buf.write("\7\3\b\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3")
        buf.write("\r\3\r\5\r\u00f2\n\r\3\16\3\16\3\16\3\16\7\16\u00f8\n")
        buf.write("\16\f\16\16\16\u00fb\13\16\3\16\3\16\3\17\3\17\3\17\3")
        buf.write("\17\7\17\u0103\n\17\f\17\16\17\u0106\13\17\3\17\3\17\3")
        buf.write("\20\3\20\3\20\7\20\u010d\n\20\f\20\16\20\u0110\13\20\3")
        buf.write("\21\3\21\3\21\3\21\3\21\3\21\3\21\5\21\u0119\n\21\3\21")
        buf.write("\3\21\3\21\3\21\3\21\7\21\u0120\n\21\f\21\16\21\u0123")
        buf.write("\13\21\3\21\7\21\u0126\n\21\f\21\16\21\u0129\13\21\3\21")
        buf.write("\3\21\3\21\3\21\3\21\7\21\u0130\n\21\f\21\16\21\u0133")
        buf.write("\13\21\5\21\u0135\n\21\3\21\3\21\3\21\3\21\3\21\5\21\u013c")
        buf.write("\n\21\3\21\3\21\3\21\3\21\3\21\5\21\u0143\n\21\3\21\3")
        buf.write("\21\5\21\u0147\n\21\3\21\3\21\3\21\7\21\u014c\n\21\f\21")
        buf.write("\16\21\u014f\13\21\3\22\3\22\3\23\3\23\3\24\3\24\3\24")
        buf.write("\3\24\3\24\7\24\u015a\n\24\f\24\16\24\u015d\13\24\5\24")
        buf.write("\u015f\n\24\3\24\3\24\3\25\3\25\3\25\6\25\u0166\n\25\r")
        buf.write("\25\16\25\u0167\3\25\2\4\b \26\2\4\6\b\n\f\16\20\22\24")
        buf.write("\26\30\32\34\36 \"$&(\2\6\3\2 !\5\2\r\r\37\37\",\4\2#")
        buf.write("#,\61\3\2\638\2\u0193\2.\3\2\2\2\4\61\3\2\2\2\6I\3\2\2")
        buf.write("\2\b\u00b3\3\2\2\2\n\u00d3\3\2\2\2\f\u00dd\3\2\2\2\16")
        buf.write("\u00e3\3\2\2\2\20\u00e6\3\2\2\2\22\u00e8\3\2\2\2\24\u00ea")
        buf.write("\3\2\2\2\26\u00ec\3\2\2\2\30\u00ee\3\2\2\2\32\u00f3\3")
        buf.write("\2\2\2\34\u00fe\3\2\2\2\36\u0109\3\2\2\2 \u0146\3\2\2")
        buf.write("\2\"\u0150\3\2\2\2$\u0152\3\2\2\2&\u0154\3\2\2\2(\u0165")
        buf.write("\3\2\2\2*-\5\4\3\2+-\5\b\5\2,*\3\2\2\2,+\3\2\2\2-\60\3")
        buf.write("\2\2\2.,\3\2\2\2./\3\2\2\2/\3\3\2\2\2\60.\3\2\2\2\61\62")
        buf.write("\7\3\2\2\62\63\5\26\f\2\63\67\7\4\2\2\64\65\5\6\4\2\65")
        buf.write("\66\7\5\2\2\668\3\2\2\2\67\64\3\2\2\2\678\3\2\2\28<\3")
        buf.write("\2\2\29;\5\36\20\2:9\3\2\2\2;>\3\2\2\2<:\3\2\2\2<=\3\2")
        buf.write("\2\2=?\3\2\2\2><\3\2\2\2?D\7\6\2\2@C\5\b\5\2AC\5\4\3\2")
        buf.write("B@\3\2\2\2BA\3\2\2\2CF\3\2\2\2DB\3\2\2\2DE\3\2\2\2EG\3")
        buf.write("\2\2\2FD\3\2\2\2GH\7\7\2\2H\5\3\2\2\2IJ\7\b\2\2JO\5\26")
        buf.write("\f\2KL\7\t\2\2LN\5\26\f\2MK\3\2\2\2NQ\3\2\2\2OM\3\2\2")
        buf.write("\2OP\3\2\2\2PR\3\2\2\2QO\3\2\2\2RS\7\n\2\2S\7\3\2\2\2")
        buf.write("TU\b\5\1\2U\u00b4\5\26\f\2V\u00b4\7=\2\2W\u00b4\7?\2\2")
        buf.write("X\u00b4\7@\2\2YZ\7\13\2\2Z]\5\26\f\2[\\\7\f\2\2\\^\5 ")
        buf.write("\21\2][\3\2\2\2]^\3\2\2\2^_\3\2\2\2_`\7\r\2\2`c\5\b\5")
        buf.write("\2ab\7\16\2\2bd\5\b\5\2ca\3\2\2\2cd\3\2\2\2d\u00b4\3\2")
        buf.write("\2\2ef\7\b\2\2fg\5 \21\2gh\7\n\2\2hi\5\b\5\23i\u00b4\3")
        buf.write("\2\2\2jk\5\24\13\2kl\5\b\5\21l\u00b4\3\2\2\2mv\7\b\2\2")
        buf.write("ns\5\b\5\2op\7\t\2\2pr\5\b\5\2qo\3\2\2\2ru\3\2\2\2sq\3")
        buf.write("\2\2\2st\3\2\2\2tw\3\2\2\2us\3\2\2\2vn\3\2\2\2vw\3\2\2")
        buf.write("\2wx\3\2\2\2x\u00b4\7\n\2\2yz\7\17\2\2z\177\5\b\5\2{|")
        buf.write("\7\t\2\2|~\5\b\5\2}{\3\2\2\2~\u0081\3\2\2\2\177}\3\2\2")
        buf.write("\2\177\u0080\3\2\2\2\u0080\u0082\3\2\2\2\u0081\177\3\2")
        buf.write("\2\2\u0082\u0083\7\20\2\2\u0083\u00b4\3\2\2\2\u0084\u0085")
        buf.write("\7\21\2\2\u0085\u0086\5\b\5\2\u0086\u0087\7\22\2\2\u0087")
        buf.write("\u0088\5\n\6\2\u0088\u0089\7\23\2\2\u0089\u008a\5\n\6")
        buf.write("\2\u008a\u00b4\3\2\2\2\u008b\u008c\7\24\2\2\u008c\u00b4")
        buf.write("\5\b\5\f\u008d\u008e\7\25\2\2\u008e\u00b4\5\b\5\13\u008f")
        buf.write("\u0090\7\26\2\2\u0090\u00b4\5\b\5\n\u0091\u0092\7\30\2")
        buf.write("\2\u0092\u0093\5\b\5\2\u0093\u0094\7\31\2\2\u0094\u0095")
        buf.write("\5\b\5\b\u0095\u00b4\3\2\2\2\u0096\u0097\7\32\2\2\u0097")
        buf.write("\u00b4\5\b\5\7\u0098\u0099\7\33\2\2\u0099\u00b4\5\b\5")
        buf.write("\6\u009a\u009b\5\16\b\2\u009b\u009c\5\b\5\5\u009c\u00b4")
        buf.write("\3\2\2\2\u009d\u009e\7\34\2\2\u009e\u009f\7\b\2\2\u009f")
        buf.write("\u00a0\5\b\5\2\u00a0\u00a1\7\t\2\2\u00a1\u00a2\5\b\5\2")
        buf.write("\u00a2\u00a3\7\t\2\2\u00a3\u00a4\5\b\5\2\u00a4\u00a5\7")
        buf.write("\n\2\2\u00a5\u00b4\3\2\2\2\u00a6\u00a7\7\35\2\2\u00a7")
        buf.write("\u00a8\7\b\2\2\u00a8\u00a9\5\b\5\2\u00a9\u00aa\7\n\2\2")
        buf.write("\u00aa\u00ae\7\6\2\2\u00ab\u00ad\5\f\7\2\u00ac\u00ab\3")
        buf.write("\2\2\2\u00ad\u00b0\3\2\2\2\u00ae\u00ac\3\2\2\2\u00ae\u00af")
        buf.write("\3\2\2\2\u00af\u00b1\3\2\2\2\u00b0\u00ae\3\2\2\2\u00b1")
        buf.write("\u00b2\7\7\2\2\u00b2\u00b4\3\2\2\2\u00b3T\3\2\2\2\u00b3")
        buf.write("V\3\2\2\2\u00b3W\3\2\2\2\u00b3X\3\2\2\2\u00b3Y\3\2\2\2")
        buf.write("\u00b3e\3\2\2\2\u00b3j\3\2\2\2\u00b3m\3\2\2\2\u00b3y\3")
        buf.write("\2\2\2\u00b3\u0084\3\2\2\2\u00b3\u008b\3\2\2\2\u00b3\u008d")
        buf.write("\3\2\2\2\u00b3\u008f\3\2\2\2\u00b3\u0091\3\2\2\2\u00b3")
        buf.write("\u0096\3\2\2\2\u00b3\u0098\3\2\2\2\u00b3\u009a\3\2\2\2")
        buf.write("\u00b3\u009d\3\2\2\2\u00b3\u00a6\3\2\2\2\u00b4\u00d0\3")
        buf.write("\2\2\2\u00b5\u00b6\f\22\2\2\u00b6\u00b7\5\22\n\2\u00b7")
        buf.write("\u00b8\5\b\5\23\u00b8\u00cf\3\2\2\2\u00b9\u00ba\f\t\2")
        buf.write("\2\u00ba\u00bb\7\27\2\2\u00bb\u00cf\5\b\5\n\u00bc\u00bd")
        buf.write("\f\25\2\2\u00bd\u00c6\7\b\2\2\u00be\u00c3\5\b\5\2\u00bf")
        buf.write("\u00c0\7\t\2\2\u00c0\u00c2\5\b\5\2\u00c1\u00bf\3\2\2\2")
        buf.write("\u00c2\u00c5\3\2\2\2\u00c3\u00c1\3\2\2\2\u00c3\u00c4\3")
        buf.write("\2\2\2\u00c4\u00c7\3\2\2\2\u00c5\u00c3\3\2\2\2\u00c6\u00be")
        buf.write("\3\2\2\2\u00c6\u00c7\3\2\2\2\u00c7\u00c8\3\2\2\2\u00c8")
        buf.write("\u00cf\7\n\2\2\u00c9\u00ca\f\17\2\2\u00ca\u00cb\7\17\2")
        buf.write("\2\u00cb\u00cc\5\b\5\2\u00cc\u00cd\7\20\2\2\u00cd\u00cf")
        buf.write("\3\2\2\2\u00ce\u00b5\3\2\2\2\u00ce\u00b9\3\2\2\2\u00ce")
        buf.write("\u00bc\3\2\2\2\u00ce\u00c9\3\2\2\2\u00cf\u00d2\3\2\2\2")
        buf.write("\u00d0\u00ce\3\2\2\2\u00d0\u00d1\3\2\2\2\u00d1\t\3\2\2")
        buf.write("\2\u00d2\u00d0\3\2\2\2\u00d3\u00d8\7\6\2\2\u00d4\u00d7")
        buf.write("\5\b\5\2\u00d5\u00d7\5\4\3\2\u00d6\u00d4\3\2\2\2\u00d6")
        buf.write("\u00d5\3\2\2\2\u00d7\u00da\3\2\2\2\u00d8\u00d6\3\2\2\2")
        buf.write("\u00d8\u00d9\3\2\2\2\u00d9\u00db\3\2\2\2\u00da\u00d8\3")
        buf.write("\2\2\2\u00db\u00dc\7\7\2\2\u00dc\13\3\2\2\2\u00dd\u00de")
        buf.write("\7\36\2\2\u00de\u00df\7\b\2\2\u00df\u00e0\5\b\5\2\u00e0")
        buf.write("\u00e1\7\n\2\2\u00e1\u00e2\5\n\6\2\u00e2\r\3\2\2\2\u00e3")
        buf.write("\u00e4\7\37\2\2\u00e4\u00e5\5\20\t\2\u00e5\17\3\2\2\2")
        buf.write("\u00e6\u00e7\t\2\2\2\u00e7\21\3\2\2\2\u00e8\u00e9\t\3")
        buf.write("\2\2\u00e9\23\3\2\2\2\u00ea\u00eb\t\4\2\2\u00eb\25\3\2")
        buf.write("\2\2\u00ec\u00ed\7<\2\2\u00ed\27\3\2\2\2\u00ee\u00f1\7")
        buf.write("<\2\2\u00ef\u00f0\7\f\2\2\u00f0\u00f2\5 \21\2\u00f1\u00ef")
        buf.write("\3\2\2\2\u00f1\u00f2\3\2\2\2\u00f2\31\3\2\2\2\u00f3\u00f4")
        buf.write("\7\17\2\2\u00f4\u00f9\5\b\5\2\u00f5\u00f6\7\t\2\2\u00f6")
        buf.write("\u00f8\5\b\5\2\u00f7\u00f5\3\2\2\2\u00f8\u00fb\3\2\2\2")
        buf.write("\u00f9\u00f7\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa\u00fc\3")
        buf.write("\2\2\2\u00fb\u00f9\3\2\2\2\u00fc\u00fd\7\20\2\2\u00fd")
        buf.write("\33\3\2\2\2\u00fe\u00ff\7\b\2\2\u00ff\u0104\5\b\5\2\u0100")
        buf.write("\u0101\7\t\2\2\u0101\u0103\5\b\5\2\u0102\u0100\3\2\2\2")
        buf.write("\u0103\u0106\3\2\2\2\u0104\u0102\3\2\2\2\u0104\u0105\3")
        buf.write("\2\2\2\u0105\u0107\3\2\2\2\u0106\u0104\3\2\2\2\u0107\u0108")
        buf.write("\7\n\2\2\u0108\35\3\2\2\2\u0109\u010e\5\30\r\2\u010a\u010b")
        buf.write("\7\31\2\2\u010b\u010d\5\30\r\2\u010c\u010a\3\2\2\2\u010d")
        buf.write("\u0110\3\2\2\2\u010e\u010c\3\2\2\2\u010e\u010f\3\2\2\2")
        buf.write("\u010f\37\3\2\2\2\u0110\u010e\3\2\2\2\u0111\u0112\b\21")
        buf.write("\1\2\u0112\u0147\5$\23\2\u0113\u0147\5&\24\2\u0114\u0115")
        buf.write("\7\62\2\2\u0115\u0118\7\b\2\2\u0116\u0119\5$\23\2\u0117")
        buf.write("\u0119\5\"\22\2\u0118\u0116\3\2\2\2\u0118\u0117\3\2\2")
        buf.write("\2\u0118\u0119\3\2\2\2\u0119\u0127\3\2\2\2\u011a\u011b")
        buf.write("\7\t\2\2\u011b\u011c\7\b\2\2\u011c\u0121\7=\2\2\u011d")
        buf.write("\u011e\7\t\2\2\u011e\u0120\7=\2\2\u011f\u011d\3\2\2\2")
        buf.write("\u0120\u0123\3\2\2\2\u0121\u011f\3\2\2\2\u0121\u0122\3")
        buf.write("\2\2\2\u0122\u0124\3\2\2\2\u0123\u0121\3\2\2\2\u0124\u0126")
        buf.write("\7\n\2\2\u0125\u011a\3\2\2\2\u0126\u0129\3\2\2\2\u0127")
        buf.write("\u0125\3\2\2\2\u0127\u0128\3\2\2\2\u0128\u012a\3\2\2\2")
        buf.write("\u0129\u0127\3\2\2\2\u012a\u0147\7\n\2\2\u012b\u0134\7")
        buf.write("\b\2\2\u012c\u0131\5 \21\2\u012d\u012e\7\31\2\2\u012e")
        buf.write("\u0130\5 \21\2\u012f\u012d\3\2\2\2\u0130\u0133\3\2\2\2")
        buf.write("\u0131\u012f\3\2\2\2\u0131\u0132\3\2\2\2\u0132\u0135\3")
        buf.write("\2\2\2\u0133\u0131\3\2\2\2\u0134\u012c\3\2\2\2\u0134\u0135")
        buf.write("\3\2\2\2\u0135\u0136\3\2\2\2\u0136\u0147\7\n\2\2\u0137")
        buf.write("\u0138\7\17\2\2\u0138\u013b\5 \21\2\u0139\u013a\7\t\2")
        buf.write("\2\u013a\u013c\5 \21\2\u013b\u0139\3\2\2\2\u013b\u013c")
        buf.write("\3\2\2\2\u013c\u013d\3\2\2\2\u013d\u013e\7\20\2\2\u013e")
        buf.write("\u0147\3\2\2\2\u013f\u0140\7\63\2\2\u0140\u0142\7\17\2")
        buf.write("\2\u0141\u0143\5 \21\2\u0142\u0141\3\2\2\2\u0142\u0143")
        buf.write("\3\2\2\2\u0143\u0144\3\2\2\2\u0144\u0147\7\20\2\2\u0145")
        buf.write("\u0147\5\"\22\2\u0146\u0111\3\2\2\2\u0146\u0113\3\2\2")
        buf.write("\2\u0146\u0114\3\2\2\2\u0146\u012b\3\2\2\2\u0146\u0137")
        buf.write("\3\2\2\2\u0146\u013f\3\2\2\2\u0146\u0145\3\2\2\2\u0147")
        buf.write("\u014d\3\2\2\2\u0148\u0149\f\7\2\2\u0149\u014a\7\31\2")
        buf.write("\2\u014a\u014c\5 \21\b\u014b\u0148\3\2\2\2\u014c\u014f")
        buf.write("\3\2\2\2\u014d\u014b\3\2\2\2\u014d\u014e\3\2\2\2\u014e")
        buf.write("!\3\2\2\2\u014f\u014d\3\2\2\2\u0150\u0151\5\26\f\2\u0151")
        buf.write("#\3\2\2\2\u0152\u0153\t\5\2\2\u0153%\3\2\2\2\u0154\u0155")
        buf.write("\79\2\2\u0155\u015e\7\b\2\2\u0156\u015b\7=\2\2\u0157\u0158")
        buf.write("\7\t\2\2\u0158\u015a\7=\2\2\u0159\u0157\3\2\2\2\u015a")
        buf.write("\u015d\3\2\2\2\u015b\u0159\3\2\2\2\u015b\u015c\3\2\2\2")
        buf.write("\u015c\u015f\3\2\2\2\u015d\u015b\3\2\2\2\u015e\u0156\3")
        buf.write("\2\2\2\u015e\u015f\3\2\2\2\u015f\u0160\3\2\2\2\u0160\u0161")
        buf.write("\7\n\2\2\u0161\'\3\2\2\2\u0162\u0163\7>\2\2\u0163\u0166")
        buf.write("\7<\2\2\u0164\u0166\7=\2\2\u0165\u0162\3\2\2\2\u0165\u0164")
        buf.write("\3\2\2\2\u0166\u0167\3\2\2\2\u0167\u0165\3\2\2\2\u0167")
        buf.write("\u0168\3\2\2\2\u0168)\3\2\2\2\',.\67<BDO]csv\177\u00ae")
        buf.write("\u00b3\u00c3\u00c6\u00ce\u00d0\u00d6\u00d8\u00f1\u00f9")
        buf.write("\u0104\u010e\u0118\u0121\u0127\u0131\u0134\u013b\u0142")
        buf.write("\u0146\u014d\u015b\u015e\u0165\u0167")
        return buf.getvalue()


class GlacierParser ( Parser ):

    grammarFileName = "Glacier.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'def'", "'::'", "'=>'", "'{'", "'}'", 
                     "'('", "','", "')'", "'let'", "':'", "'='", "'in'", 
                     "'['", "']'", "'if'", "'then'", "'else'", "'Zero'", 
                     "'Grad'", "'Ref'", "':='", "'\\'", "'->'", "'unfoldr'", 
                     "'replicate'", "'foldl'", "'match'", "'case'", "'@'", 
                     "'relu'", "'softmax'", "'+'", "'-'", "'*'", "'/'", 
                     "'%'", "'!='", "'<'", "'<='", "'>='", "'>'", "'map'", 
                     "'fold'", "'unfold'", "'tail'", "'filter'", "'!'", 
                     "'Tensor'", "'List'", "'Int'", "'UInt'", "'Float'", 
                     "'Bool'", "'Func'", "'Shape'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "WS", "COMMENT", "VAR", "INT", "SPACESL", "FLOAT", 
                      "BOOLEAN" ]

    RULE_program = 0
    RULE_func = 1
    RULE_typeConstraint = 2
    RULE_expr = 3
    RULE_block = 4
    RULE_caseBlock = 5
    RULE_primitiveOp = 6
    RULE_basicFn = 7
    RULE_binOp = 8
    RULE_unaryOp = 9
    RULE_name = 10
    RULE_param = 11
    RULE_listG = 12
    RULE_tupleG = 13
    RULE_params = 14
    RULE_typeG = 15
    RULE_customType = 16
    RULE_basetypeG = 17
    RULE_shape = 18
    RULE_args = 19

    ruleNames =  [ "program", "func", "typeConstraint", "expr", "block", 
                   "caseBlock", "primitiveOp", "basicFn", "binOp", "unaryOp", 
                   "name", "param", "listG", "tupleG", "params", "typeG", 
                   "customType", "basetypeG", "shape", "args" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    T__19=20
    T__20=21
    T__21=22
    T__22=23
    T__23=24
    T__24=25
    T__25=26
    T__26=27
    T__27=28
    T__28=29
    T__29=30
    T__30=31
    T__31=32
    T__32=33
    T__33=34
    T__34=35
    T__35=36
    T__36=37
    T__37=38
    T__38=39
    T__39=40
    T__40=41
    T__41=42
    T__42=43
    T__43=44
    T__44=45
    T__45=46
    T__46=47
    T__47=48
    T__48=49
    T__49=50
    T__50=51
    T__51=52
    T__52=53
    T__53=54
    T__54=55
    WS=56
    COMMENT=57
    VAR=58
    INT=59
    SPACESL=60
    FLOAT=61
    BOOLEAN=62

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




    class ProgramContext(ParserRuleContext):

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

        def func(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.FuncContext)
            else:
                return self.getTypedRuleContext(GlacierParser.FuncContext,i)


        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_program

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterProgram" ):
                listener.enterProgram(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitProgram" ):
                listener.exitProgram(self)

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




    def program(self):

        localctx = GlacierParser.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 = 44
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__0) | (1 << GlacierParser.T__5) | (1 << GlacierParser.T__8) | (1 << GlacierParser.T__12) | (1 << GlacierParser.T__14) | (1 << GlacierParser.T__17) | (1 << GlacierParser.T__18) | (1 << GlacierParser.T__19) | (1 << GlacierParser.T__21) | (1 << GlacierParser.T__23) | (1 << GlacierParser.T__24) | (1 << GlacierParser.T__25) | (1 << GlacierParser.T__26) | (1 << GlacierParser.T__28) | (1 << GlacierParser.T__32) | (1 << GlacierParser.T__41) | (1 << GlacierParser.T__42) | (1 << GlacierParser.T__43) | (1 << GlacierParser.T__44) | (1 << GlacierParser.T__45) | (1 << GlacierParser.T__46) | (1 << GlacierParser.VAR) | (1 << GlacierParser.INT) | (1 << GlacierParser.FLOAT) | (1 << GlacierParser.BOOLEAN))) != 0):
                self.state = 42
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [GlacierParser.T__0]:
                    self.state = 40
                    self.func()
                    pass
                elif token in [GlacierParser.T__5, GlacierParser.T__8, GlacierParser.T__12, GlacierParser.T__14, GlacierParser.T__17, GlacierParser.T__18, GlacierParser.T__19, GlacierParser.T__21, GlacierParser.T__23, GlacierParser.T__24, GlacierParser.T__25, GlacierParser.T__26, GlacierParser.T__28, GlacierParser.T__32, GlacierParser.T__41, GlacierParser.T__42, GlacierParser.T__43, GlacierParser.T__44, GlacierParser.T__45, GlacierParser.T__46, GlacierParser.VAR, GlacierParser.INT, GlacierParser.FLOAT, GlacierParser.BOOLEAN]:
                    self.state = 41
                    self.expr(0)
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 46
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class FuncContext(ParserRuleContext):

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

        def name(self):
            return self.getTypedRuleContext(GlacierParser.NameContext,0)


        def typeConstraint(self):
            return self.getTypedRuleContext(GlacierParser.TypeConstraintContext,0)


        def params(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ParamsContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ParamsContext,i)


        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def func(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.FuncContext)
            else:
                return self.getTypedRuleContext(GlacierParser.FuncContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_func

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunc" ):
                listener.enterFunc(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunc" ):
                listener.exitFunc(self)

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




    def func(self):

        localctx = GlacierParser.FuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_func)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 47
            self.match(GlacierParser.T__0)
            self.state = 48
            self.name()
            self.state = 49
            self.match(GlacierParser.T__1)
            self.state = 53
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==GlacierParser.T__5:
                self.state = 50
                self.typeConstraint()
                self.state = 51
                self.match(GlacierParser.T__2)


            self.state = 58
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==GlacierParser.VAR:
                self.state = 55
                self.params()
                self.state = 60
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 61
            self.match(GlacierParser.T__3)
            self.state = 66
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__0) | (1 << GlacierParser.T__5) | (1 << GlacierParser.T__8) | (1 << GlacierParser.T__12) | (1 << GlacierParser.T__14) | (1 << GlacierParser.T__17) | (1 << GlacierParser.T__18) | (1 << GlacierParser.T__19) | (1 << GlacierParser.T__21) | (1 << GlacierParser.T__23) | (1 << GlacierParser.T__24) | (1 << GlacierParser.T__25) | (1 << GlacierParser.T__26) | (1 << GlacierParser.T__28) | (1 << GlacierParser.T__32) | (1 << GlacierParser.T__41) | (1 << GlacierParser.T__42) | (1 << GlacierParser.T__43) | (1 << GlacierParser.T__44) | (1 << GlacierParser.T__45) | (1 << GlacierParser.T__46) | (1 << GlacierParser.VAR) | (1 << GlacierParser.INT) | (1 << GlacierParser.FLOAT) | (1 << GlacierParser.BOOLEAN))) != 0):
                self.state = 64
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [GlacierParser.T__5, GlacierParser.T__8, GlacierParser.T__12, GlacierParser.T__14, GlacierParser.T__17, GlacierParser.T__18, GlacierParser.T__19, GlacierParser.T__21, GlacierParser.T__23, GlacierParser.T__24, GlacierParser.T__25, GlacierParser.T__26, GlacierParser.T__28, GlacierParser.T__32, GlacierParser.T__41, GlacierParser.T__42, GlacierParser.T__43, GlacierParser.T__44, GlacierParser.T__45, GlacierParser.T__46, GlacierParser.VAR, GlacierParser.INT, GlacierParser.FLOAT, GlacierParser.BOOLEAN]:
                    self.state = 62
                    self.expr(0)
                    pass
                elif token in [GlacierParser.T__0]:
                    self.state = 63
                    self.func()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 68
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 69
            self.match(GlacierParser.T__4)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TypeConstraintContext(ParserRuleContext):

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

        def name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.NameContext)
            else:
                return self.getTypedRuleContext(GlacierParser.NameContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_typeConstraint

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeConstraint" ):
                listener.enterTypeConstraint(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeConstraint" ):
                listener.exitTypeConstraint(self)

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




    def typeConstraint(self):

        localctx = GlacierParser.TypeConstraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_typeConstraint)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 71
            self.match(GlacierParser.T__5)
            self.state = 72
            self.name()
            self.state = 77
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==GlacierParser.T__6:
                self.state = 73
                self.match(GlacierParser.T__6)
                self.state = 74
                self.name()
                self.state = 79
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 80
            self.match(GlacierParser.T__7)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExprContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return GlacierParser.RULE_expr

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


    class ConditionContext(ExprContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)

        def block(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.BlockContext)
            else:
                return self.getTypedRuleContext(GlacierParser.BlockContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCondition" ):
                listener.enterCondition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCondition" ):
                listener.exitCondition(self)

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


    class FoldContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFold" ):
                listener.enterFold(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFold" ):
                listener.exitFold(self)

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


    class ENameContext(ExprContext):

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

        def name(self):
            return self.getTypedRuleContext(GlacierParser.NameContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEName" ):
                listener.enterEName(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEName" ):
                listener.exitEName(self)

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


    class CallContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCall" ):
                listener.enterCall(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCall" ):
                listener.exitCall(self)

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


    class ZeroContext(ExprContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterZero" ):
                listener.enterZero(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitZero" ):
                listener.exitZero(self)

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


    class ConvertContext(ExprContext):

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

        def typeG(self):
            return self.getTypedRuleContext(GlacierParser.TypeGContext,0)

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConvert" ):
                listener.enterConvert(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConvert" ):
                listener.exitConvert(self)

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


    class EBooleanContext(ExprContext):

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

        def BOOLEAN(self):
            return self.getToken(GlacierParser.BOOLEAN, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEBoolean" ):
                listener.enterEBoolean(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEBoolean" ):
                listener.exitEBoolean(self)

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


    class BexprContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)

        def binOp(self):
            return self.getTypedRuleContext(GlacierParser.BinOpContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBexpr" ):
                listener.enterBexpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBexpr" ):
                listener.exitBexpr(self)

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


    class EIntContext(ExprContext):

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

        def INT(self):
            return self.getToken(GlacierParser.INT, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEInt" ):
                listener.enterEInt(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEInt" ):
                listener.exitEInt(self)

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


    class SubscriptContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSubscript" ):
                listener.enterSubscript(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSubscript" ):
                listener.exitSubscript(self)

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


    class GradContext(ExprContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterGrad" ):
                listener.enterGrad(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitGrad" ):
                listener.exitGrad(self)

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


    class MatchContext(ExprContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)

        def caseBlock(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.CaseBlockContext)
            else:
                return self.getTypedRuleContext(GlacierParser.CaseBlockContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMatch" ):
                listener.enterMatch(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMatch" ):
                listener.exitMatch(self)

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


    class UnfoldContext(ExprContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterUnfold" ):
                listener.enterUnfold(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitUnfold" ):
                listener.exitUnfold(self)

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


    class AssignmentContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAssignment" ):
                listener.enterAssignment(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAssignment" ):
                listener.exitAssignment(self)

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


    class RefContext(ExprContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterRef" ):
                listener.enterRef(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitRef" ):
                listener.exitRef(self)

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


    class PrimitiveContext(ExprContext):

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

        def primitiveOp(self):
            return self.getTypedRuleContext(GlacierParser.PrimitiveOpContext,0)

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimitive" ):
                listener.enterPrimitive(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimitive" ):
                listener.exitPrimitive(self)

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


    class EListContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEList" ):
                listener.enterEList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEList" ):
                listener.exitEList(self)

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


    class ReplicateContext(ExprContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterReplicate" ):
                listener.enterReplicate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitReplicate" ):
                listener.exitReplicate(self)

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


    class UexprContext(ExprContext):

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

        def unaryOp(self):
            return self.getTypedRuleContext(GlacierParser.UnaryOpContext,0)

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterUexpr" ):
                listener.enterUexpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitUexpr" ):
                listener.exitUexpr(self)

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


    class ETupleContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterETuple" ):
                listener.enterETuple(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitETuple" ):
                listener.exitETuple(self)

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


    class LetContext(ExprContext):

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

        def name(self):
            return self.getTypedRuleContext(GlacierParser.NameContext,0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)

        def typeG(self):
            return self.getTypedRuleContext(GlacierParser.TypeGContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLet" ):
                listener.enterLet(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLet" ):
                listener.exitLet(self)

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


    class EFloatContext(ExprContext):

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

        def FLOAT(self):
            return self.getToken(GlacierParser.FLOAT, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEFloat" ):
                listener.enterEFloat(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEFloat" ):
                listener.exitEFloat(self)

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


    class LambdaContext(ExprContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLambda" ):
                listener.enterLambda(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLambda" ):
                listener.exitLambda(self)

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



    def expr(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = GlacierParser.ExprContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 6
        self.enterRecursionRule(localctx, 6, self.RULE_expr, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 177
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,13,self._ctx)
            if la_ == 1:
                localctx = GlacierParser.ENameContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 83
                self.name()
                pass

            elif la_ == 2:
                localctx = GlacierParser.EIntContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 84
                self.match(GlacierParser.INT)
                pass

            elif la_ == 3:
                localctx = GlacierParser.EFloatContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 85
                self.match(GlacierParser.FLOAT)
                pass

            elif la_ == 4:
                localctx = GlacierParser.EBooleanContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 86
                self.match(GlacierParser.BOOLEAN)
                pass

            elif la_ == 5:
                localctx = GlacierParser.LetContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 87
                self.match(GlacierParser.T__8)
                self.state = 88
                self.name()
                self.state = 91
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==GlacierParser.T__9:
                    self.state = 89
                    self.match(GlacierParser.T__9)
                    self.state = 90
                    self.typeG(0)


                self.state = 93
                self.match(GlacierParser.T__10)
                self.state = 94
                self.expr(0)
                self.state = 97
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,8,self._ctx)
                if la_ == 1:
                    self.state = 95
                    self.match(GlacierParser.T__11)
                    self.state = 96
                    self.expr(0)


                pass

            elif la_ == 6:
                localctx = GlacierParser.ConvertContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 99
                self.match(GlacierParser.T__5)
                self.state = 100
                self.typeG(0)
                self.state = 101
                self.match(GlacierParser.T__7)
                self.state = 102
                self.expr(17)
                pass

            elif la_ == 7:
                localctx = GlacierParser.UexprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 104
                self.unaryOp()
                self.state = 105
                self.expr(15)
                pass

            elif la_ == 8:
                localctx = GlacierParser.ETupleContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 107
                self.match(GlacierParser.T__5)
                self.state = 116
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__5) | (1 << GlacierParser.T__8) | (1 << GlacierParser.T__12) | (1 << GlacierParser.T__14) | (1 << GlacierParser.T__17) | (1 << GlacierParser.T__18) | (1 << GlacierParser.T__19) | (1 << GlacierParser.T__21) | (1 << GlacierParser.T__23) | (1 << GlacierParser.T__24) | (1 << GlacierParser.T__25) | (1 << GlacierParser.T__26) | (1 << GlacierParser.T__28) | (1 << GlacierParser.T__32) | (1 << GlacierParser.T__41) | (1 << GlacierParser.T__42) | (1 << GlacierParser.T__43) | (1 << GlacierParser.T__44) | (1 << GlacierParser.T__45) | (1 << GlacierParser.T__46) | (1 << GlacierParser.VAR) | (1 << GlacierParser.INT) | (1 << GlacierParser.FLOAT) | (1 << GlacierParser.BOOLEAN))) != 0):
                    self.state = 108
                    self.expr(0)
                    self.state = 113
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==GlacierParser.T__6:
                        self.state = 109
                        self.match(GlacierParser.T__6)
                        self.state = 110
                        self.expr(0)
                        self.state = 115
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)



                self.state = 118
                self.match(GlacierParser.T__7)
                pass

            elif la_ == 9:
                localctx = GlacierParser.EListContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 119
                self.match(GlacierParser.T__12)
                self.state = 120
                self.expr(0)
                self.state = 125
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlacierParser.T__6:
                    self.state = 121
                    self.match(GlacierParser.T__6)
                    self.state = 122
                    self.expr(0)
                    self.state = 127
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 128
                self.match(GlacierParser.T__13)
                pass

            elif la_ == 10:
                localctx = GlacierParser.ConditionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 130
                self.match(GlacierParser.T__14)
                self.state = 131
                self.expr(0)
                self.state = 132
                self.match(GlacierParser.T__15)
                self.state = 133
                self.block()
                self.state = 134
                self.match(GlacierParser.T__16)
                self.state = 135
                self.block()
                pass

            elif la_ == 11:
                localctx = GlacierParser.ZeroContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 137
                self.match(GlacierParser.T__17)
                self.state = 138
                self.expr(10)
                pass

            elif la_ == 12:
                localctx = GlacierParser.GradContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 139
                self.match(GlacierParser.T__18)
                self.state = 140
                self.expr(9)
                pass

            elif la_ == 13:
                localctx = GlacierParser.RefContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 141
                self.match(GlacierParser.T__19)
                self.state = 142
                self.expr(8)
                pass

            elif la_ == 14:
                localctx = GlacierParser.LambdaContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 143
                self.match(GlacierParser.T__21)
                self.state = 144
                self.expr(0)
                self.state = 145
                self.match(GlacierParser.T__22)
                self.state = 146
                self.expr(6)
                pass

            elif la_ == 15:
                localctx = GlacierParser.UnfoldContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 148
                self.match(GlacierParser.T__23)
                self.state = 149
                self.expr(5)
                pass

            elif la_ == 16:
                localctx = GlacierParser.ReplicateContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 150
                self.match(GlacierParser.T__24)
                self.state = 151
                self.expr(4)
                pass

            elif la_ == 17:
                localctx = GlacierParser.PrimitiveContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 152
                self.primitiveOp()
                self.state = 153
                self.expr(3)
                pass

            elif la_ == 18:
                localctx = GlacierParser.FoldContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 155
                self.match(GlacierParser.T__25)
                self.state = 156
                self.match(GlacierParser.T__5)
                self.state = 157
                self.expr(0)
                self.state = 158
                self.match(GlacierParser.T__6)
                self.state = 159
                self.expr(0)
                self.state = 160
                self.match(GlacierParser.T__6)
                self.state = 161
                self.expr(0)
                self.state = 162
                self.match(GlacierParser.T__7)
                pass

            elif la_ == 19:
                localctx = GlacierParser.MatchContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 164
                self.match(GlacierParser.T__26)
                self.state = 165
                self.match(GlacierParser.T__5)
                self.state = 166
                self.expr(0)
                self.state = 167
                self.match(GlacierParser.T__7)
                self.state = 168
                self.match(GlacierParser.T__3)
                self.state = 172
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlacierParser.T__27:
                    self.state = 169
                    self.caseBlock()
                    self.state = 174
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 175
                self.match(GlacierParser.T__4)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 206
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,17,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 = 204
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
                    if la_ == 1:
                        localctx = GlacierParser.BexprContext(self, GlacierParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 179
                        if not self.precpred(self._ctx, 16):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 16)")
                        self.state = 180
                        self.binOp()
                        self.state = 181
                        self.expr(17)
                        pass

                    elif la_ == 2:
                        localctx = GlacierParser.AssignmentContext(self, GlacierParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 183
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 184
                        self.match(GlacierParser.T__20)
                        self.state = 185
                        self.expr(8)
                        pass

                    elif la_ == 3:
                        localctx = GlacierParser.CallContext(self, GlacierParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 186
                        if not self.precpred(self._ctx, 19):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 19)")
                        self.state = 187
                        self.match(GlacierParser.T__5)
                        self.state = 196
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__5) | (1 << GlacierParser.T__8) | (1 << GlacierParser.T__12) | (1 << GlacierParser.T__14) | (1 << GlacierParser.T__17) | (1 << GlacierParser.T__18) | (1 << GlacierParser.T__19) | (1 << GlacierParser.T__21) | (1 << GlacierParser.T__23) | (1 << GlacierParser.T__24) | (1 << GlacierParser.T__25) | (1 << GlacierParser.T__26) | (1 << GlacierParser.T__28) | (1 << GlacierParser.T__32) | (1 << GlacierParser.T__41) | (1 << GlacierParser.T__42) | (1 << GlacierParser.T__43) | (1 << GlacierParser.T__44) | (1 << GlacierParser.T__45) | (1 << GlacierParser.T__46) | (1 << GlacierParser.VAR) | (1 << GlacierParser.INT) | (1 << GlacierParser.FLOAT) | (1 << GlacierParser.BOOLEAN))) != 0):
                            self.state = 188
                            self.expr(0)
                            self.state = 193
                            self._errHandler.sync(self)
                            _la = self._input.LA(1)
                            while _la==GlacierParser.T__6:
                                self.state = 189
                                self.match(GlacierParser.T__6)
                                self.state = 190
                                self.expr(0)
                                self.state = 195
                                self._errHandler.sync(self)
                                _la = self._input.LA(1)



                        self.state = 198
                        self.match(GlacierParser.T__7)
                        pass

                    elif la_ == 4:
                        localctx = GlacierParser.SubscriptContext(self, GlacierParser.ExprContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 199
                        if not self.precpred(self._ctx, 13):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 13)")
                        self.state = 200
                        self.match(GlacierParser.T__12)
                        self.state = 201
                        self.expr(0)
                        self.state = 202
                        self.match(GlacierParser.T__13)
                        pass

             
                self.state = 208
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,17,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 BlockContext(ParserRuleContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def func(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.FuncContext)
            else:
                return self.getTypedRuleContext(GlacierParser.FuncContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_block

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBlock" ):
                listener.enterBlock(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBlock" ):
                listener.exitBlock(self)

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




    def block(self):

        localctx = GlacierParser.BlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_block)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self.match(GlacierParser.T__3)
            self.state = 214
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__0) | (1 << GlacierParser.T__5) | (1 << GlacierParser.T__8) | (1 << GlacierParser.T__12) | (1 << GlacierParser.T__14) | (1 << GlacierParser.T__17) | (1 << GlacierParser.T__18) | (1 << GlacierParser.T__19) | (1 << GlacierParser.T__21) | (1 << GlacierParser.T__23) | (1 << GlacierParser.T__24) | (1 << GlacierParser.T__25) | (1 << GlacierParser.T__26) | (1 << GlacierParser.T__28) | (1 << GlacierParser.T__32) | (1 << GlacierParser.T__41) | (1 << GlacierParser.T__42) | (1 << GlacierParser.T__43) | (1 << GlacierParser.T__44) | (1 << GlacierParser.T__45) | (1 << GlacierParser.T__46) | (1 << GlacierParser.VAR) | (1 << GlacierParser.INT) | (1 << GlacierParser.FLOAT) | (1 << GlacierParser.BOOLEAN))) != 0):
                self.state = 212
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [GlacierParser.T__5, GlacierParser.T__8, GlacierParser.T__12, GlacierParser.T__14, GlacierParser.T__17, GlacierParser.T__18, GlacierParser.T__19, GlacierParser.T__21, GlacierParser.T__23, GlacierParser.T__24, GlacierParser.T__25, GlacierParser.T__26, GlacierParser.T__28, GlacierParser.T__32, GlacierParser.T__41, GlacierParser.T__42, GlacierParser.T__43, GlacierParser.T__44, GlacierParser.T__45, GlacierParser.T__46, GlacierParser.VAR, GlacierParser.INT, GlacierParser.FLOAT, GlacierParser.BOOLEAN]:
                    self.state = 210
                    self.expr(0)
                    pass
                elif token in [GlacierParser.T__0]:
                    self.state = 211
                    self.func()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 216
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 217
            self.match(GlacierParser.T__4)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CaseBlockContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(GlacierParser.ExprContext,0)


        def block(self):
            return self.getTypedRuleContext(GlacierParser.BlockContext,0)


        def getRuleIndex(self):
            return GlacierParser.RULE_caseBlock

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCaseBlock" ):
                listener.enterCaseBlock(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCaseBlock" ):
                listener.exitCaseBlock(self)

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




    def caseBlock(self):

        localctx = GlacierParser.CaseBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_caseBlock)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 219
            self.match(GlacierParser.T__27)
            self.state = 220
            self.match(GlacierParser.T__5)
            self.state = 221
            self.expr(0)
            self.state = 222
            self.match(GlacierParser.T__7)
            self.state = 223
            self.block()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PrimitiveOpContext(ParserRuleContext):

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

        def basicFn(self):
            return self.getTypedRuleContext(GlacierParser.BasicFnContext,0)


        def getRuleIndex(self):
            return GlacierParser.RULE_primitiveOp

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrimitiveOp" ):
                listener.enterPrimitiveOp(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrimitiveOp" ):
                listener.exitPrimitiveOp(self)

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




    def primitiveOp(self):

        localctx = GlacierParser.PrimitiveOpContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_primitiveOp)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 225
            self.match(GlacierParser.T__28)
            self.state = 226
            self.basicFn()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BasicFnContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return GlacierParser.RULE_basicFn

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBasicFn" ):
                listener.enterBasicFn(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBasicFn" ):
                listener.exitBasicFn(self)

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




    def basicFn(self):

        localctx = GlacierParser.BasicFnContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_basicFn)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 228
            _la = self._input.LA(1)
            if not(_la==GlacierParser.T__29 or _la==GlacierParser.T__30):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BinOpContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return GlacierParser.RULE_binOp

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBinOp" ):
                listener.enterBinOp(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBinOp" ):
                listener.exitBinOp(self)

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




    def binOp(self):

        localctx = GlacierParser.BinOpContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_binOp)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 230
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__10) | (1 << GlacierParser.T__28) | (1 << GlacierParser.T__31) | (1 << GlacierParser.T__32) | (1 << GlacierParser.T__33) | (1 << GlacierParser.T__34) | (1 << GlacierParser.T__35) | (1 << GlacierParser.T__36) | (1 << GlacierParser.T__37) | (1 << GlacierParser.T__38) | (1 << GlacierParser.T__39) | (1 << GlacierParser.T__40) | (1 << GlacierParser.T__41))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class UnaryOpContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return GlacierParser.RULE_unaryOp

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterUnaryOp" ):
                listener.enterUnaryOp(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitUnaryOp" ):
                listener.exitUnaryOp(self)

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




    def unaryOp(self):

        localctx = GlacierParser.UnaryOpContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_unaryOp)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 232
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__32) | (1 << GlacierParser.T__41) | (1 << GlacierParser.T__42) | (1 << GlacierParser.T__43) | (1 << GlacierParser.T__44) | (1 << GlacierParser.T__45) | (1 << GlacierParser.T__46))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NameContext(ParserRuleContext):

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

        def VAR(self):
            return self.getToken(GlacierParser.VAR, 0)

        def getRuleIndex(self):
            return GlacierParser.RULE_name

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterName" ):
                listener.enterName(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitName" ):
                listener.exitName(self)

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




    def name(self):

        localctx = GlacierParser.NameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_name)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 234
            self.match(GlacierParser.VAR)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ParamContext(ParserRuleContext):

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

        def VAR(self):
            return self.getToken(GlacierParser.VAR, 0)

        def typeG(self):
            return self.getTypedRuleContext(GlacierParser.TypeGContext,0)


        def getRuleIndex(self):
            return GlacierParser.RULE_param

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterParam" ):
                listener.enterParam(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitParam" ):
                listener.exitParam(self)

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




    def param(self):

        localctx = GlacierParser.ParamContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_param)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 236
            self.match(GlacierParser.VAR)
            self.state = 239
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==GlacierParser.T__9:
                self.state = 237
                self.match(GlacierParser.T__9)
                self.state = 238
                self.typeG(0)


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


    class ListGContext(ParserRuleContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_listG

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterListG" ):
                listener.enterListG(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitListG" ):
                listener.exitListG(self)

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




    def listG(self):

        localctx = GlacierParser.ListGContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_listG)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 241
            self.match(GlacierParser.T__12)
            self.state = 242
            self.expr(0)
            self.state = 247
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==GlacierParser.T__6:
                self.state = 243
                self.match(GlacierParser.T__6)
                self.state = 244
                self.expr(0)
                self.state = 249
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 250
            self.match(GlacierParser.T__13)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TupleGContext(ParserRuleContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ExprContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ExprContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_tupleG

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTupleG" ):
                listener.enterTupleG(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTupleG" ):
                listener.exitTupleG(self)

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




    def tupleG(self):

        localctx = GlacierParser.TupleGContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_tupleG)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 252
            self.match(GlacierParser.T__5)
            self.state = 253
            self.expr(0)
            self.state = 258
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==GlacierParser.T__6:
                self.state = 254
                self.match(GlacierParser.T__6)
                self.state = 255
                self.expr(0)
                self.state = 260
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 261
            self.match(GlacierParser.T__7)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ParamsContext(ParserRuleContext):

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

        def param(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.ParamContext)
            else:
                return self.getTypedRuleContext(GlacierParser.ParamContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_params

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterParams" ):
                listener.enterParams(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitParams" ):
                listener.exitParams(self)

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




    def params(self):

        localctx = GlacierParser.ParamsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_params)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 263
            self.param()
            self.state = 268
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==GlacierParser.T__22:
                self.state = 264
                self.match(GlacierParser.T__22)
                self.state = 265
                self.param()
                self.state = 270
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class TypeGContext(ParserRuleContext):

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

        def basetypeG(self):
            return self.getTypedRuleContext(GlacierParser.BasetypeGContext,0)


        def shape(self):
            return self.getTypedRuleContext(GlacierParser.ShapeContext,0)


        def customType(self):
            return self.getTypedRuleContext(GlacierParser.CustomTypeContext,0)


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

        def typeG(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlacierParser.TypeGContext)
            else:
                return self.getTypedRuleContext(GlacierParser.TypeGContext,i)


        def getRuleIndex(self):
            return GlacierParser.RULE_typeG

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeG" ):
                listener.enterTypeG(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeG" ):
                listener.exitTypeG(self)

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



    def typeG(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = GlacierParser.TypeGContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 30
        self.enterRecursionRule(localctx, 30, self.RULE_typeG, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 324
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
            if la_ == 1:
                self.state = 272
                self.basetypeG()
                pass

            elif la_ == 2:
                self.state = 273
                self.shape()
                pass

            elif la_ == 3:
                self.state = 274
                self.match(GlacierParser.T__47)
                self.state = 275
                self.match(GlacierParser.T__5)
                self.state = 278
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [GlacierParser.T__48, GlacierParser.T__49, GlacierParser.T__50, GlacierParser.T__51, GlacierParser.T__52, GlacierParser.T__53]:
                    self.state = 276
                    self.basetypeG()
                    pass
                elif token in [GlacierParser.VAR]:
                    self.state = 277
                    self.customType()
                    pass
                elif token in [GlacierParser.T__6, GlacierParser.T__7]:
                    pass
                else:
                    pass
                self.state = 293
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlacierParser.T__6:
                    self.state = 280
                    self.match(GlacierParser.T__6)
                    self.state = 281
                    self.match(GlacierParser.T__5)
                    self.state = 282
                    self.match(GlacierParser.INT)
                    self.state = 287
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==GlacierParser.T__6:
                        self.state = 283
                        self.match(GlacierParser.T__6)
                        self.state = 284
                        self.match(GlacierParser.INT)
                        self.state = 289
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)

                    self.state = 290
                    self.match(GlacierParser.T__7)
                    self.state = 295
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 296
                self.match(GlacierParser.T__7)
                pass

            elif la_ == 4:
                self.state = 297
                self.match(GlacierParser.T__5)
                self.state = 306
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__5) | (1 << GlacierParser.T__12) | (1 << GlacierParser.T__47) | (1 << GlacierParser.T__48) | (1 << GlacierParser.T__49) | (1 << GlacierParser.T__50) | (1 << GlacierParser.T__51) | (1 << GlacierParser.T__52) | (1 << GlacierParser.T__53) | (1 << GlacierParser.T__54) | (1 << GlacierParser.VAR))) != 0):
                    self.state = 298
                    self.typeG(0)
                    self.state = 303
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==GlacierParser.T__22:
                        self.state = 299
                        self.match(GlacierParser.T__22)
                        self.state = 300
                        self.typeG(0)
                        self.state = 305
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)



                self.state = 308
                self.match(GlacierParser.T__7)
                pass

            elif la_ == 5:
                self.state = 309
                self.match(GlacierParser.T__12)
                self.state = 310
                self.typeG(0)
                self.state = 313
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==GlacierParser.T__6:
                    self.state = 311
                    self.match(GlacierParser.T__6)
                    self.state = 312
                    self.typeG(0)


                self.state = 315
                self.match(GlacierParser.T__13)
                pass

            elif la_ == 6:
                self.state = 317
                self.match(GlacierParser.T__48)
                self.state = 318
                self.match(GlacierParser.T__12)
                self.state = 320
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__5) | (1 << GlacierParser.T__12) | (1 << GlacierParser.T__47) | (1 << GlacierParser.T__48) | (1 << GlacierParser.T__49) | (1 << GlacierParser.T__50) | (1 << GlacierParser.T__51) | (1 << GlacierParser.T__52) | (1 << GlacierParser.T__53) | (1 << GlacierParser.T__54) | (1 << GlacierParser.VAR))) != 0):
                    self.state = 319
                    self.typeG(0)


                self.state = 322
                self.match(GlacierParser.T__13)
                pass

            elif la_ == 7:
                self.state = 323
                self.customType()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 331
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,32,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 = GlacierParser.TypeGContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_typeG)
                    self.state = 326
                    if not self.precpred(self._ctx, 5):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                    self.state = 327
                    self.match(GlacierParser.T__22)
                    self.state = 328
                    self.typeG(6) 
                self.state = 333
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,32,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 CustomTypeContext(ParserRuleContext):

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

        def name(self):
            return self.getTypedRuleContext(GlacierParser.NameContext,0)


        def getRuleIndex(self):
            return GlacierParser.RULE_customType

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCustomType" ):
                listener.enterCustomType(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCustomType" ):
                listener.exitCustomType(self)

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




    def customType(self):

        localctx = GlacierParser.CustomTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_customType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 334
            self.name()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BasetypeGContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return GlacierParser.RULE_basetypeG

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBasetypeG" ):
                listener.enterBasetypeG(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBasetypeG" ):
                listener.exitBasetypeG(self)

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




    def basetypeG(self):

        localctx = GlacierParser.BasetypeGContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_basetypeG)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 336
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << GlacierParser.T__48) | (1 << GlacierParser.T__49) | (1 << GlacierParser.T__50) | (1 << GlacierParser.T__51) | (1 << GlacierParser.T__52) | (1 << GlacierParser.T__53))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ShapeContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return GlacierParser.RULE_shape

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterShape" ):
                listener.enterShape(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitShape" ):
                listener.exitShape(self)

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




    def shape(self):

        localctx = GlacierParser.ShapeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_shape)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 338
            self.match(GlacierParser.T__54)
            self.state = 339
            self.match(GlacierParser.T__5)
            self.state = 348
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==GlacierParser.INT:
                self.state = 340
                self.match(GlacierParser.INT)
                self.state = 345
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlacierParser.T__6:
                    self.state = 341
                    self.match(GlacierParser.T__6)
                    self.state = 342
                    self.match(GlacierParser.INT)
                    self.state = 347
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 350
            self.match(GlacierParser.T__7)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArgsContext(ParserRuleContext):

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

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

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

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

        def getRuleIndex(self):
            return GlacierParser.RULE_args

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArgs" ):
                listener.enterArgs(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArgs" ):
                listener.exitArgs(self)

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




    def args(self):

        localctx = GlacierParser.ArgsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_args)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 355 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 355
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [GlacierParser.SPACESL]:
                    self.state = 352
                    self.match(GlacierParser.SPACESL)
                    self.state = 353
                    self.match(GlacierParser.VAR)
                    pass
                elif token in [GlacierParser.INT]:
                    self.state = 354
                    self.match(GlacierParser.INT)
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 357 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==GlacierParser.INT or _la==GlacierParser.SPACESL):
                    break

        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[3] = self.expr_sempred
        self._predicates[15] = self.typeG_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 expr_sempred(self, localctx:ExprContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 16)
         

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

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

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

    def typeG_sempred(self, localctx:TypeGContext, predIndex:int):
            if predIndex == 4:
                return self.precpred(self._ctx, 5)
         




