[Rubygrammar-grammarians] Ruby Grammar Project
Terence Parr
parrt at cs.usfca.edu
Fri Nov 25 16:10:39 EST 2005
On Nov 25, 2005, at 12:30 PM, MenTaLguY wrote:
> On Fri, 2005-11-25 at 10:53 -0800, Terence Parr wrote:
>> Cool. Was wondering about that. Let's do in Java (only stable v3
>> target at the moment) and then dump ASTs to disk and then compare.
>
> Yeah, that would definitely be a lot easier.
>
> Let's do it.
>
> I guess we need:
>
> 1. an on-disk format to dump the ASTs to
>
> 2. a program that dumps using the existing YACC grammar
>
> 3. a java program that dumps using the ANTLR grammar
>
> 4. a program in (language-of-choice) which compares dumped ASTs
Yup.
> I can do #2, you will probably want to do #3, and we can probably
> defer
> #4 until we've got things reasonably close and get tired of visual
> inspection. If we're careful about whitespace plain diff(1) might do.
Yep. I usually dump in lisp form
( root child1 child2 ... )
XML format works too.
> Unfortunately I've found that MetaRuby's ParseTree isn't going to be
> comprehensive enough. It just does individual methods, not arbitrary
> fragments or whole scripts.
Well, that's cool. We'll check whole programs at a time.
> However, looking at Ruby's source, it apparently has a "ripper" build
> configuration which appears to dump parse trees somehow. I'll
> investigate that, as it may dictate the ultimate format we use for #1.
Ah. Sure. Dumping in any format from an AST is easy.
Ter
More information about the Rubygrammar-grammarians
mailing list