# Ruby-lex

**URL:** <https://www.ruby-forum.com/t/ruby-lex/89826>\
**Category:** Ruby\
**Created:** [March 29, 2006, 9:19am UTC](https://www.ruby-forum.com/t/ruby-lex/89826 "2006-03-29T09:19:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aca169/32.png) [@dbest](https://www.ruby-forum.com/u/dbest)\
**Post date:** [March 29, 2006, 9:19am UTC](https://www.ruby-forum.com/t/ruby-lex/89826/1 "2006-03-29T09:19:02Z")

</div>

I am not sure if this is the place to ask this, but I dont really have  
any other ideas.

I am trying to use the ruby-lex package, which is a lexical analyzer  
which produces ruby code. It uses flex to parse the lex file, the  
converts the c code into ruby code.

My problem is when I run it on my computer, the final ruby file is  
significantly truncated. I am not out of space, it just always stops  
at betweeen 110 and 130 lines, even when recompiling the examples  
provided. The last line is alway: when (some number).

First question, has anyone seen this before. And is there a fix? Am I  
doing something wrong? Does it interact poorly with ruby 1.8.3 (the  
version I am using)?

Second, is there another alternative to ruby-lex as a lexer. I am  
actually using the pair of tools, ruby-lex and ruby-yacc. I have  
looked at racc, but it seems to be geared towards raw text parsing  
rather than lexing to tokens then parsing the tokens which is what I  
would rather do.

I am working on a compiler for a class that works over a subset of  
java, so robust tools is sort of a must. I was working on this in  
smlnj (and ml-lex and ml-yacc), which I was not very fond of. Would  
love to do it in ruby.

Thanks  
Andy D.

---

<div class="post-metadata">

**Author:** ![dbest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aca169/32.png) [@dbest](https://www.ruby-forum.com/u/dbest)\
**Post date:** [March 30, 2006, 11:59am UTC](https://www.ruby-forum.com/t/ruby-lex/89826/2 "2006-03-30T11:59:12Z")

</div>

Andy D. wrote:

> Second, is there another alternative to ruby-lex as a lexer. I am  
> actually using the pair of tools, ruby-lex and ruby-yacc. I have  
> looked at racc, but it seems to be geared towards raw text parsing  
> rather than lexing to tokens then parsing the tokens which is what I  
> would rather do.  
> Try rex ([http://raa.ruby-lang.org/project/rex/](http://raa.ruby-lang.org/project/rex/)). Rex is the pardon for  
> ruby-lex and racc the pardon for ruby-yacc. So you can parsing with  
> tokens. 🙂

Best regards.  
Jan
