develooper Front page | perl.perl6.compiler | Postings from December 2004

Let the hacking commence!

Thread Next
Luke Palmer
December 20, 2004 14:19
Let the hacking commence!
Message ID:
This list is for people interested in building the Perl 6 compiler.  Now
you have your first real task!  

We have to make a formal grammar for Perl 6.  Perl 6 is a huge language,
so the task seems better done incrementally by the community.  The
current version can be seen temporarily at until the svn repository is fully
set up.  I've also attached the initial revision to this message.

It's written in a top-down fashion so far (because that's how my brain
works with grammars), but feel free to work on it bottom-up, left-right
(though recall that we have to make an LL grammar :-), inside-out,
whatever.  Let's just get rules written.  Also, document your work as
much as possible.  We won't be accepting new rules without explanation
unless they are *really* trivial.

Send patches to this list.

Patrick will shortly write an introduction explaining our larger design
goals.  I'll just be focusing on the more technical stuff.  With that in
mind, here are a couple of technical notes:

This grammar should be suitable for both the bootstrap and the main
language.  That means that if there's something that should go in one
but not the other, it shouldn't go into this grammar.

Also, don't use rule parameters, conditionals, or code blocks.  Those
things require us to know Perl 6 before we're done defining Perl 6.
Keep it essentially BNF with Perl 6 syntax (it's okay to use groups and
quantifiers though, since those can always be converted to formal BNF).

Keep the grammar LL(k), which means no left recursion.  If you need to
write a rule left-recursively, you probably need to change that into a
repeat quantifier one level higher.

We're going to be sandwitching an operator-precedence parser in between
two recursive descents to achieve a balance of speed and dynamism.  That
means that we don't need to worry about that huge list of operators.  We
only need to worry about the ones that take non-standard operands, like
==> or ~~.  The others will be encoded in a computer-readable table

Most of all, hack liberally!  Don't be afraid to change stuff around.
These patches are easy to write, and they can be as small or as large as
you feel necessary.  It's also helpful to make suggestions even if you
don't have a patch.

Have fun,

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About