[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: 2 grammars, 1 lexer
From: |
Xinan Tang |
Subject: |
RE: 2 grammars, 1 lexer |
Date: |
Wed, 11 Feb 2004 18:04:08 -0800 |
Hi
However one has to put two grammars into ONE file; otherwise BISON
will generate token numbers starting from 257 for both grammars.
--Xinan
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Dan
Haggarty
Sent: Wednesday, February 11, 2004 5:54 PM
To: address@hidden
Subject: Re: 2 grammars, 1 lexer
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
_______________________________________________
address@hidden http://mail.gnu.org/mailman/listinfo/help-bison
- 2 grammars, 1 lexer, Urdaneta, Alfonso E (N-Summitt Technologies), 2004/02/11
- RE: 2 grammars, 1 lexer,
Xinan Tang <=
- RE: 2 grammars, 1 lexer, Urdaneta, Alfonso E (N-Summitt Technologies), 2004/02/12