diff options
Diffstat (limited to 'test/pkg_test6/parsing/calcparse.py')
-rw-r--r-- | test/pkg_test6/parsing/calcparse.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/pkg_test6/parsing/calcparse.py b/test/pkg_test6/parsing/calcparse.py new file mode 100644 index 0000000..6defaf9 --- /dev/null +++ b/test/pkg_test6/parsing/calcparse.py @@ -0,0 +1,33 @@ +# ----------------------------------------------------------------------------- +# yacc_simple.py +# +# A simple, properly specifier grammar +# ----------------------------------------------------------------------------- + +from .calclex import tokens +from ply import yacc + +# Parsing rules +precedence = ( + ('left','PLUS','MINUS'), + ('left','TIMES','DIVIDE'), + ('right','UMINUS'), + ) + +# dictionary of names +names = { } + +from .statement import * + +from .expression import * + +def p_error(t): + print("Syntax error at '%s'" % t.value) + +import os.path +parser = yacc.yacc(outputdir=os.path.dirname(__file__)) + + + + + |