# Generated from afmparser/AFM.g4 by ANTLR 4.7.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys

def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\62")
        buf.write("\u0149\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\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\3\2\3\2\5\2?\n\2\3\2\5\2B\n\2\3\3\3\3\7\3F\n\3\f\3\16")
        buf.write("\3I\13\3\3\4\3\4\3\4\6\4N\n\4\r\4\16\4O\3\4\3\4\3\5\5")
        buf.write("\5U\n\5\3\5\3\5\5\5Y\n\5\3\5\3\5\5\5]\n\5\3\6\5\6`\n\6")
        buf.write("\3\6\3\6\5\6d\n\6\3\7\5\7g\n\7\3\7\3\7\3\7\3\7\5\7m\n")
        buf.write("\7\3\b\3\b\5\bq\n\b\3\t\3\t\3\t\3\t\3\t\3\t\3\n\5\nz\n")
        buf.write("\n\3\n\3\n\5\n~\n\n\3\n\3\n\6\n\u0082\n\n\r\n\16\n\u0083")
        buf.write("\3\n\3\n\3\13\3\13\7\13\u008a\n\13\f\13\16\13\u008d\13")
        buf.write("\13\3\f\3\f\5\f\u0091\n\f\3\f\3\f\5\f\u0095\n\f\3\f\3")
        buf.write("\f\5\f\u0099\n\f\3\f\3\f\5\f\u009d\n\f\3\f\3\f\5\f\u00a1")
        buf.write("\n\f\3\f\3\f\5\f\u00a5\n\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r")
        buf.write("\3\16\3\16\5\16\u00b0\n\16\3\17\3\17\3\17\3\17\7\17\u00b6")
        buf.write("\n\17\f\17\16\17\u00b9\13\17\3\17\3\17\3\20\5\20\u00be")
        buf.write("\n\20\3\20\3\20\5\20\u00c2\n\20\3\20\7\20\u00c5\n\20\f")
        buf.write("\20\16\20\u00c8\13\20\3\21\3\21\3\21\5\21\u00cd\n\21\3")
        buf.write("\21\3\21\5\21\u00d1\n\21\3\21\3\21\3\21\3\22\3\22\3\23")
        buf.write("\3\23\3\24\3\24\3\25\3\25\7\25\u00de\n\25\f\25\16\25\u00e1")
        buf.write("\13\25\3\26\3\26\5\26\u00e5\n\26\3\27\5\27\u00e8\n\27")
        buf.write("\3\27\3\27\5\27\u00ec\n\27\3\27\3\27\5\27\u00f0\n\27\3")
        buf.write("\27\7\27\u00f3\n\27\f\27\16\27\u00f6\13\27\3\27\5\27\u00f9")
        buf.write("\n\27\3\27\3\27\5\27\u00fd\n\27\3\30\5\30\u0100\n\30\3")
        buf.write("\30\3\30\5\30\u0104\n\30\3\30\3\30\5\30\u0108\n\30\3\31")
        buf.write("\3\31\5\31\u010c\n\31\3\31\3\31\3\31\3\31\5\31\u0112\n")
        buf.write("\31\3\31\3\31\3\31\5\31\u0117\n\31\3\31\3\31\5\31\u011b")
        buf.write("\n\31\3\31\5\31\u011e\n\31\5\31\u0120\n\31\3\31\3\31\3")
        buf.write("\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31")
        buf.write("\3\31\3\31\3\31\3\31\3\31\7\31\u0134\n\31\f\31\16\31\u0137")
        buf.write("\13\31\3\32\3\32\3\33\3\33\3\34\3\34\3\35\3\35\3\36\3")
        buf.write("\36\3\36\5\36\u0144\n\36\3\36\5\36\u0147\n\36\3\36\2\3")
        buf.write("\60\37\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,")
        buf.write(".\60\62\64\668:\2\7\3\2,\60\3\2!$\3\2\21\27\3\2%*\3\2")
        buf.write("./\2\u0162\2<\3\2\2\2\4C\3\2\2\2\6J\3\2\2\2\bT\3\2\2\2")
        buf.write("\n_\3\2\2\2\ff\3\2\2\2\16p\3\2\2\2\20r\3\2\2\2\22y\3\2")
        buf.write("\2\2\24\u0087\3\2\2\2\26\u008e\3\2\2\2\30\u00a9\3\2\2")
        buf.write("\2\32\u00af\3\2\2\2\34\u00b1\3\2\2\2\36\u00bd\3\2\2\2")
        buf.write(" \u00c9\3\2\2\2\"\u00d5\3\2\2\2$\u00d7\3\2\2\2&\u00d9")
        buf.write("\3\2\2\2(\u00db\3\2\2\2*\u00e4\3\2\2\2,\u00e7\3\2\2\2")
        buf.write(".\u00ff\3\2\2\2\60\u011f\3\2\2\2\62\u0138\3\2\2\2\64\u013a")
        buf.write("\3\2\2\2\66\u013c\3\2\2\28\u013e\3\2\2\2:\u0146\3\2\2")
        buf.write("\2<>\5\4\3\2=?\5\24\13\2>=\3\2\2\2>?\3\2\2\2?A\3\2\2\2")
        buf.write("@B\5(\25\2A@\3\2\2\2AB\3\2\2\2B\3\3\2\2\2CG\7\3\2\2DF")
        buf.write("\5\6\4\2ED\3\2\2\2FI\3\2\2\2GE\3\2\2\2GH\3\2\2\2H\5\3")
        buf.write("\2\2\2IG\3\2\2\2JM\5\b\5\2KN\5\16\b\2LN\5\22\n\2MK\3\2")
        buf.write("\2\2ML\3\2\2\2NO\3\2\2\2OM\3\2\2\2OP\3\2\2\2PQ\3\2\2\2")
        buf.write("QR\7\4\2\2R\7\3\2\2\2SU\7\61\2\2TS\3\2\2\2TU\3\2\2\2U")
        buf.write("V\3\2\2\2VX\7-\2\2WY\7\61\2\2XW\3\2\2\2XY\3\2\2\2YZ\3")
        buf.write("\2\2\2Z\\\7\5\2\2[]\7\61\2\2\\[\3\2\2\2\\]\3\2\2\2]\t")
        buf.write("\3\2\2\2^`\7\61\2\2_^\3\2\2\2_`\3\2\2\2`a\3\2\2\2ac\7")
        buf.write("-\2\2bd\7\61\2\2cb\3\2\2\2cd\3\2\2\2d\13\3\2\2\2eg\7\61")
        buf.write("\2\2fe\3\2\2\2fg\3\2\2\2gh\3\2\2\2hi\7\6\2\2ij\7-\2\2")
        buf.write("jl\7\7\2\2km\7\61\2\2lk\3\2\2\2lm\3\2\2\2m\r\3\2\2\2n")
        buf.write("q\5\n\6\2oq\5\f\7\2pn\3\2\2\2po\3\2\2\2q\17\3\2\2\2rs")
        buf.write("\7\6\2\2st\7.\2\2tu\7\b\2\2uv\7.\2\2vw\7\7\2\2w\21\3\2")
        buf.write("\2\2xz\7\61\2\2yx\3\2\2\2yz\3\2\2\2z{\3\2\2\2{}\5\20\t")
        buf.write("\2|~\7\61\2\2}|\3\2\2\2}~\3\2\2\2~\177\3\2\2\2\177\u0081")
        buf.write("\7\t\2\2\u0080\u0082\5\n\6\2\u0081\u0080\3\2\2\2\u0082")
        buf.write("\u0083\3\2\2\2\u0083\u0081\3\2\2\2\u0083\u0084\3\2\2\2")
        buf.write("\u0084\u0085\3\2\2\2\u0085\u0086\7\n\2\2\u0086\23\3\2")
        buf.write("\2\2\u0087\u008b\7\13\2\2\u0088\u008a\5\26\f\2\u0089\u0088")
        buf.write("\3\2\2\2\u008a\u008d\3\2\2\2\u008b\u0089\3\2\2\2\u008b")
        buf.write("\u008c\3\2\2\2\u008c\25\3\2\2\2\u008d\u008b\3\2\2\2\u008e")
        buf.write("\u0090\5\30\r\2\u008f\u0091\7\61\2\2\u0090\u008f\3\2\2")
        buf.write("\2\u0090\u0091\3\2\2\2\u0091\u0092\3\2\2\2\u0092\u0094")
        buf.write("\7\5\2\2\u0093\u0095\7\61\2\2\u0094\u0093\3\2\2\2\u0094")
        buf.write("\u0095\3\2\2\2\u0095\u0096\3\2\2\2\u0096\u0098\5\32\16")
        buf.write("\2\u0097\u0099\7\61\2\2\u0098\u0097\3\2\2\2\u0098\u0099")
        buf.write("\3\2\2\2\u0099\u009a\3\2\2\2\u009a\u009c\7\b\2\2\u009b")
        buf.write("\u009d\7\61\2\2\u009c\u009b\3\2\2\2\u009c\u009d\3\2\2")
        buf.write("\2\u009d\u009e\3\2\2\2\u009e\u00a0\5\"\22\2\u009f\u00a1")
        buf.write("\7\61\2\2\u00a0\u009f\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1")
        buf.write("\u00a2\3\2\2\2\u00a2\u00a4\7\b\2\2\u00a3\u00a5\7\61\2")
        buf.write("\2\u00a4\u00a3\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\u00a6")
        buf.write("\3\2\2\2\u00a6\u00a7\5$\23\2\u00a7\u00a8\7\4\2\2\u00a8")
        buf.write("\27\3\2\2\2\u00a9\u00aa\7-\2\2\u00aa\u00ab\7\f\2\2\u00ab")
        buf.write("\u00ac\7,\2\2\u00ac\31\3\2\2\2\u00ad\u00b0\5\34\17\2\u00ae")
        buf.write("\u00b0\5\36\20\2\u00af\u00ad\3\2\2\2\u00af\u00ae\3\2\2")
        buf.write("\2\u00b0\33\3\2\2\2\u00b1\u00b2\7\6\2\2\u00b2\u00b7\5")
        buf.write("&\24\2\u00b3\u00b4\7\b\2\2\u00b4\u00b6\5&\24\2\u00b5\u00b3")
        buf.write("\3\2\2\2\u00b6\u00b9\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b7")
        buf.write("\u00b8\3\2\2\2\u00b8\u00ba\3\2\2\2\u00b9\u00b7\3\2\2\2")
        buf.write("\u00ba\u00bb\7\7\2\2\u00bb\35\3\2\2\2\u00bc\u00be\7\61")
        buf.write("\2\2\u00bd\u00bc\3\2\2\2\u00bd\u00be\3\2\2\2\u00be\u00bf")
        buf.write("\3\2\2\2\u00bf\u00c1\7+\2\2\u00c0\u00c2\7\61\2\2\u00c1")
        buf.write("\u00c0\3\2\2\2\u00c1\u00c2\3\2\2\2\u00c2\u00c6\3\2\2\2")
        buf.write("\u00c3\u00c5\5 \21\2\u00c4\u00c3\3\2\2\2\u00c5\u00c8\3")
        buf.write("\2\2\2\u00c6\u00c4\3\2\2\2\u00c6\u00c7\3\2\2\2\u00c7\37")
        buf.write("\3\2\2\2\u00c8\u00c6\3\2\2\2\u00c9\u00ca\7\6\2\2\u00ca")
        buf.write("\u00cc\7.\2\2\u00cb\u00cd\7\61\2\2\u00cc\u00cb\3\2\2\2")
        buf.write("\u00cc\u00cd\3\2\2\2\u00cd\u00ce\3\2\2\2\u00ce\u00d0\7")
        buf.write("\r\2\2\u00cf\u00d1\7\61\2\2\u00d0\u00cf\3\2\2\2\u00d0")
        buf.write("\u00d1\3\2\2\2\u00d1\u00d2\3\2\2\2\u00d2\u00d3\7.\2\2")
        buf.write("\u00d3\u00d4\7\7\2\2\u00d4!\3\2\2\2\u00d5\u00d6\5&\24")
        buf.write("\2\u00d6#\3\2\2\2\u00d7\u00d8\5&\24\2\u00d8%\3\2\2\2\u00d9")
        buf.write("\u00da\t\2\2\2\u00da\'\3\2\2\2\u00db\u00df\7\16\2\2\u00dc")
        buf.write("\u00de\5*\26\2\u00dd\u00dc\3\2\2\2\u00de\u00e1\3\2\2\2")
        buf.write("\u00df\u00dd\3\2\2\2\u00df\u00e0\3\2\2\2\u00e0)\3\2\2")
        buf.write("\2\u00e1\u00df\3\2\2\2\u00e2\u00e5\5,\27\2\u00e3\u00e5")
        buf.write("\5.\30\2\u00e4\u00e2\3\2\2\2\u00e4\u00e3\3\2\2\2\u00e5")
        buf.write("+\3\2\2\2\u00e6\u00e8\7\61\2\2\u00e7\u00e6\3\2\2\2\u00e7")
        buf.write("\u00e8\3\2\2\2\u00e8\u00e9\3\2\2\2\u00e9\u00eb\7-\2\2")
        buf.write("\u00ea\u00ec\7\61\2\2\u00eb\u00ea\3\2\2\2\u00eb\u00ec")
        buf.write("\3\2\2\2\u00ec\u00ed\3\2\2\2\u00ed\u00ef\7\t\2\2\u00ee")
        buf.write("\u00f0\7\61\2\2\u00ef\u00ee\3\2\2\2\u00ef\u00f0\3\2\2")
        buf.write("\2\u00f0\u00f4\3\2\2\2\u00f1\u00f3\5.\30\2\u00f2\u00f1")
        buf.write("\3\2\2\2\u00f3\u00f6\3\2\2\2\u00f4\u00f2\3\2\2\2\u00f4")
        buf.write("\u00f5\3\2\2\2\u00f5\u00f8\3\2\2\2\u00f6\u00f4\3\2\2\2")
        buf.write("\u00f7\u00f9\7\61\2\2\u00f8\u00f7\3\2\2\2\u00f8\u00f9")
        buf.write("\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa\u00fc\7\n\2\2\u00fb")
        buf.write("\u00fd\7\61\2\2\u00fc\u00fb\3\2\2\2\u00fc\u00fd\3\2\2")
        buf.write("\2\u00fd-\3\2\2\2\u00fe\u0100\7\61\2\2\u00ff\u00fe\3\2")
        buf.write("\2\2\u00ff\u0100\3\2\2\2\u0100\u0101\3\2\2\2\u0101\u0103")
        buf.write("\5\60\31\2\u0102\u0104\7\61\2\2\u0103\u0102\3\2\2\2\u0103")
        buf.write("\u0104\3\2\2\2\u0104\u0105\3\2\2\2\u0105\u0107\7\4\2\2")
        buf.write("\u0106\u0108\7\61\2\2\u0107\u0106\3\2\2\2\u0107\u0108")
        buf.write("\3\2\2\2\u0108/\3\2\2\2\u0109\u010b\b\31\1\2\u010a\u010c")
        buf.write("\7\61\2\2\u010b\u010a\3\2\2\2\u010b\u010c\3\2\2\2\u010c")
        buf.write("\u010d\3\2\2\2\u010d\u010e\7\17\2\2\u010e\u010f\5\60\31")
        buf.write("\2\u010f\u0111\7\20\2\2\u0110\u0112\7\61\2\2\u0111\u0110")
        buf.write("\3\2\2\2\u0111\u0112\3\2\2\2\u0112\u0120\3\2\2\2\u0113")
        buf.write("\u0114\7 \2\2\u0114\u0120\5\60\31\7\u0115\u0117\7\61\2")
        buf.write("\2\u0116\u0115\3\2\2\2\u0116\u0117\3\2\2\2\u0117\u011a")
        buf.write("\3\2\2\2\u0118\u011b\5:\36\2\u0119\u011b\58\35\2\u011a")
        buf.write("\u0118\3\2\2\2\u011a\u0119\3\2\2\2\u011b\u011d\3\2\2\2")
        buf.write("\u011c\u011e\7\61\2\2\u011d\u011c\3\2\2\2\u011d\u011e")
        buf.write("\3\2\2\2\u011e\u0120\3\2\2\2\u011f\u0109\3\2\2\2\u011f")
        buf.write("\u0113\3\2\2\2\u011f\u0116\3\2\2\2\u0120\u0135\3\2\2\2")
        buf.write("\u0121\u0122\f\t\2\2\u0122\u0123\5\64\33\2\u0123\u0124")
        buf.write("\5\60\31\n\u0124\u0134\3\2\2\2\u0125\u0126\f\b\2\2\u0126")
        buf.write("\u0127\5\66\34\2\u0127\u0128\5\60\31\t\u0128\u0134\3\2")
        buf.write("\2\2\u0129\u012a\f\6\2\2\u012a\u012b\7\36\2\2\u012b\u0134")
        buf.write("\5\60\31\7\u012c\u012d\f\5\2\2\u012d\u012e\7\37\2\2\u012e")
        buf.write("\u0134\5\60\31\6\u012f\u0130\f\4\2\2\u0130\u0131\5\62")
        buf.write("\32\2\u0131\u0132\5\60\31\5\u0132\u0134\3\2\2\2\u0133")
        buf.write("\u0121\3\2\2\2\u0133\u0125\3\2\2\2\u0133\u0129\3\2\2\2")
        buf.write("\u0133\u012c\3\2\2\2\u0133\u012f\3\2\2\2\u0134\u0137\3")
        buf.write("\2\2\2\u0135\u0133\3\2\2\2\u0135\u0136\3\2\2\2\u0136\61")
        buf.write("\3\2\2\2\u0137\u0135\3\2\2\2\u0138\u0139\t\3\2\2\u0139")
        buf.write("\63\3\2\2\2\u013a\u013b\t\4\2\2\u013b\65\3\2\2\2\u013c")
        buf.write("\u013d\t\5\2\2\u013d\67\3\2\2\2\u013e\u013f\t\6\2\2\u013f")
        buf.write("9\3\2\2\2\u0140\u0143\7-\2\2\u0141\u0142\7\f\2\2\u0142")
        buf.write("\u0144\7,\2\2\u0143\u0141\3\2\2\2\u0143\u0144\3\2\2\2")
        buf.write("\u0144\u0147\3\2\2\2\u0145\u0147\7,\2\2\u0146\u0140\3")
        buf.write("\2\2\2\u0146\u0145\3\2\2\2\u0147;\3\2\2\2\65>AGMOTX\\")
        buf.write("_cflpy}\u0083\u008b\u0090\u0094\u0098\u009c\u00a0\u00a4")
        buf.write("\u00af\u00b7\u00bd\u00c1\u00c6\u00cc\u00d0\u00df\u00e4")
        buf.write("\u00e7\u00eb\u00ef\u00f4\u00f8\u00fc\u00ff\u0103\u0107")
        buf.write("\u010b\u0111\u0116\u011a\u011d\u011f\u0133\u0135\u0143")
        buf.write("\u0146")
        return buf.getvalue()


