On Mon, 02 Apr 2001  15:30:22 +0900, Yukihiro Matsumoto wrote:
> Hi,
> 
> In message "[ruby-talk:13388] Using Antlr for Ruby? (was RE:  Re: why won't "( a) = 1" parse?)"
>     on 01/04/01, Christophe Broult <cbroult / sapient.com> writes:
> 
> |Has anyone thought about using Antlr (http://www.antlr.org)?
> 
> Somebody suggested, but I couldn't take time to inspect it yet.
> This specific one is very tricky.  I'm not sure Antlr could fix this.
> And I have to confess that I have several other leftovers in Ruby.

FYI: I've started a translation of the Ruby grammar to ANTLR. I've
tried handling whitespace in both parser and lexer, neither of both
being very succesful, and am currently thinking of implementing this
with multiple lexers (like multiple YACC lexer states).

ANTLR uses DFA based lexers that are are specified in the same EBNF
notation used to specify the parser. This implies you can also use
semantic and syntactic predicates in the lexer spec, very powerful
indeed.

If you state the leftovers I could try implementing them in the ANTLR
grammar as a proof-of-principle.

As for added dependencies on C++ and Java: you can compile a binary
for ANTLR using g++'s libgcj; this removes the Java dependency. ANTLR
generates Java, C++ or Sather parsers, so C++ would be a logical
choice. The ANTLR package includes a sample that demonstrates
interoperation with C (using a flex lexer) so that shouldn't pose a
problem.

	Michel