On Wed, Jun 28, 2006 at 08:12:42AM -0500, Jonathan Scott Duff wrote: > On Wed, Jun 28, 2006 at 04:26:45AM -0500, João Cruz Morais wrote: > > - Can I use PGE skipping TGE? > > I don't see why not. If you look at the bottom of grammar_rules.pg, > you'll see this: > > token syntax_error { <?PGE::Util::die: Syntax error> } > > where PGE::Util::die is a PIR subroutine. IIUC, everywhere you want > some action to be performed (like code generation for instance) you > could put a PIR subroutine in the grammar just as above and, of > course, write the subroutine to do the action.
It's also worth remembering that one can call executable code directly from a rule. token print :lang('PIR') { <expression> {{ $P0 = match['expression'] say $P0 }} } > > - PAST seems just fine as a concept but isn't it useless if I can target > > directly to POST with minor fuss? If one can target POST (or even PIR) directly with minor fuss, then a separate PAST step might not make much sense. But even with a relatively simple language (like APL), it's useful to have the tree-based representation of the program's semantics to be able to manipulate (e.g., optimizations) rather than trying to work directly from the parse tree. > > Good luck for today's presentation :) > > Yeah, good luck Pm :) Thanks! For those who are interested, the slides from the later talks are now online. Perl 6 Compiler Status and the Parrot Compiler Toolkit http://www.pmichaud.com/2006/pres/yapc-perl6/start.html Parsers, Perl 6 Rules, and the Parrot Grammar Engine http://www.pmichaud.com/2006/pres/yapc-parsers/start.html "Parrot Target Practice", Will Coleda http://www.pmichaud.com/2006/pres/yapc-apl/start.html Pm