[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Include %token and %union declaration from a shared file
From: |
Alexander Barkov |
Subject: |
Include %token and %union declaration from a shared file |
Date: |
Thu, 07 Jul 2016 16:47:35 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
Hello,
In our application we need to have two parsers using:
- the same yylex function (the tokenizer)
- the same set of terminal symbols (%token)
- the same YYSTYPE structure (%union)
but implementing very different syntax rules.
Currently we just have two files grammar1.yy and grammar2.yy
with 100% identical %token and %union directives,
but this is inconvenient to maintain.
Is there a way to move %union and all %token directives
from *.yy file into a shared file, and include it from
grammar1.yy and grammar2.yy ?
Thanks!
- Include %token and %union declaration from a shared file,
Alexander Barkov <=