The pyggy module is the container for the entire PyGgy and PyLly package. Importing this module loads in the ``simple'' API. This API consists of a number of utility functions and exception classes.
fname, targ, debug=0, forcgen=0) |
debug
argument
is specified, increased debugging information is emitted while
processing the spec file. For
a description of the debug levels see the documentation on the
pyggy.pyggy and pyggy.pylly modules. If forcegen
is true, the specification file is processed whether or not it is
newer than the target file.
If an invalid specification file is specified, pyggy.ApiError is raised. Any exception raised by pyggy.pyggy.parsespec or pyggy.pylly.parsespec may also be raised.
specfname, debug=0, forcegen=0) |
debug
and forcegen
have the
same meaning as in the generate function.
This function can raise any of the exceptions raised by generate.
specfname, debug=0, forcegen=0) |
debug
and forcegen
have the
same meaning as in the generate function.
This function can raise any of the exceptions raised by generate.
t, gram, allowambig=0) |
allowambig
is used to specify that ambiguous
parses are allowed, otherwise a pyggy.AmbigParseError is
raised if any ambiguities are encountered in the parse tree.
The function walks the parse tree in a bottom-up fashion executing
the semantic action code for each production used in the derivation.
For each action executed, the list of the values from the right
hand side of the production are passed in. These values are either
from the value
fields of tokens, or the values previously
returned by other action code functions. If ambiguous parses are
disallowed, each right hand side element is represented by the
element's unique value. In the case that ambiguous parses are allowed
and an ambiguity is found in the parse tree, the ambiguous right
hand side element will be represented with a pyggy.glr.symnode
instance whose possibilities
field is a list of the alternate
values.
The proctree function returns the value associated with the start symbol which is at the root of the parse tree.
This function may raise pyggy.AmbigParseError if an ambiguous parse is detected or pyggy.ApiError if an invalid tree is passed in. This function alters the parse tree as it operates on it.
str, tok) |
str
and the token that caused the error in tok
. This exception
is a type of pyggy.Error.
See the PyGgy Home Page.