NAME
abc::Grammar::Actions - ast transformations for abc
DESCRIPTION
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:
- It often helps to refer to the rules in grammar.pg when looking at the corresponding methods here.
- Within a method,
$<foo>
refers to the named capturefoo
within the$/
match object. Normally this is either another match object or an array of match objects. - The
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>
".