class AFMParser ( Parser ):

    grammarFileName = "AFM.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'%Relationships'", "';'", "':'", "'['", 
                     "']'", "','", "'{'", "'}'", "'%Attributes'", "'.'", 
                     "'to'", "'%Constraints'", "'('", "')'", "'+'", "'-'", 
                     "'*'", "'/'", "'%'", "'^'", "'='", "'abs'", "'max'", 
                     "'min'", "'cos'", "'sin'", "'sum'", "'AND'", "'OR'", 
                     "'NOT'", "'IFF'", "'IMPLIES'", "'REQUIRES'", "'EXCLUDES'", 
                     "'>'", "'<'", "'>='", "'<='", "'=='", "'!='", "'Integer'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "ADD", "SUB", 
                      "MULT", "DIV", "MOD", "POW", "ASIG", "ABS", "MAX", 
                      "MIN", "COS", "SIN", "SUM", "AND", "OR", "NOT", "IFF", 
                      "IMPLIES", "REQUIRES", "EXCLUDES", "HIGHER_THAN", 
                      "LOWER_THAN", "HIGHER_EQUAL_THAN", "LOWER_EQUAL_THAN", 
                      "EQUAL", "DISTINCT", "INTEGER", "LOWERCASE", "WORD", 
                      "INT", "DOUBLE", "STRING", "SPACE", "WS" ]

    RULE_feature_model = 0
    RULE_relationships_block = 1
    RULE_relationship_spec = 2
    RULE_init_spec = 3
    RULE_obligatory_spec = 4
    RULE_optional_spec = 5
    RULE_non_cardinal_spec = 6
    RULE_cardinality = 7
    RULE_cardinal_spec = 8
    RULE_attributes_block = 9
    RULE_attribute_spec = 10
    RULE_attribute_name = 11
    RULE_attribute_domain = 12
    RULE_discrete_domain_spec = 13
    RULE_range_domain_spec = 14
    RULE_domain_range = 15
    RULE_attribute_default_value = 16
    RULE_attribute_null_value = 17
    RULE_value_spec = 18
    RULE_constraints_block = 19
    RULE_constraint_spec = 20
    RULE_brackets_spec = 21
    RULE_simple_spec = 22
    RULE_expression = 23
    RULE_logical_operator = 24
    RULE_arithmetic_operator = 25
    RULE_relational_operator = 26
    RULE_number = 27
    RULE_variable = 28

    ruleNames =  [ "feature_model", "relationships_block", "relationship_spec", 
                   "init_spec", "obligatory_spec", "optional_spec", "non_cardinal_spec", 
                   "cardinality", "cardinal_spec", "attributes_block", "attribute_spec", 
                   "attribute_name", "attribute_domain", "discrete_domain_spec", 
                   "range_domain_spec", "domain_range", "attribute_default_value", 
                   "attribute_null_value", "value_spec", "constraints_block", 
                   "constraint_spec", "brackets_spec", "simple_spec", "expression", 
                   "logical_operator", "arithmetic_operator", "relational_operator", 
                   "number", "variable" ]

    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
    ADD=15
    SUB=16
    MULT=17
    DIV=18
    MOD=19
    POW=20
    ASIG=21
    ABS=22
    MAX=23
    MIN=24
    COS=25
    SIN=26
    SUM=27
    AND=28
    OR=29
    NOT=30
    IFF=31
    IMPLIES=32
    REQUIRES=33
    EXCLUDES=34
    HIGHER_THAN=35
    LOWER_THAN=36
    HIGHER_EQUAL_THAN=37
    LOWER_EQUAL_THAN=38
    EQUAL=39
    DISTINCT=40
    INTEGER=41
    LOWERCASE=42
    WORD=43
    INT=44
    DOUBLE=45
    STRING=46
    SPACE=47
    WS=48

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



    class Feature_modelContext(ParserRuleContext):

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

        def relationships_block(self):
            return self.getTypedRuleContext(AFMParser.Relationships_blockContext,0)


        def attributes_block(self):
            return self.getTypedRuleContext(AFMParser.Attributes_blockContext,0)


        def constraints_block(self):
            return self.getTypedRuleContext(AFMParser.Constraints_blockContext,0)


        def getRuleIndex(self):
            return AFMParser.RULE_feature_model

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

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




    def feature_model(self):

        localctx = AFMParser.Feature_modelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_feature_model)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 58
            self.relationships_block()
            self.state = 60
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.T__8:
                self.state = 59
                self.attributes_block()


            self.state = 63
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.T__11:
                self.state = 62
                self.constraints_block()


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

    class Relationships_blockContext(ParserRuleContext):

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

        def relationship_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Relationship_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Relationship_specContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_relationships_block

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

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




    def relationships_block(self):

        localctx = AFMParser.Relationships_blockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_relationships_block)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 65
            self.match(AFMParser.T__0)
            self.state = 69
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==AFMParser.WORD or _la==AFMParser.SPACE:
                self.state = 66
                self.relationship_spec()
                self.state = 71
                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 Relationship_specContext(ParserRuleContext):

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

        def init_spec(self):
            return self.getTypedRuleContext(AFMParser.Init_specContext,0)


        def non_cardinal_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Non_cardinal_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Non_cardinal_specContext,i)


        def cardinal_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Cardinal_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Cardinal_specContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_relationship_spec

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

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




    def relationship_spec(self):

        localctx = AFMParser.Relationship_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_relationship_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 72
            self.init_spec()
            self.state = 75 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 75
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
                if la_ == 1:
                    self.state = 73
                    self.non_cardinal_spec()
                    pass

                elif la_ == 2:
                    self.state = 74
                    self.cardinal_spec()
                    pass


                self.state = 77 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << AFMParser.T__3) | (1 << AFMParser.WORD) | (1 << AFMParser.SPACE))) != 0)):
                    break

            self.state = 79
            self.match(AFMParser.T__1)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Init_specContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(AFMParser.WORD, 0)

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

        def getRuleIndex(self):
            return AFMParser.RULE_init_spec

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

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




    def init_spec(self):

        localctx = AFMParser.Init_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_init_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 82
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 81
                self.match(AFMParser.SPACE)


            self.state = 84
            self.match(AFMParser.WORD)
            self.state = 86
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 85
                self.match(AFMParser.SPACE)


            self.state = 88
            self.match(AFMParser.T__2)
            self.state = 90
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.state = 89
                self.match(AFMParser.SPACE)


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

    class Obligatory_specContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(AFMParser.WORD, 0)

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

        def getRuleIndex(self):
            return AFMParser.RULE_obligatory_spec

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

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




    def obligatory_spec(self):

        localctx = AFMParser.Obligatory_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_obligatory_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 93
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 92
                self.match(AFMParser.SPACE)


            self.state = 95
            self.match(AFMParser.WORD)
            self.state = 97
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,9,self._ctx)
            if la_ == 1:
                self.state = 96
                self.match(AFMParser.SPACE)


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

    class Optional_specContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(AFMParser.WORD, 0)

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

        def getRuleIndex(self):
            return AFMParser.RULE_optional_spec

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

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




    def optional_spec(self):

        localctx = AFMParser.Optional_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_optional_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 100
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 99
                self.match(AFMParser.SPACE)


            self.state = 102
            self.match(AFMParser.T__3)
            self.state = 103
            self.match(AFMParser.WORD)
            self.state = 104
            self.match(AFMParser.T__4)
            self.state = 106
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.state = 105
                self.match(AFMParser.SPACE)


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

    class Non_cardinal_specContext(ParserRuleContext):

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

        def obligatory_spec(self):
            return self.getTypedRuleContext(AFMParser.Obligatory_specContext,0)


        def optional_spec(self):
            return self.getTypedRuleContext(AFMParser.Optional_specContext,0)


        def getRuleIndex(self):
            return AFMParser.RULE_non_cardinal_spec

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

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




    def non_cardinal_spec(self):

        localctx = AFMParser.Non_cardinal_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_non_cardinal_spec)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 110
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
            if la_ == 1:
                self.state = 108
                self.obligatory_spec()
                pass

            elif la_ == 2:
                self.state = 109
                self.optional_spec()
                pass


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

    class CardinalityContext(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(AFMParser.INT)
            else:
                return self.getToken(AFMParser.INT, i)

        def getRuleIndex(self):
            return AFMParser.RULE_cardinality

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

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




    def cardinality(self):

        localctx = AFMParser.CardinalityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_cardinality)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 112
            self.match(AFMParser.T__3)
            self.state = 113
            self.match(AFMParser.INT)
            self.state = 114
            self.match(AFMParser.T__5)
            self.state = 115
            self.match(AFMParser.INT)
            self.state = 116
            self.match(AFMParser.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 Cardinal_specContext(ParserRuleContext):

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

        def cardinality(self):
            return self.getTypedRuleContext(AFMParser.CardinalityContext,0)


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

        def obligatory_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Obligatory_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Obligatory_specContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_cardinal_spec

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

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




    def cardinal_spec(self):

        localctx = AFMParser.Cardinal_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_cardinal_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 119
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 118
                self.match(AFMParser.SPACE)


            self.state = 121
            self.cardinality()
            self.state = 123
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 122
                self.match(AFMParser.SPACE)


            self.state = 125
            self.match(AFMParser.T__6)
            self.state = 127 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 126
                self.obligatory_spec()
                self.state = 129 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==AFMParser.WORD or _la==AFMParser.SPACE):
                    break

            self.state = 131
            self.match(AFMParser.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 Attributes_blockContext(ParserRuleContext):

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

        def attribute_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Attribute_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Attribute_specContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_attributes_block

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

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




    def attributes_block(self):

        localctx = AFMParser.Attributes_blockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_attributes_block)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 133
            self.match(AFMParser.T__8)
            self.state = 137
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==AFMParser.WORD:
                self.state = 134
                self.attribute_spec()
                self.state = 139
                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 Attribute_specContext(ParserRuleContext):

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

        def attribute_name(self):
            return self.getTypedRuleContext(AFMParser.Attribute_nameContext,0)


        def attribute_domain(self):
            return self.getTypedRuleContext(AFMParser.Attribute_domainContext,0)


        def attribute_default_value(self):
            return self.getTypedRuleContext(AFMParser.Attribute_default_valueContext,0)


        def attribute_null_value(self):
            return self.getTypedRuleContext(AFMParser.Attribute_null_valueContext,0)


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

        def getRuleIndex(self):
            return AFMParser.RULE_attribute_spec

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

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




    def attribute_spec(self):

        localctx = AFMParser.Attribute_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_attribute_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 140
            self.attribute_name()
            self.state = 142
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 141
                self.match(AFMParser.SPACE)


            self.state = 144
            self.match(AFMParser.T__2)
            self.state = 146
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
            if la_ == 1:
                self.state = 145
                self.match(AFMParser.SPACE)


            self.state = 148
            self.attribute_domain()
            self.state = 150
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 149
                self.match(AFMParser.SPACE)


            self.state = 152
            self.match(AFMParser.T__5)
            self.state = 154
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 153
                self.match(AFMParser.SPACE)


            self.state = 156
            self.attribute_default_value()
            self.state = 158
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 157
                self.match(AFMParser.SPACE)


            self.state = 160
            self.match(AFMParser.T__5)
            self.state = 162
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 161
                self.match(AFMParser.SPACE)


            self.state = 164
            self.attribute_null_value()
            self.state = 165
            self.match(AFMParser.T__1)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Attribute_nameContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(AFMParser.WORD, 0)

        def LOWERCASE(self):
            return self.getToken(AFMParser.LOWERCASE, 0)

        def getRuleIndex(self):
            return AFMParser.RULE_attribute_name

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

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




    def attribute_name(self):

        localctx = AFMParser.Attribute_nameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_attribute_name)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 167
            self.match(AFMParser.WORD)
            self.state = 168
            self.match(AFMParser.T__9)
            self.state = 169
            self.match(AFMParser.LOWERCASE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Attribute_domainContext(ParserRuleContext):

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

        def discrete_domain_spec(self):
            return self.getTypedRuleContext(AFMParser.Discrete_domain_specContext,0)


        def range_domain_spec(self):
            return self.getTypedRuleContext(AFMParser.Range_domain_specContext,0)


        def getRuleIndex(self):
            return AFMParser.RULE_attribute_domain

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

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




    def attribute_domain(self):

        localctx = AFMParser.Attribute_domainContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_attribute_domain)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 173
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [AFMParser.T__3]:
                self.state = 171
                self.discrete_domain_spec()
                pass
            elif token in [AFMParser.INTEGER, AFMParser.SPACE]:
                self.state = 172
                self.range_domain_spec()
                pass
            else:
                raise NoViableAltException(self)

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

    class Discrete_domain_specContext(ParserRuleContext):

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

        def value_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Value_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Value_specContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_discrete_domain_spec

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

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




    def discrete_domain_spec(self):

        localctx = AFMParser.Discrete_domain_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_discrete_domain_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 175
            self.match(AFMParser.T__3)
            self.state = 176
            self.value_spec()
            self.state = 181
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==AFMParser.T__5:
                self.state = 177
                self.match(AFMParser.T__5)
                self.state = 178
                self.value_spec()
                self.state = 183
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 184
            self.match(AFMParser.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 Range_domain_specContext(ParserRuleContext):

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

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

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

        def domain_range(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Domain_rangeContext)
            else:
                return self.getTypedRuleContext(AFMParser.Domain_rangeContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_range_domain_spec

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

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




    def range_domain_spec(self):

        localctx = AFMParser.Range_domain_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_range_domain_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 187
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 186
                self.match(AFMParser.SPACE)


            self.state = 189
            self.match(AFMParser.INTEGER)
            self.state = 191
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,26,self._ctx)
            if la_ == 1:
                self.state = 190
                self.match(AFMParser.SPACE)


            self.state = 196
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==AFMParser.T__3:
                self.state = 193
                self.domain_range()
                self.state = 198
                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 Domain_rangeContext(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(AFMParser.INT)
            else:
                return self.getToken(AFMParser.INT, i)

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

        def getRuleIndex(self):
            return AFMParser.RULE_domain_range

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

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




    def domain_range(self):

        localctx = AFMParser.Domain_rangeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_domain_range)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 199
            self.match(AFMParser.T__3)
            self.state = 200
            self.match(AFMParser.INT)
            self.state = 202
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 201
                self.match(AFMParser.SPACE)


            self.state = 204
            self.match(AFMParser.T__10)
            self.state = 206
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 205
                self.match(AFMParser.SPACE)


            self.state = 208
            self.match(AFMParser.INT)
            self.state = 209
            self.match(AFMParser.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 Attribute_default_valueContext(ParserRuleContext):

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

        def value_spec(self):
            return self.getTypedRuleContext(AFMParser.Value_specContext,0)


        def getRuleIndex(self):
            return AFMParser.RULE_attribute_default_value

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

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




    def attribute_default_value(self):

        localctx = AFMParser.Attribute_default_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_attribute_default_value)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 211
            self.value_spec()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Attribute_null_valueContext(ParserRuleContext):

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

        def value_spec(self):
            return self.getTypedRuleContext(AFMParser.Value_specContext,0)


        def getRuleIndex(self):
            return AFMParser.RULE_attribute_null_value

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

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




    def attribute_null_value(self):

        localctx = AFMParser.Attribute_null_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_attribute_null_value)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 213
            self.value_spec()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Value_specContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(AFMParser.WORD, 0)

        def LOWERCASE(self):
            return self.getToken(AFMParser.LOWERCASE, 0)

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

        def DOUBLE(self):
            return self.getToken(AFMParser.DOUBLE, 0)

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

        def getRuleIndex(self):
            return AFMParser.RULE_value_spec

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

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




    def value_spec(self):

        localctx = AFMParser.Value_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_value_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 215
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << AFMParser.LOWERCASE) | (1 << AFMParser.WORD) | (1 << AFMParser.INT) | (1 << AFMParser.DOUBLE) | (1 << AFMParser.STRING))) != 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 Constraints_blockContext(ParserRuleContext):

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

        def constraint_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Constraint_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Constraint_specContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_constraints_block

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

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




    def constraints_block(self):

        localctx = AFMParser.Constraints_blockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_constraints_block)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 217
            self.match(AFMParser.T__11)
            self.state = 221
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << AFMParser.T__12) | (1 << AFMParser.NOT) | (1 << AFMParser.LOWERCASE) | (1 << AFMParser.WORD) | (1 << AFMParser.INT) | (1 << AFMParser.DOUBLE) | (1 << AFMParser.SPACE))) != 0):
                self.state = 218
                self.constraint_spec()
                self.state = 223
                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 Constraint_specContext(ParserRuleContext):

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

        def brackets_spec(self):
            return self.getTypedRuleContext(AFMParser.Brackets_specContext,0)


        def simple_spec(self):
            return self.getTypedRuleContext(AFMParser.Simple_specContext,0)


        def getRuleIndex(self):
            return AFMParser.RULE_constraint_spec

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

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




    def constraint_spec(self):

        localctx = AFMParser.Constraint_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_constraint_spec)
        try:
            self.state = 226
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 224
                self.brackets_spec()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 225
                self.simple_spec()
                pass


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

    class Brackets_specContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(AFMParser.WORD, 0)

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

        def simple_spec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AFMParser.Simple_specContext)
            else:
                return self.getTypedRuleContext(AFMParser.Simple_specContext,i)


        def getRuleIndex(self):
            return AFMParser.RULE_brackets_spec

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

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




    def brackets_spec(self):

        localctx = AFMParser.Brackets_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_brackets_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 229
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 228
                self.match(AFMParser.SPACE)


            self.state = 231
            self.match(AFMParser.WORD)
            self.state = 233
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 232
                self.match(AFMParser.SPACE)


            self.state = 235
            self.match(AFMParser.T__6)
            self.state = 237
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,34,self._ctx)
            if la_ == 1:
                self.state = 236
                self.match(AFMParser.SPACE)


            self.state = 242
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,35,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 239
                    self.simple_spec() 
                self.state = 244
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,35,self._ctx)

            self.state = 246
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 245
                self.match(AFMParser.SPACE)


            self.state = 248
            self.match(AFMParser.T__7)
            self.state = 250
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,37,self._ctx)
            if la_ == 1:
                self.state = 249
                self.match(AFMParser.SPACE)


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

    class Simple_specContext(ParserRuleContext):

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

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


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

        def getRuleIndex(self):
            return AFMParser.RULE_simple_spec

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

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




    def simple_spec(self):

        localctx = AFMParser.Simple_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_simple_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 253
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,38,self._ctx)
            if la_ == 1:
                self.state = 252
                self.match(AFMParser.SPACE)


            self.state = 255
            self.expression(0)
            self.state = 257
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==AFMParser.SPACE:
                self.state = 256
                self.match(AFMParser.SPACE)


            self.state = 259
            self.match(AFMParser.T__1)
            self.state = 261
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,40,self._ctx)
            if la_ == 1:
                self.state = 260
                self.match(AFMParser.SPACE)


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

    class ExpressionContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return AFMParser.RULE_expression

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


    class ArithmeticExpContext(ExpressionContext):

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

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

        def arithmetic_operator(self):
            return self.getTypedRuleContext(AFMParser.Arithmetic_operatorContext,0)


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

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


    class AndExpContext(ExpressionContext):

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

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

        def AND(self):
            return self.getToken(AFMParser.AND, 0)

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

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


    class ParenthesisExpContext(ExpressionContext):

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

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

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

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

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


    class RelationalExpContext(ExpressionContext):

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

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

        def relational_operator(self):
            return self.getTypedRuleContext(AFMParser.Relational_operatorContext,0)


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

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


    class OrExpContext(ExpressionContext):

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

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

        def OR(self):
            return self.getToken(AFMParser.OR, 0)

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

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


    class AtomContext(ExpressionContext):

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

        def variable(self):
            return self.getTypedRuleContext(AFMParser.VariableContext,0)

        def number(self):
            return self.getTypedRuleContext(AFMParser.NumberContext,0)

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

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

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


    class LogicalExpContext(ExpressionContext):

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

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

        def logical_operator(self):
            return self.getTypedRuleContext(AFMParser.Logical_operatorContext,0)


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

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


    class NotExpContext(ExpressionContext):

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

        def NOT(self):
            return self.getToken(AFMParser.NOT, 0)
        def expression(self):
            return self.getTypedRuleContext(AFMParser.ExpressionContext,0)


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

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



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = AFMParser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 46
        self.enterRecursionRule(localctx, 46, self.RULE_expression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 285
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,46,self._ctx)
            if la_ == 1:
                localctx = AFMParser.ParenthesisExpContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 265
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==AFMParser.SPACE:
                    self.state = 264
                    self.match(AFMParser.SPACE)


                self.state = 267
                self.match(AFMParser.T__12)
                self.state = 268
                self.expression(0)
                self.state = 269
                self.match(AFMParser.T__13)
                self.state = 271
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
                if la_ == 1:
                    self.state = 270
                    self.match(AFMParser.SPACE)


                pass

            elif la_ == 2:
                localctx = AFMParser.NotExpContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 273
                self.match(AFMParser.NOT)
                self.state = 274
                self.expression(5)
                pass

            elif la_ == 3:
                localctx = AFMParser.AtomContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 276
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==AFMParser.SPACE:
                    self.state = 275
                    self.match(AFMParser.SPACE)


                self.state = 280
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [AFMParser.LOWERCASE, AFMParser.WORD]:
                    self.state = 278
                    self.variable()
                    pass
                elif token in [AFMParser.INT, AFMParser.DOUBLE]:
                    self.state = 279
                    self.number()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 283
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,45,self._ctx)
                if la_ == 1:
                    self.state = 282
                    self.match(AFMParser.SPACE)


                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 307
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,48,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 = 305
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
                    if la_ == 1:
                        localctx = AFMParser.ArithmeticExpContext(self, AFMParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 287
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 288
                        self.arithmetic_operator()
                        self.state = 289
                        self.expression(8)
                        pass

                    elif la_ == 2:
                        localctx = AFMParser.RelationalExpContext(self, AFMParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 291
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 292
                        self.relational_operator()
                        self.state = 293
                        self.expression(7)
                        pass

                    elif la_ == 3:
                        localctx = AFMParser.AndExpContext(self, AFMParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 295
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 296
                        self.match(AFMParser.AND)
                        self.state = 297
                        self.expression(5)
                        pass

                    elif la_ == 4:
                        localctx = AFMParser.OrExpContext(self, AFMParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 298
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 299
                        self.match(AFMParser.OR)
                        self.state = 300
                        self.expression(4)
                        pass

                    elif la_ == 5:
                        localctx = AFMParser.LogicalExpContext(self, AFMParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 301
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 302
                        self.logical_operator()
                        self.state = 303
                        self.expression(3)
                        pass

             
                self.state = 309
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,48,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 Logical_operatorContext(ParserRuleContext):

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

        def IFF(self):
            return self.getToken(AFMParser.IFF, 0)

        def IMPLIES(self):
            return self.getToken(AFMParser.IMPLIES, 0)

        def REQUIRES(self):
            return self.getToken(AFMParser.REQUIRES, 0)

        def EXCLUDES(self):
            return self.getToken(AFMParser.EXCLUDES, 0)

        def getRuleIndex(self):
            return AFMParser.RULE_logical_operator

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

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




    def logical_operator(self):

        localctx = AFMParser.Logical_operatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_logical_operator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 310
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << AFMParser.IFF) | (1 << AFMParser.IMPLIES) | (1 << AFMParser.REQUIRES) | (1 << AFMParser.EXCLUDES))) != 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 Arithmetic_operatorContext(ParserRuleContext):

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

        def ADD(self):
            return self.getToken(AFMParser.ADD, 0)

        def SUB(self):
            return self.getToken(AFMParser.SUB, 0)

        def MULT(self):
            return self.getToken(AFMParser.MULT, 0)

        def DIV(self):
            return self.getToken(AFMParser.DIV, 0)

        def MOD(self):
            return self.getToken(AFMParser.MOD, 0)

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

        def ASIG(self):
            return self.getToken(AFMParser.ASIG, 0)

        def getRuleIndex(self):
            return AFMParser.RULE_arithmetic_operator

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

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




    def arithmetic_operator(self):

        localctx = AFMParser.Arithmetic_operatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_arithmetic_operator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 312
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << AFMParser.ADD) | (1 << AFMParser.SUB) | (1 << AFMParser.MULT) | (1 << AFMParser.DIV) | (1 << AFMParser.MOD) | (1 << AFMParser.POW) | (1 << AFMParser.ASIG))) != 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 Relational_operatorContext(ParserRuleContext):

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

        def HIGHER_THAN(self):
            return self.getToken(AFMParser.HIGHER_THAN, 0)

        def LOWER_THAN(self):
            return self.getToken(AFMParser.LOWER_THAN, 0)

        def HIGHER_EQUAL_THAN(self):
            return self.getToken(AFMParser.HIGHER_EQUAL_THAN, 0)

        def LOWER_EQUAL_THAN(self):
            return self.getToken(AFMParser.LOWER_EQUAL_THAN, 0)

        def EQUAL(self):
            return self.getToken(AFMParser.EQUAL, 0)

        def DISTINCT(self):
            return self.getToken(AFMParser.DISTINCT, 0)

        def getRuleIndex(self):
            return AFMParser.RULE_relational_operator

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

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




    def relational_operator(self):

        localctx = AFMParser.Relational_operatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_relational_operator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 314
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << AFMParser.HIGHER_THAN) | (1 << AFMParser.LOWER_THAN) | (1 << AFMParser.HIGHER_EQUAL_THAN) | (1 << AFMParser.LOWER_EQUAL_THAN) | (1 << AFMParser.EQUAL) | (1 << AFMParser.DISTINCT))) != 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 NumberContext(ParserRuleContext):

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

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

        def DOUBLE(self):
            return self.getToken(AFMParser.DOUBLE, 0)

        def getRuleIndex(self):
            return AFMParser.RULE_number

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

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




    def number(self):

        localctx = AFMParser.NumberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_number)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 316
            _la = self._input.LA(1)
            if not(_la==AFMParser.INT or _la==AFMParser.DOUBLE):
                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 VariableContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(AFMParser.WORD, 0)

        def LOWERCASE(self):
            return self.getToken(AFMParser.LOWERCASE, 0)

        def getRuleIndex(self):
            return AFMParser.RULE_variable

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

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




    def variable(self):

        localctx = AFMParser.VariableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_variable)
        try:
            self.state = 324
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [AFMParser.WORD]:
                self.enterOuterAlt(localctx, 1)
                self.state = 318
                self.match(AFMParser.WORD)
                self.state = 321
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,49,self._ctx)
                if la_ == 1:
                    self.state = 319
                    self.match(AFMParser.T__9)
                    self.state = 320
                    self.match(AFMParser.LOWERCASE)


                pass
            elif token in [AFMParser.LOWERCASE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 323
                self.match(AFMParser.LOWERCASE)
                pass
            else:
                raise NoViableAltException(self)

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



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

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

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

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

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

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




