Ruby equivalent of Lex (or Flex)?

I'm interested in writing compilers in Ruby. It appears that Racc is
a suitable replacement for Yacc, but I've not found any replacement
for Lex. I've probably missed something. In any case, I'd much
appreciate some help in finding something.

Thanks in advance,
Tom Payne

Rex?

http://raa.ruby-lang.org/project/rex/

-Justin

Tom Payne wrote:

ยทยทยท

I'm interested in writing compilers in Ruby. It appears that Racc is
a suitable replacement for Yacc, but I've not found any replacement
for Lex. I've probably missed something. In any case, I'd much
appreciate some help in finding something.

Thanks in advance,
Tom Payne

Two popular parser generators have or will have ruby support:

ANTLR 3.0 (still in alpha and likely to remain so for another year or
two) will have ruby support too apparently:
http://split-s.blogspot.com/2005/12/antlr-for-ruby.html
They are even working on an antlr 3.0 grammar for ruby itself:
http://rubyforge.org/projects/rubygrammar

Also (not in alpha), there is a ruby version of Coco:
http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/
http://www.zenspider.com/ZSS/Products/CocoR/
http://rubyforge.org/projects/coco-ruby/

It's worth noting that, thanks to grammarian Martin Traverso, the
latest version of ANTLR v3 can generate parsers in Ruby.

http://split-s.blogspot.com/2005/12/antlr-for-ruby.html

It's still pre-alpha, but things only get better from here!

I believe there's also a native Ruby port of ANTLR v2 bopping about
out there, though google isn't helping me out much right now.

A decent LL parser generator really is worth it, though. LALR
sucks.

Incidentally, it looks like Martin will be writing much of the ANTLR
v3 grammar for Ruby. He's got quite a bit done in SVN already.

-mental