Return type messed up in the generated parser in Antlr3.3 C target

10 views
Skip to first unread message

Yiqing Yang

unread,
Jun 22, 2015, 7:35:12 PM6/22/15
to antlr-di...@googlegroups.com
Hi All,

I am using Antlr3.3 C for a grammar which has returns from the semantic action. I found that the return type in the generated parser code is messed up.
See the following simple test grammar and the errors in the generated parser.  Actually, you will see this problem with any return type.

Has anyone seen this problem before? And I wonder if t's fixed in a later release since it's so obvious and easy to hit.

Thanks,

Yiqing

/*********************************  antlr_test.g *********************************************/
grammar antlr_test;
options 
{
  language=C;
}


statement
  returns [void*]
  : RETURN n=NAME { return n; }
  ;

RETURN : ('R'|'r')('E'|'e')('T'|'t')('U'|'u')('R'|'r')('N'|'n');
NAME : ( 'A'..'Z' | 'a'..'z' | '_' | '$') ( 'A'..'Z' | 'a'..'z' | '_' | '$' | '0'..'9' )*;


/*********************************  antlr_testParser.c *********************************************/

static * statement    (pantlr_testParser ctx);

static *
statement(pantlr_testParser ctx)
{   
    * void;
Reply all
Reply to author
Forward
0 new messages