Leon Brocard <acme / astray.com> wrote: >One of the the most recent crazy things I've done is to try to rewrite >the Ruby parser/lexer in Perl using the Parse::Yapp module. :-) I tried something along these lines with Smalltalk. But why do you use Perl (besides the obvious idea to embedd our Ruby system in Perl) if you could use Ruby? I don't know Perl, but from the CPAN description of YAPP, it looks pretty much like YACC. Would it be difficult to either port that code to Ruby or use RACC (also YACC-like). >The tricky bit is the lexer (see that lovely yylex routine) and the >lexer state (lex_state), which is sometimes set in the grammar >actions. Hence, you need to look at the actions ;-) Is this really needed? Or could a better grammar work around these - I'd call them problems? >Summary: it's entirely possible to implement a parser for Ruby from >Ruby's parse.c. I think, the problem is, as long as the .y/.c files are the only base for an implementation and there's no formal language reference, it will be very difficult to create something that is (guaranteed) compatible to the original C-Version of Ruby. >ps so why do you think I'm writing a Ruby parser in Perl? ;-) To beat them from within? :-) bye -- Stefan Matthias Aust \/ Truth Until Paradox