worked on documentation and added an optional environment parameter

This commit is contained in:
hellerve
2015-07-09 17:36:32 +02:00
parent 9d4406907a
commit a19dd4508c
2 changed files with 17 additions and 2 deletions

View File

@@ -213,7 +213,20 @@ def statements():
return Exp(statement(), sep)
def parser():
"""
Builds a parser for Imp.
returns -- a parser for the Imp language
"""
return Phrase(statements())
def parse(tokens):
"""
The parser entry point, takes a list of tokens and
transforms them into an AST.
tokens -- the token list
returns -- the AST
"""
return parser()(tokens, 0)