[antlr-interest] Problem when using scopes in C with ANTLR 3.4
Iron Bug
death.iron.bug at gmail.com
Wed Feb 1 08:13:09 PST 2012
Greetings, everybody!
I have found a problem with C code generation in ANTLR 3.4 (I used pure
3.4 from standard downloads).
A simple grammar (just to show the problem):
//////////////////////////////////////////////////////////////////////
grammar test;
options
{
language = C;
}
scope GlobalScope
{
int scope;
}
@header
{
#include "antlr3.h"
}
command
scope GlobalScope;
@init
{
$GlobalScope::scope = 10;
}
:
VALUE
;
VALUE
: ('0'..'9')+
;
/////////////////////////////////////////////////////////////////
The grammar produces code with error in generated file testParser.c,
line 321:
SCOPE_TOP(GlobalScope) =
(ptestParser_GlobalScope_SCOPE)(ctx->ptestParser_GlobalScopeStack->get(ctx->, ctx->ptestParser_GlobalScopeStack_limit - 1));
(the ctx with reference to nowhere in the first parameter of get()).
It goes all right in 3.3, though. Have I missed some changes in 3.4 or
is this a bug?
Sincerely, Yana A. Kireyonok
More information about the antlr-interest
mailing list