LEX question

LEX question

Post by Vlad Grigore Dabi » Thu, 11 Feb 1993 02:13:14



Hi,

I'm trying to embedd a system which uses lex and yacc, into my application
which uses lex and yacc too.
When I attempt to link my code with the system's code (libraries) I get
multiply defined yywrap, which is defined in the system's code and in my code
too.
yywrap  is a lex library routine that needs to be redefined, and which is
called whenever lex reaches an end-of-file.

Is there anything I can do in my code or ask the system's support to do in
their code (they are very willing to help, but they don't know what to do
either) ?
Is there a way to mask some public symbols generated by lex ?

Thanks for any help.

 
 
 

LEX question

Post by euphausia super » Sat, 13 Feb 1993 07:12:51



| Hi,
|
| I'm trying to embedd a system which uses lex and yacc, into my application
| which uses lex and yacc too.
| When I attempt to link my code with the system's code (libraries) I get
| multiply defined yywrap, which is defined in the system's code and in my code
| too.
| yywrap  is a lex library routine that needs to be redefined, and which is
| called whenever lex reaches an end-of-file.
|
| Is there anything I can do in my code or ask the system's support to do in
| their code (they are very willing to help, but they don't know what to do
| either) ?
| Is there a way to mask some public symbols generated by lex ?
|
| Thanks for any help.

After running lex and yacc, use the following sed scripts
to rename the symbols in the files that lex & yacc
generate, like this:

  sed -f yyrename.sed y.tab.c > special.tab.c
  sed -f yyrename.sed y.tab.h > special.tab.h
  sed -f llrename.sed lex.yy.c > lex.special.h
  rm y.tab.h y.tab.c lex.yy.c

Substitute some unique word for "special" and you can have several
parsers in the same program.

     the krill

---begin yyrename.sed---
s/yyact/special_yy_act/g
s/yychar/special_yy_char/g
s/yychk/special_yy_chk/g
s/yydebug/special_yy_debug/g
s/yydef/special_yy_def/g
s/yyerrflag/special_yy_errflag/g
s/yyerror/special_yy_error/g
s/yyexca/special_yy_exca/g
s/yylex/special_yy_lex/g
s/yylval/special_yy_lval/g
s/yynerrs/special_yy_nerrs/g
s/yypact/special_yy_pact/g
s/yyparse/special_yy_parse/g
s/yypgo/special_yy_pgo/g
s/yyps/special_yy_ps/g
s/yypv/special_yy_pv/g
s/yyr1/special_yy_r1/g
s/yyr2/special_yy_r2/g
s/yyreds/special_yy_reds/g
s/yys/special_yy_s/g
s/yystate/special_yy_state/g
s/yytmp/special_yy_tmp/g
s/yytoks/special_yy_toks/g
s/yyv/special_yy_v/g
s/yyval/special_yy_val/g
---end yyrename.sed---

---begin llrename.sed---
s/yyback/special_yy_back/g
s/yybgin/special_yy_bgin/g
s/yycrank/special_yy_crank/g
s/yyerror/special_yy_error/g
s/yyestate/special_yy_estate/g
s/yyextra/special_yy_extra/g
s/yyfnd/special_yy_fnd/g
s/yyin/special_yy_in/g
s/yyinput/special_yy_input/g
s/yyleng/special_yy_leng/g
s/yylex/special_yy_lex/g
s/yylineno/special_yy_lineno/g
s/yylook/special_yy_look/g
s/yylsp/special_yy_lsp/g
s/yylstate/special_yy_lstate/g
s/yylval/special_yy_lval/g
s/yymatch/special_yy_match/g
s/yymorfg/special_yy_morfg/g
s/yyolsp/special_yy_olsp/g
s/yyout/special_yy_out/g
s/yyoutput/special_yy_output/g
s/yyprevious/special_yy_previous/g
s/yysbuf/special_yy_sbuf/g
s/yysptr/special_yy_sptr/g
s/yysvec/special_yy_svec/g
s/yytchar/special_yy_tchar/g
s/yytext/special_yy_text/g
s/yytop/special_yy_top/g
s/yyunput/special_yy_unput/g
s/yyvstop/special_yy_vstop/g
s/yywrap/special_yy_wrap/g
---end llrename.sed---

 
 
 

1. lex question

Hello....

I want to create a lex analyzer function. The lex library contains a main entry
point. I've already got a main entry point. (Geez, forgive me, but this is
beginning to sound more like sex than lex!!). So...how do I disable/override
the main in the library so that I won't have multiply-defined mains?

I'm on SPARCstation 2 walking SUN OS 4.1.1.

Please reply by email.

Thanks in advance,

Josh
--

"A minute passes unnoticed for those who are content, but for the needy,
it is part of a string of endless lifetimes..." - "The Bellero Shield"

2. Unix commands through C

3. lex question: how to set search specification at run-time

4. Kernel upgrading problems, please help...

5. newbie lex question: parsing Postscript

6. Help with S3 ViRGE/XFree setup!

7. awk,sed, or lex question

8. Zip zoom card HELP!

9. Followup YACC & LEX Question

10. YACC and LEX question

11. LEX question -- can yytext be overwritten safely?

12. Yacc & Lex Question

13. YACC and LEX question