Interesting (and useful) exercise with the Ruby grammar by Nick Sieger

  • Thread starter M. Edward (Ed) Borasky
  • Start date
M

M. Edward (Ed) Borasky

Nick Sieger just posted (well ... I just found out about it) a graph of
the Ruby grammar on his blog. He also posted the same graphs for Java
and Javascript. While the pictures are interesting, impressive and
useful, what's even more interesting, to me, anyhow, is that there
exists a tool set to do this sort of thing!

I haven't had a chance to go tracking down the whole tool set yet, but
it's definitely on my todo list at this point. Most of it appears to be
tied to Antlr, which leads me to wonder if it can/should be ported to Ruby.

And yes, Pat, if I can find a grammar for Forth I might well generate
the picture for it. :)

http://blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar

Thanks, Nick!!
 
M

M. Edward (Ed) Borasky

Nick said:
What's interesting with ANTLR 3 is that Ruby is one of the target
languages. I haven't tried it yet but plan to in the near future -- it
would be great if ANTLR would allow a more understandable, maintainable
grammar that would allow Ruby to be able to parse itself.

It wasn't clear from my poking around the web site ... is ANTLRWorks
included in ANTLR 3? It looked like a download of ANTLRWorks included
ANTLR 3. I haven't attempted to get any of the magic up and running yet
-- too busy getting my own project started up.
 
T

Tomasz Wegrzanowski

What's interesting with ANTLR 3 is that Ruby is one of the target
languages. I haven't tried it yet but plan to in the near future -- it
would be great if ANTLR would allow a more understandable, maintainable
grammar that would allow Ruby to be able to parse itself.

If you need an example of ANTLR 3 for Ruby in action,
RLisp ( http://zabor.org/taw/rlisp/ ) uses it to parse Lisp.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top