From: puellula@... Date: 2005-10-28T18:17:04+09:00 Subject: PARSER for RUBY Hi, can you help me? I have to write a parser for Ruby. I had think to use the parser generator ANTLR. I have find Ruby Grammar, but I have problem with ANTLR for "infinite recursion". I have cancel left recursion but I have the same problem :( Please, can you help me? Now I'm trying with a simple grammar to find where is the problem. The simple grammar is: // PARSER class RubyParser extends Parser; options { buildAST=true; } program : compstmt; compstmt : stmt; stmt : stmt1 expr | ; stmt1 : stmt IF | stmt WHILE | stmt UNLESS | stmt UNTIL | ; expr : ; // LEXER class RubyLexer extends Lexer; IF : "if"; WHILE : "while"; UNLESS : "unless"; UNTIL : "until"; I have write this on a file provaLexerParser.g On the command line I have write: antlr provaLexerParser.g and the result is: java -classpath "C:\antlr\275\lib\antlr.jar;" antlr.Tool provaLexerParser.g ANTLR Parser Generator Version 2.7.5 (20050128) 1989-2005 jGuru.com provaLexerParser.g:7:19: infinite recursion to rule stmt1 from rule stmt provaLexerParser.g:9:19: infinite recursion to rule stmt1 from rule stmt1 provaLexerParser.g:10:19: infinite recursion to rule stmt1 from rule stmt1 provaLexerParser.g:11:19: infinite recursion to rule stmt1 from rule stmt1 provaLexerParser.g:12:19: infinite recursion to rule stmt1 from rule stmt1 provaLexerParser.g:7:19: infinite recursion to rule stmt1 from rule stmt provaLexerParser.g:7: warning:nondeterminism between alts 1 and 2 of block upon provaLexerParser.g:7: k==1:EOF,IF,WHILE,UNLESS,UNTIL Exiting due to errors. Plase, I need help. Thank you for all! bye, puellula