[Rubygrammar-grammarians] Ruby Grammar Project
Terence Parr
parrt at cs.usfca.edu
Sat Nov 26 18:27:02 EST 2005
On Nov 26, 2005, at 12:46 PM, Ryan Davis wrote:
> Hey Terr, long time no email... It has been many many years.
Howdy do! Long time...
> I think I can help here. 1) yes, ruby has ties smalltalk, but
> nowhere near the grammar side of things. You'll just have to let go
> of that. It is much more of a loose java grammar than it is a
> smalltalk grammar.
Ok, i'm letting go :)
> 2) I have tools to help this exploration process along quite easily:
>
> 509 % echo "foo bar baz" | parse_tree_show -f
> (eval):1: warning: parenthesize argument(s) for future version
> [[:class,
> :Example,
> :Object,
> [:defn,
> :example,
> [:scope,
> [:block,
> [:args],
> [:fcall, :foo, [:array, [:fcall, :bar, [:array,
> [:vcall, :baz]]]]]]]]]]
Looks cool/useful. Why the :array node?
> This is in my package ParseTree, which you can easily install via
> 'sudo gem install -y ParseTree' assuming you have rubygems installed.
Not yet.
> I tried doing an LR2LL flip on ruby about 2 years ago and got
> stymied. It wasn't nearly as easy as doing smalltalk and I can't
> keep the whole grammar in my head. I've started working on a tool
> for grammar exploration/experimentation (tentatively called
> yaccpuke or GIT - grammar inspection toolkit). It hopes to do only
> a few things, but do them well:
>
> 1) provide a simple DSL for describing grammars by hand ( from
> smalltalk: bod [ uod | be ] )
> 2) ability to read in y.output (stripped grammar from yacc when run
> w/ -v)
> 3) provide an interactive session (via irb) with api to explore and
> manipulate grammar rules ( grammar.cycles? and grammar[:bod].replace
> (:be))
Interesting. :)
> I've got 1 & 2 down and am extending 3 right now. I'm hoping that
> when this tool is done enough it'll provide me the extra brainpower
> to do the LR2LL flip on ruby's yacc based grammar.
>
> I haven't been tracking what you've been up to Terr. I stopped
> using Antlr in the early v2 days (mostly because I stopped coding
> in java and C++ as much as possible) so I don't know if you've done
> more work in this area.
Well, ANTLR v3 is Soooo much more powerful and easy to use. Plus we
have ANTLRWorks http://www.antlr.org/works now too, a grammar dev
environment.
> I should also point out the work being done by Don Roberts and John
> Brant (of refactoring browser fame). They are working on a suite of
> tools that can be taught a new language and then spit out a new
> refactoring browser for that language. They said that in about a
> month (about now actually) they'd be done with C# and able to work
> on back-porting the system into squeak. They have a lot of
> experience in this area and might want to bite off a chunk as well.
> At the very least, the sooner we can get the grammar into a more
> digestible form, the sooner we can have a feature-complete
> refactoring browser!
Yep, getting a nice easy-to-use grammar together should be useful.
My main interest at the moment is making a real grammar for testing
ANTLR v3. :)
Ter
More information about the Rubygrammar-grammarians
mailing list