Forum: Ruby The Ruby Grammar Project

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
912c61d9da47754de7039f4271334a9f?d=identicon&s=25 mental (Guest)
on 2005-11-25 23:59
(Received via mailing list)
=== 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-...

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
5da4c52f43677f395aff5bde775593c2?d=identicon&s=25 Daniel Schierbeck (dasch)
on 2005-11-26 00:39
(Received via mailing list)
Hell yeah!
32edd0717b3144d5c58a352d613abdc9?d=identicon&s=25 surrender_it (Guest)
on 2005-11-26 02:44
(Received via mailing list)
MenTaLguY ha scritto:
<snip>

hooray for syntax lawyers!
7264fb16beeea92b89bb42023738259d?d=identicon&s=25 chneukirchen (Guest)
on 2005-11-26 12:28
(Received via mailing list)
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?
912c61d9da47754de7039f4271334a9f?d=identicon&s=25 mental (Guest)
on 2005-11-26 18:43
(Received via mailing list)
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?

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
This topic is locked and can not be replied to.