[antlr-interest] [bug?] AST rewrite rule with no (imaginary) token yields C runtime compile error
David Benn
david.benn at astc-design.com
Fri May 30 01:07:29 PDT 2008
I have this production:
predefined_type_def
: primitive_type -> ^(PREDEF_TYPE primitive_type)
| IDENT IDENT -> ^(PREDEF_TYPE IDENT IDENT)
;
that works fine. An earlier version looked like this:
predefined_type_def
: primitive_type -> ^(primitive_type)
| IDENT IDENT -> ^(IDENT IDENT)
;
i.e. it had no imaginary root node in the AST rewrite rule.
When compiling the resulting Parser for grammar X for the C runtime, I get:
- g++ -g -I/work/astc-internal/antlr3/include -c XLexer.c XParser.c
XParser.c: In function `XParser_struct_field_def_return
struct_field_def(XParser_Ctx_struct*)':
XParser.c:2112: error: `stream_XParser' was not declared in this scope
Assuming the rewrite rule is legal (but perhaps not desirable), I guess
this is a bug in the C runtime code generation step.
Rgds,
DJB
--
David Benn
Australian Semiconductor Technology Company (ASTC) Pty Ltd
76 Waymouth Street
Adelaide 5000, South Australia
ABN: 18 117 392 784
Tel: +61 8 8231 2782
Mob: +61 407 261163
Email: david.benn at astc-design.com
Web: www.astc-design.com
More information about the antlr-interest
mailing list