Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pm's YAPC::NA talk online

1 view
Skip to first unread message

Patrick R. Michaud

unread,
Jun 27, 2006, 5:41:51 PM6/27/06
to perl6-c...@perl.org, perl6-i...@perl.org
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

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

Audrey Tang

unread,
Jun 27, 2006, 7:07:20 PM6/27/06
to perl6-c...@perl.org, p6i, perl6-l...@perl.org

在 2006/6/27 下午 4:41 時,Patrick R. Michaud 寫到:

> 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

PGP.sig

nap...@spiderfish.net

unread,
Jun 28, 2006, 5:26:45 AM6/28/06
to Patrick R. Michaud, perl6-c...@perl.org, perl6-i...@perl.org
Hi there!

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

Chromatic

unread,
Jun 28, 2006, 9:07:40 AM6/28/06
to perl6-c...@perl.org, João Cruz Morais, Patrick R. Michaud, perl6-i...@perl.org
On Wednesday 28 June 2006 02:26, João Cruz Morais wrote:

> 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

Jonathan Scott Duff

unread,
Jun 28, 2006, 9:12:42 AM6/28/06
to João Cruz Morais, Patrick R. Michaud, perl6-c...@perl.org, perl6-i...@perl.org

I'm no expert, but I'll hazard some answers:

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

Patrick R. Michaud

unread,
Jun 29, 2006, 1:51:49 PM6/29/06
to João Cruz Morais, perl6-c...@perl.org, perl6-i...@perl.org
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

0 new messages