APL Parrot Target Practice #20

Transformation example

Both single and double-quoted strings are just strings, thus we store them as "value" nodes in the AST.

The transformation rule is:

transform result (APL::Grammar::single_quoted_character) :language('PIR') { 
  .local pmc result
  result = new 'PAST::Val'
  result.set_node(node)
  $S0 = node
  if $S0 != "''" goto done
  $S0 = "'"
done:
  result['value'] = $S0 
  result['class'] = '.String'
  .return (result) 
}   
Copyright © 2006 Will Coleda & Patrick Michaud