worked on documentation and added an optional environment parameter
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user