On Fri, 27 Feb 2004, MailUser1 wrote:

> Hi everybody,
>
> I'm trying to code a simple compiler for a simple language I'm
> designing, I've debugged anything I could from g++ "useful"compile
> errors, but now after I have screened out all those errors, i get this
> strange ouput from g++:

please repeat the following 3 times before going to bed: "it's not
strange - it's a bug.". then take a deep breath, and then start debugging
it like you debug any C program.

>  g++ -o simplang main.cc y.tab.c lang_funcs.cpp
> /usr/ccs/bin/yaccpar: In function `int yyparse()':
> /usr/ccs/bin/yaccpar:274: parse error before `(' token
> /usr/ccs/bin/yaccpar:316: parse error before `(' token

first, i see that you're using.... solaris? hmmm.... ;)

second, did you look inside the y.tab.c source file at the given line
numbers, and looked for the bug?

remember that yacc takes C source you write in the grammar file, and
embeds it inside a C source file which it generates. only then it runs the
compiler on the source, and thus only at this stage it will complain about
syntax errors in this embedded C code. your code hasn't suddenly vanished
- it has been copied verbatim into the C source that yacc generates.

> does anyone know where the hack those error come out from!? I've
> scanned my grammer file etc, and everything seems ok,

by the w, what does this 'etc' above mean? what did you do other then
scanning the grammer file?

by the way, your compilation command seems to be missing the necessary
libraries that yacc provides...

-- 
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy

--------------------------------------------------------------------------
Haifa Linux Club Mailing List (http://www.haifux.org)
To unsub send an empty message to [EMAIL PROTECTED]


Reply via email to