Parrot Compiler Tools Running Your Programming Language on Parrot #22

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)
}
continued...
Copyright © 2007 chromatic and Patrick Michaud