[ANN] The Ruby Grammar Project

=== HELLO?

Hi there.

With all this talk lately about "Ruby grammar this" and "Ruby grammar
that", I'd like to take this moment to announce the newly-formed The
Ruby Grammar Project.

=== WHAT?

The The Ruby Grammar Project aims to:

1. Develop an ANTLR grammar as an alternative to the YACC grammar which
is ruining everybody's parties these days.

2. Draw up a formal specification of Ruby's grammar and keep it
up-to-date.

Especially for people who are making Ruby implementations, this should
be two shades of awesome.

=== BUT?

It doesn't aim to:

1. Innovate the Ruby grammar.

2. Provide a forum for debating features of the Ruby grammar.

We're descriptivists.

Don't like ->{} ? Don't look at us. If matz says we get stabby blocks,
we get stabby blocks.

=== WHO?

YOU. We are the Grammarians. Join us!

You want to be on the winning side, right? Our shadow operatives have
already successfully captured Doctor Terence Parr, famed parser
researcher and primary author of ANTLR. Soon, the world shall tremble
before our orbiting space station of DOOM!

Wait, wrong script.

If Ruby's grammar interests you, I'd encourage you to come along and
pitch in. Look, we even have our own mailing list:

http://rubyforge.org/mailman/listinfo/rubygrammar-grammarians

Right now one of the big things on the table is yanking
'ripper' (http://rubyforge.org/projects/ripper/) and fashioning from it
a test harness for the ANTLR grammar.

Specifically, the important part is dumping the parse tree from ripper
into a file. YAML maybe. Pretty easy, I think? But we could use an
extra pair of hands to do it.

=== WHY?

Everybody's been talking about Ruby's grammar lately. Seems like
there's a lot of interest, but all the different isolated groups of
people just aren't talking to one another much. Trains and buses
passing in the night.

I want to set up a place for this Ruby grammar stuff. So, for example,
rather than wistfully remarking about how nice it would be to have a
better alternative to the rather inscrutable YACC grammar, we can
actually do something.

I firmly believe that every idea has an appointed time, whose time will
come. And things. But what if that time doesn't come?

That almost happened once. The invention of the aeroplane was delayed
and delayed until the cosmic committee finally noticed we were long
overdue. But the pressure was already built-up and rather than the
aeroplane neatly emerging from the mind of some cranky but affable old
genius named Norberto Parks (who liked to walk around town on Tuesdays
and also the smell of gingerbread), it exploded all over the world:

Mozhaiski, Ader. Whitehead, Gilmore, Pearce. Jatho, Wright (Wrights?),
Vuia, Ellehammer and Santos-Dumont.

But what if it hadn't?

Soon, the pressure should have built up to the point where all the
world's supply of genii would have been consumed by a sudden and
spontaneous explosion of aeroplanery. Chaos! Fully-formed biplanes
tumbling from the hedgerows!

It is clear from the rising buzz about reformulations of Ruby's grammar
that we are once again nearing such a crisis point. Unless someone
springs into action soon, I fear Rubyists all over the world will begin
collapsing at their keyboards, half-tokenised grammars spilling from
their ears!

This is for our own safety, people.

Love,

-mental

Hell yeah!

MenTaLguY ha scritto:
<snip>

hooray for syntax lawyers!

MenTaLguY <mental@rydia.net> writes:

The The Ruby Grammar Project aims to:

1. Develop an ANTLR grammar as an alternative to the YACC grammar which
is ruining everybody's parties these days.

In general, a good idea. However, can there be made a pure-Ruby
parser from an ANTLR grammar?

···

-mental

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Do you mean:

1. Is it possible to write a complete grammar for Ruby in ANTLR, given
how squirrely its (Ruby's) syntax is?

2. Does ANTLR have a backend that can generate parsers in Ruby?

The answers are:

1. Yes. Ter (who is primarily writing the grammar) seems pretty
confident that if YACC can do it, ANTLR can do it. Given he's a guy on
the forefront of parser research, I think he can make it happen.

2. Not yet but eventually. The grammar will be for the new ANTLR v3,
for which most backends are still being written. I'm working on the
Ruby backend, though that's under the aegis of the ANTLR project rather
than the The Ruby Grammar Project.

-mental

···

On Sat, 2005-11-26 at 20:27 +0900, Christian Neukirchen wrote:

MenTaLguY <mental@rydia.net> writes:

> The The Ruby Grammar Project aims to:
>
> 1. Develop an ANTLR grammar as an alternative to the YACC grammar which
> is ruining everybody's parties these days.

In general, a good idea. However, can there be made a pure-Ruby
parser from an ANTLR grammar?