Ruby-lex


#1

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.


#2

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/). Rex is the pardon for
ruby-lex and racc the pardon for ruby-yacc. So you can parsing with
tokens. :slight_smile:

Best regards.
Jan