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 P.



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

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

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.


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:
They are even working on an antlr 3.0 grammar for ruby itself:

Also (not in alpha), there is a ruby version of Coco:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs