parrotcode: ast transformations for abc | |
Contents | Language Implementations | abc |
abc::Grammar::Actions - ast transformations for abc
This file contains the methods that are used by the parse grammar to build the PAST representation of an abc program.
Each method below corresponds to a rule in grammar.pg,
and is invoked at the point where {*}
appears in the rule,
with the current match object as the first argument.
If the line containing {*}
also has a #= key
comment,
then the value of the comment is passed as the second argument to the method.
Some hopefully helpful hints for reading this file:
$<foo>
refers to the named capture foo
within the $/
match object.
Normally this is either another match object or an array of match objects.make
function and $(...)
are used to set and retrieve the result object for a match.
Here,
we use the result object to hold the ast representation of any given match.
So,
in the code below,
whenever you see an expression like $($<foo>)
,
we're really saying "the ast of <foo>
".
|