[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with yylval
From: |
Martin Bock |
Subject: |
Problem with yylval |
Date: |
Mon, 30 Jul 2007 12:24:28 +0100 |
Hi everybody,
I have a problem with my parser. I spent some hours trying to fix it,
but I still don't understand what happens:
My parser is uses lex to read strings and bison to work on them.
The bison-file parser.y is like that:
#define YYSTYPE char *
The lex file is supposed to read strings and write them to yylval.
First, I include the header, which I think should tell the scanner that
yylval is a char-pointer
#include "parser.h"
Then I try to use it:
yylval = strdup(yytext)
The compiler (gcc) states that yylval is an integer:
Warning: assignment makes integer from pointer without a cast
My next thougth was that yylval is integer by default, and I added
(which I found in a tutorial):
Extern char *yylval
Now, the compiler answers:
Conflicting types for 'yylval'
Previous declaration of 'yylval'
Maybe somebody knows (or sees) what happens,
Kind regards,
Martin Bock
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Problem with yylval,
Martin Bock <=