An ast grammar for our "abc example" (term node)
grammar ABC::ASTGrammar is TGE::Grammar; transform past (ABC::Grammar::term) :language('PIR') { ## build a PAST::Val node for this term ## get the constant value $S0 = node.'text'() .local pmc termpast termpast = new 'PAST::Val' termpast.'init'('node'=>node, 'name'=>$S0, 'vtype'=>'.Integer') .return (termpast) }
node is automatically set by a TGE preamble