help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 grammars, 1 lexer


From: Dan Haggarty
Subject: Re: 2 grammars, 1 lexer
Date: Wed, 11 Feb 2004 20:54:10 -0500

At 12:00 PM 2/11/04, wim delvaux wrote:
On Wednesday 11 February 2004 17:34, Urdaneta, Alfonso E (N-Summitt
Technologies) wrote:
> stupid question, but...
>
> Is it possible to have two grammars assocated with one lexer ?

Sure, use the reentrant lexer and pass it to both parsers. You might have a
problem with tokens though

Alternatively, use two start states with your lexer (one per grammer), two sets of disjoint token names, and an initial grammar rule that depends on the first token read. (See the O'Reilly "Lex & Yacc" book for details.)

Dan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]