diff options
Diffstat (limited to 'prolog')
-rw-r--r-- | prolog/lexer.py | 9 | ||||
-rw-r--r-- | prolog/parser.py | 16 |
2 files changed, 23 insertions, 2 deletions
diff --git a/prolog/lexer.py b/prolog/lexer.py index 7ca67e1..f905a2b 100644 --- a/prolog/lexer.py +++ b/prolog/lexer.py @@ -46,6 +46,15 @@ operators = { r'@=<': 'LEL', r'@>': 'GTL', r'@>=': 'GEL', + r'#=': 'EQFD', + r'#\=': 'NEQFD', + r'#<': 'LTFD', + r'#=<': 'LEFD', + r'#>': 'GTFD', + r'#>=': 'GEFD', + r'in': 'IN', + r'ins': 'INS', + r'..': 'THROUGH', r'+': 'PLUS', r'-': 'MINUS', r'*': 'STAR', diff --git a/prolog/parser.py b/prolog/parser.py index 19d2da5..4a3f4b5 100644 --- a/prolog/parser.py +++ b/prolog/parser.py @@ -24,7 +24,7 @@ precedence = ( ('nonassoc', 'FROM'), ('right', 'IMPLIES'), ('right', 'NOT'), - ('nonassoc', 'EQU', 'NEQU', 'EQ', 'NEQ', 'UNIV', 'IS', 'EQA', 'NEQA', 'LT', 'LE', 'GT', 'GE', 'LTL', 'LEL', 'GTL', 'GEL'), + ('nonassoc', 'EQU', 'NEQU', 'EQ', 'NEQ', 'UNIV', 'IS', 'EQA', 'NEQA', 'LT', 'LE', 'GT', 'GE', 'LTL', 'LEL', 'GTL', 'GEL', 'IN', 'INS', 'THROUGH', 'EQFD', 'NEQFD', 'LTFD', 'LEFD', 'GTFD', 'GEFD'), ('left', 'PLUS', 'MINUS'), ('left', 'STAR', 'DIV', 'IDIV', 'MOD'), ('nonassoc', 'POW'), @@ -123,16 +123,28 @@ def p_term_binary(p): | term NEQ term | term UNIV term | term IS term + | term EQA term | term NEQA term | term LT term | term LE term | term GT term | term GE term + | term LTL term | term LEL term | term GTL term - | term GEL term''' + | term GEL term + + | term THROUGH term + | term IN term + | term INS term + | term EQFD term + | term NEQFD term + | term LTFD term + | term LEFD term + | term GTFD term + | term GEFD term''' p[0] = Tree('term', [p[1], make_token(p, 2), p[3]]) def p_term_unary(p): '''term : NOT term |