Hi!
Can you help me? I have to write a Ruby Editor + Parser with Java
Language.
I use ANTLR Parser Generator.
The grammar (a little part of Ruby grammar) I use is my hands made. I
had use ANTLR and I had write a main in Java Project. Now the problem
is: if I write a correct ruby code or not correct ruby code the result
is the same. Therefore I had think the problem is on the grammar.
Please, can you validate my Grammar. For me it's correct, but I think
the problem is this for my project.
This is the file.g how I had write my Grammar for ANTLR.

class P extends Parser;
options {
	k = 2;                        // pone a 2 il lookahead di token
	exportVocab=Ruby;             // chiama il suo vocabolario "Ruby"
	defaultErrorHandler = false;  // non genera gestori di errori di
parser
	buildAST=true;    // il parser costruisce un AST (Abstract Syntax
Tree)
}

// l'intera classe
program : (CLASS IDENTIFIER body_class)*;

// il corpo della classe
body_class : (DEF (IDENTIFIER)* body)*;

// il corpo
body : (statement)+;

// istruzioni che si possono trovare nel corpo del programma
statement : (IF | WHILE) condition
	  | LOOP_DO
	  | YIELD LPAREN IDENTIFIER RPAREN
	  | RETURN ret
	  | END
	  | IDENTIFIER ASSIGN (LPAREN)+ (IDENTIFIER | NUMBER | STRING)
(RPAREN)+
	  | IDENTIFIER ASSIGN (LPAREN)+ IDENTIFIER (RPAREN)+
	  | IDENTIFIER ASSIGN (LPAREN)+ instruction (RPAREN)+;

// condizioni dei costrutti
condition : (LPAREN)+ IDENTIFIER booleano IDENTIFIER (RPAREN)+
          | (LPAREN)+ IDENTIFIER booleano NUMBER (RPAREN)+
          | (LPAREN)+ NUMBER booleano IDENTIFIER (RPAREN)+
          | (LPAREN)+ NUMBER booleano NUMBER (RPAREN)+
	  | (LPAREN)+ instruction (RPAREN)+
	  | IDENTIFIER booleano (LPAREN)+ instruction (RPAREN)+;

instruction : NUMBER operator NUMBER
	    | IDENTIFIER operator NUMBER
	    | NUMBER operator IDENTIFIER;

// operatori che si possono trovare nelle condizioni
booleano : LT
         | LE
         | GE
	 | GT
	 | EGUAL
	 | MOD
	 | AND
	 | OR
	 | LPAREN
	 | RPAREN
	 | DIV;

// ciche puessere scritto dopo il "return"
ret : (LPAREN)+ IDENTIFIER (RPAREN)+
    | (LPAREN)+ NUMBER (RPAREN)+
    | (LPAREN)+ TRUE (RPAREN)+
    | (LPAREN)+ FALSE (RPAREN)+;

operator : DIV
         | MUL
	 | PLUS
	 | SUB
	 | MOD;


//------------------------------------------------------------------------------
// LEXER
//------------------------------------------------------------------------------
class RubyLexer extends Lexer;

options {
  charVocabulary = '\0'..'\377';
  exportVocab=Ruby;   // chiama il suo vocabolario "Ruby"
  testLiterals = false;   // don't automatically test for literals
  k = 4;                  // four characters of lookahead
  caseSensitive = true;
  caseSensitiveLiterals = false;
  filter = true;
}

tokens {
  CLASS = "class";
  DEF = "def";
  IF = "if";
  RETURN = "return";
  END = "end";
  LOOP_DO = "loop do";
  YIELD = "yield";
  DO = "do";
  FALSE = "false";
  TRUE = "true";
}

// Operatori
LT        : '<';
LE        : "<=";
GE        : ">=";
GT        : '>';
EGUAL     : "==";
DIV       : '/';
MUL       : '*';
ASSIGN    : '=';
LPAREN    : '(';
RPAREN    : ')';
PLUS      : '+';
POINT     : '.';
AT        : '@';
OR        : '|';  // questo simbolo non ha solo la funzionalitdell'OR!
AND       : '&';
SUB       : '-';
MOD       : '%';

NUMBER : ('0'..'9')+;

// Identificatori
IDENTIFIER : ('a'..'z'|'A'..'Z')+ (NUMBER)?;

// Stringhe
STRING		: '"' (('a'..'z'|'A'..'Z')+)* '"'
		| '\'' (('a'..'z'|'A'..'Z')+)* '\'';

// regola per il ritorno a capo
NEWLINE : ( "\r\n" // DOS
        | '\r' // MAC
        | '\n' // Unix
        );




If you can help me for me it's very important.
Thank you very much!
bye,
puellula