On Thu, 31 May 2001  07:41:26 +0900, Stefan Matthias Aust wrote:
> 
> I wasn't really successful.  Most parsers, including javacc are LL(1)
> or LL(k) parsers.  Unfortunately, Ruby can't be expressed as LL(k)
> grammar, so these parsers aren't powerful enough to be used without
> modification.

While the Ruby grammar might not be LL(k) as-is (haven't got a proof),
parser generators like ANTLR provide you with a lot a of extras to
overcome any difficulties:

- syntactic predicates (i.e., controlled, infinite look-ahead)
- semantic predicates for validating and disambiguating (basically
  gives you type 0 grammars)
- DFA-based lexers, not regexps. The lexers are like miniature LL(k)
  parsers.
- lexers can produce both homogeneous and hetergeneous token object
  streams
- multiple lexers, can be switched, chained, et c.

I've got a partial (80-90%) Ruby grammar for ANTLR, I'll post it when
I can find time sometime this weekend. In my experience, the only
really hard thing is getting Ruby's intelligent but weird whitespace
rules right. There are different ways to solve that (explicit
terminators like in parse.y, predicates, multiple lexers), but I
haven't found an implementation that I really like, yet.

	Michel