bodirsky
asked on
-ly Yacc library for Linux
I've installed a new version of Suse Linux, but I cant find the -ly library which is nessesary for the gcc compiler to compile the yacc-generated yyparse and my parser.
My Question:
-Is the library on the distribution, but on another directory?
-Is the -ly library in the Internet?
My Question:
-Is the library on the distribution, but on another directory?
-Is the -ly library in the Internet?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What do you mean with:
"gcc doesn't like my parser-routine"
Do you get compiler or linker errors?
lex lexfile --> flex lexfile
yacc yaccfile --> bison yaccfile
gcc parser.c -ly --> gcc parser.c
"gcc doesn't like my parser-routine"
Do you get compiler or linker errors?
lex lexfile --> flex lexfile
yacc yaccfile --> bison yaccfile
gcc parser.c -ly --> gcc parser.c
ASKER
In file included from bisoncomp.c:53:
lex.yy.c:267: conflicting types for `yytext'
ottersyntax.y:1: previous declaration of `yytext'
ottersyntax.l: In function `yylex':
In file included from bisoncomp.c:53:
ottersyntax.l:16: stray '\' in program
ottersyntax.l:16: parse error before `|'
ottersyntax.l:16: parse error before `['
ottersyntax.l:17: `i' undeclared (first use this function)
ottersyntax.l:17: (Each undeclared identifier is reported only once
ottersyntax.l:17: for each function it appears in.)
ottersyntax.l:19: break statement not within loop or switch
ottersyntax.l:20: case label not within a switch statement
ottersyntax.l: At top level:
ottersyntax.l:21: parse error before string constant
ottersyntax.l:21: stray '\' in program
lex.yy.c:752: warning: initialization makes pointer from integer without a cast
lex.yy.c:752: initializer element is not constant
lex.yy.c:752: warning: data definition has no type or storage class
lex.yy.c:755: parse error before `if'
lex.yy.c:782: conflicting types for `yy_c_buf_p'
lex.yy.c:219: previous declaration of
And so on without an end.
lex.yy.c:267: conflicting types for `yytext'
ottersyntax.y:1: previous declaration of `yytext'
ottersyntax.l: In function `yylex':
In file included from bisoncomp.c:53:
ottersyntax.l:16: stray '\' in program
ottersyntax.l:16: parse error before `|'
ottersyntax.l:16: parse error before `['
ottersyntax.l:17: `i' undeclared (first use this function)
ottersyntax.l:17: (Each undeclared identifier is reported only once
ottersyntax.l:17: for each function it appears in.)
ottersyntax.l:19: break statement not within loop or switch
ottersyntax.l:20: case label not within a switch statement
ottersyntax.l: At top level:
ottersyntax.l:21: parse error before string constant
ottersyntax.l:21: stray '\' in program
lex.yy.c:752: warning: initialization makes pointer from integer without a cast
lex.yy.c:752: initializer element is not constant
lex.yy.c:752: warning: data definition has no type or storage class
lex.yy.c:755: parse error before `if'
lex.yy.c:782: conflicting types for `yy_c_buf_p'
lex.yy.c:219: previous declaration of
And so on without an end.
> lex.yy.c:267: conflicting types for `yytext'
> ottersyntax.y:1: previous declaration of `yytext'
I assume you have
#include "lex.yy.c"
in ottersyntax.y , right?
If you combine flex and bison files, you need to have a common header file which defines yytext, for example.
I.g. this will be extracted from your tokens and defines in the .y file with
bison -d
please refer to man bison.
I'm not shure about
> ottersyntax.l:16: stray '\' in program
sounds, that there is a \ which should be quoted.
PLease remove these 2, then compile again.
Flex/bison are much more flexible than lex/yacc. Most names, defines etc. are configurable (of cause most have usefull defaults, but unfortunately these defaults may be the source of you problem).
IMHO, you need to read man-pages (flex and bison). It's hard staff, but once you get used to it, you'll never use lex/yacc again :-)).
Feel free for more questions.
> ottersyntax.y:1: previous declaration of `yytext'
I assume you have
#include "lex.yy.c"
in ottersyntax.y , right?
If you combine flex and bison files, you need to have a common header file which defines yytext, for example.
I.g. this will be extracted from your tokens and defines in the .y file with
bison -d
please refer to man bison.
I'm not shure about
> ottersyntax.l:16: stray '\' in program
sounds, that there is a \ which should be quoted.
PLease remove these 2, then compile again.
Flex/bison are much more flexible than lex/yacc. Most names, defines etc. are configurable (of cause most have usefull defaults, but unfortunately these defaults may be the source of you problem).
IMHO, you need to read man-pages (flex and bison). It's hard staff, but once you get used to it, you'll never use lex/yacc again :-)).
Feel free for more questions.
ASKER
what is the equivalent for
lex lexfile
yacc yaccfile
gcc parser.c -ly
?