[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
reentrant parser - how?
From: |
Carsten Krueger |
Subject: |
reentrant parser - how? |
Date: |
Wed, 04 May 2005 23:26:16 +0200 |
Hello,
can anybody tell me how this lexer-parser-combination would look if it
is a reentrant parser?
---------------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--------------------------------