http://www.pmichaud.com/2006/pres/yapc-perl6/slide.html
The slides for my second talk "Parser, Perl 6 Rules, and
the Parrot Grammar Engine" will be available tomorrow at
http://www.pmichaud.com/2006/pres/yapc-parsers/slide.html
Pm
> For any who may be interested, my talk slides for
> "Perl 6 Compiler Status and the Parrot Compiler Toolkit"
> (presented today at YAPC::NA) are available at
>
> http://www.pmichaud.com/2006/pres/yapc-perl6/slide.html
That was a wonderful talk. Thanks Patrick. :-)
My talk ("Deploying Perl 6") is available at:
http://pugs.blogs.com/talks/yapcna-deploy-perl6.pdf
http://pugs.blogs.com/talks/yapcna-deploy-perl6.swf
http://pugs.blogs.com/talks/yapcna-deploy-perl6.tar.gz (HTML+images)
Thanks,
Audrey
I'm new to Parrot but reading from your slides if I understood correctly:
- PGE parses input according to a grammar and produces a derivation tree.
- TGE transforms the parse tree into an abstract syntax tree.
With that said I have some questions (i'm sorry if they were answered
already somewhere):
- Whats the point of using PGE+TGE over the good old LEX+YACC besides the
better regexps?
- Can I use PGE skipping TGE?
- PAST seems just fine as a concept but isn't it useless if I can target
directly to POST with minor fuss?
Good luck for today's presentation :)
Best regards,
João Cruz Morais
> With that said I have some questions (i'm sorry if they were answered
> already somewhere):
> - Whats the point of using PGE+TGE over the good old LEX+YACC besides the
> better regexps?
Transforming trees with real objects is a lot easier than mangling C data
structures.
> - Can I use PGE skipping TGE?
Yes.
> - PAST seems just fine as a concept but isn't it useless if I can target
> directly to POST with minor fuss?
Define "minor"; I've found it much easier in Pheme to go from one tree
structure to another rather than from one textual representation to another.
After a bit of learning, it's pretty obvious which is the appropriate level
for a specific transformation. (Oh, I want to hoist out define-lambda pairs;
that's obviously PAST, so that I can scan the whole tree for Sub declarations
and get the symbol names later.)
-- c
On Wed, Jun 28, 2006 at 04:26:45AM -0500, João Cruz Morais wrote:
> I'm new to Parrot but reading from your slides if I understood correctly:
> - PGE parses input according to a grammar and produces a derivation tree.
> - TGE transforms the parse tree into an abstract syntax tree.
>
> With that said I have some questions (i'm sorry if they were answered
> already somewhere):
> - Whats the point of using PGE+TGE over the good old LEX+YACC besides the
> better regexps?
I think lex+yacc is approximately equivalent to PGE alone. TGE is
something different.
You can't really say "besides the better regexps" because that's part of
the point--having better tools with which to transform one language into
another. PGE lets you annotate how the source language fits together
(what's a token and what order the tokens may come in, etc.) while TGE
let's you take those annotations and turn them into alternate
(presumably more useful) representations.
> - 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.
> - PAST seems just fine as a concept but isn't it useless if I can target
> directly to POST with minor fuss?
It may be "uesless" in that specific case, but I think it's highly
useful in the general case where the impedence mismatch between the
language you are parsing and the language you are generating may be
large (like say, between a very complex and rich language like Perl6 and
a much simpler language like PIR ;). TGE lets you factor out the
complexity of your source language in incremental steps (as small or as
large steps as you want).
> Good luck for today's presentation :)
Yeah, good luck Pm :)
-Scott
--
Jonathan Scott Duff
du...@pobox.com
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