[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem building a reentrant parser
From: |
Bob Rossi |
Subject: |
Re: Problem building a reentrant parser |
Date: |
Wed, 15 Feb 2006 19:44:37 -0500 |
User-agent: |
Mutt/1.5.9i |
> I'm having a problem building a reentrant parser. Here's the simple
> test I'm doing, as suggested by the flex documentation. This is using
> flex 2.5.31 and bison 2.1 on x86_64 using g++ 4.0.2 on Fedora Core.
> Please send any suggestions or help.
>
> +++ begin file slex.l +++
> /* Scanner for "C" assignment statements... sort of. */
> %{
> #include "sparse.tab.h" /* Generated by bison. */
> %}
> %option bison-bridge bison-locations
>
> %%
>
> [[:digit:]]+ { yylval->num = atoi(yytext); return NUMBER;}
> [[:alnum:]]+ { yylval->str = strdup(yytext); return STRING;}
> "="|";" { return yytext[0];}
> . {}
>
> %%
>
> +++ end of slex.l, begin sparse.y +++
> /* Parser to convert "C" assignments to lisp. */
> %{
> /* Pass the argument to yyparse through to yylex. */
> #define YYPARSE_PARAM scanner
> #define YYLEX_PARAM scanner
> #include <stdio.h>
> %}
> %locations
> %pure_parser
You want %pure-parser.
Bob Rossi