[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sharing grammar rules across grammars?
From: |
Jeremy Elson |
Subject: |
sharing grammar rules across grammars? |
Date: |
Tue, 17 Feb 2004 13:10:47 -0800 |
Hi,
I have two languages that have several features in common. Is there
an easy way to share rules across grammars? (Both grammars use the
same lexer; the token values are the same.)
Right now, I'm just doing cut-and-paste of the rules, which of course
is not a very good solution. Is there a way to do an "#include" from
within the rules section of a bison input, so that I can put the
common rules into a separate file that is included by both .y files?
By the way, I'm also using the evil cut-and-paste method to make sure
that both of my grammars have the same "%token" declarations, in the
same order, so that both grammars use the same token values and
therefore can share a lexer. Is there a better way to keep the token
values in sync across grammars? In reading the past year of mailing
list archives, I've seen similar questions, but never a definitive
answer.
Thanks!
-Jeremy
- sharing grammar rules across grammars?,
Jeremy Elson <=