On 4/28/06, Logan Capaldo <logancapaldo / gmail.com> wrote:
>
> On Apr 28, 2006, at 8:54 AM, Christian Neukirchen wrote:
>
> > Kevin Tew <tewk / tewk.com> writes:
> >
> >> The control structure of
> >> Pugs::Compiler::Rules, continuation passing style(CPS), is easily
> >> implemented in Ruby using Procs.
> >
> > Does that scale given Ruby does not perform tail call optimization?
> >
>
> Maybe not, but on the other hand, ruby does have real continuations.
> Maybe he can try doing CPS with Cs instead of Procs.
>
>
> I personally think this is kind of a silly idea. Perl6 rules are
> cool, but they are very very Perl. Regular expressions on steroids,
> not very OO. I think a ruby in ruby project would be much better
> served by a parser combinator library. The problem is having a
> performant one in ruby.

I agree.  I looked at perl6 rules before starting to write a parser
library in ruby.  You can look for Grammar on rubyforge to see what
I've done.  I started working on making a "Grammar" for parsing ruby
but didn't get so far.  And I've been away from ruby for several
months now because of work.  My main problem was converting the LR
yacc grammar to LL.  Now that somebody has done this for ANTLR (also
LL), it shouldn't be too hard.

I solved the performance problems by having the grammar objects
generate there own code (flattening their grammar children also) and
eval it when needed (under the covers - no parser generator step
needed from a usability perspective).  I don't think I checked all of
those enhancements into CVS yet :(  Last I checked, it was faster and
more memory efficient than racc.

Since I've been busy with work stuff, I wouldn't mind some help with this.