can anybody tell me how this lexer-parser-combination would look if it is a reentrant parser?
I recall Paul Eggert said that the Bison generated parser, which he wrote, now is fully pure. If you have some data to be passed to the parser, that should be done via the arguments to yyparse, and there are some macros for doing that; see the Bison manual. If yyparse needs some local data, then there might not be support for doing that right now. Then you need to figure out how to make the Flex generated lexer to become pure; for that, check in the Help-Flex list <help-flex@gnu.org>.
---------------lexer.l------------------------------- %option yylineno %option case-insensitive
%{ #include "parser.tab.h" /* hier C-includes*/ %}
%% . { return LINE; } %%
int yywrap(){ return 1; /* 1: beendet lex */ }
---------------lexer.l-------------------------------
---------------parser.y------------------------------ %{ /* hier C-includes*/ %}
%token LINE
%%
PROGRAM : LINE { /* meine C-Anweisung */ }
%%
int yyerror (char const *s) { exit(1); return 0; }
---------------parser.y------------------------------
---------------main.c-------------------------------- extern int yyparse();
int main() { /* YYIN = file_descriptor_1; */ yyparse(); /* reset_parser - ?????????????? */
/* YYIN = file_descriptor_2; */ /* yyparse(); */ return 0; } ---------------main.c--------------------------------
--------------make.sh-------------------------------- #!/bin/bash bison -d parser.y flex lexer.l
gcc -c parser.tab.c gcc -c lex.yy.c gcc -c main.c
gcc -o main parser.tab.o lex.yy.o main.o --------------make.sh--------------------------------
_______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison