[DotGNU] treecc help required, generated code doesn't compile
From:
Pankaj Jangid
Subject:
[DotGNU] treecc help required, generated code doesn't compile
Date:
Wed, 21 Sep 2005 15:19:45 +0530
Hi,
I browsed through all the documentation available in the treecc
document and searched for a sample session with treecc but couldn't
find.
I am now learning about treecc.
After going through the complete document I just picked the code in the
appendix A and tried to build a sample parser. But the generated code
is not compiling.
The grammar file is expr.y
--------------------------
#include <stdio.h>
#include "expr.h"
%}
%union {
_expression_ *node;
int inum;
double fnum;
}
%token INT FLOAT
%type <node> expr
%type <inum> INT
%type <fnum> FLOAT
This produces a lot of error, A few lines of error are,
c_skel.c:50: error: syntax error before "fixed_state__"
c_skel.c:50: warning: data definition has no type or storage class
c_skel.c: In function `yynodeinit':
c_skel.c:99: error: `YYNODESTATE' undeclared (first use in this function)
c_skel.c:99: error: (Each undeclared identifier is reported only once
c_skel.c:99: error: for each function it appears in.)
c_skel.c:99: error: `state__' undeclared (first use in this function)
c_skel.c: In function `yynodealloc':
c_skel.c:118: error: `YYNODESTATE' undeclared (first use in this function)
c_skel.c:118: error: `state__' undeclared (first use in this function)
c_skel.c: In function `yynodepush':
c_skel.c:171: error: `YYNODESTATE' undeclared (first use in this function)
c_skel.c:171: error: `state__' undeclared (first use in this function)
c_skel.c: In function `yynodepop':
c_skel.c:214: error: `YYNODESTATE' undeclared (first use in this function)
c_skel.c:214: error: `state__' undeclared (first use in this function)
c_skel.c: In function `yynodeclear':
c_skel.c:253: error: `YYNODESTATE' undeclared (first use in this function)
c_skel.c:253: error: `state__' undeclared (first use in this function)
expr.c: At top level:
expr.c:270: error: variable `expression_vt__' has initializer but incomplete type
expr.c:271: warning: excess elements in struct initializer
expr.c:271: warning: (near initialization for `expression_vt__')
expr.c:272: error: `expression_kind' undeclared here (not in a function)
expr.c:272: warning: excess elements in struct initializer
expr.c:272: warning: (near initialization for `expression_vt__')
expr.c:273: warning: excess elements in struct initializer
Please help it indicates that I am missing some file. What other things do I need to compile this.