Perl 6 / Parrot Parrot Compiler Toolkit #13

calc example -- test parsing

$ make
$ parrot calc.pbc --target=parse
> 3 + 4
"parse" => PMC 'Calc::Grammar' => "3 + 4\n" @ 0 {
     <statement> => ResizablePMCArray (size:1) [
         PMC 'Calc::Grammar' => "3 + 4\n" @ 0 {
             <term> => ResizablePMCArray (size:2) [
                 PMC 'Calc::Grammar' => "3" @ 0,
                 PMC 'Calc::Grammar' => "4" @ 4
             ]
             <addop> => PMC 'Calc::Grammar' => "+" @ 2
         }
     ]
 }

==> We now have a working parser! Yay!

Copyright © 2009
http://www.pmichaud.com/2009/pres/