[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: prologue alternatives
From: |
Paul Eggert |
Subject: |
Re: prologue alternatives |
Date: |
Sat, 16 Sep 2006 13:32:53 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
"Joel E. Denny" <address@hidden> writes:
> That isn't equivalent yet because yours doesn't place those "header
> definitions that depend on y.tab.h" in the Bison-generated code file.
It shouldn't be hard to come up with something that's equivalent,
without departing from the traditional "yacc -d" model. Let me try to
derive it from my understanding of yacc -d. It works by translating
this:
%{ A %}
%union { B }
%{ C %}
%%
D
%%
E
to this:
A
[copy of y.tab.h]
C
[translation of grammar D into a parser]
E
where y.tab.h is derived from all the input (including (D)) and
defines YYSTYPE and YYLTYPE if they're not defined already.
Given this model, users that don't know about %start-header can simply
prepend "#include <parser.h>" to (C), where parser.h looks like this:
#include "y.tab.h"
[other definitions]
Other source-code modules simply #include <parser.h>.
y.tab.h is idempotent; it doesn't hurt to include it if it (or a copy
of it) is already included, so other modules can simply include
parser.h.
This mechanism is fairly simple, and it doesn't require the
%start-header/%end-header business that I am having so much trouble
following.
- Re: prologue alternatives (was: Re: [GNU Bison 2.3] testsuite: 103 104 failed), Paul Eggert, 2006/09/13
- Re: prologue alternatives (was: Re: [GNU Bison 2.3] testsuite: 103 104 failed), Joel E. Denny, 2006/09/13
- Re: prologue alternatives, Paul Eggert, 2006/09/14
- Re: prologue alternatives, Joel E. Denny, 2006/09/14
- Re: prologue alternatives, Paul Eggert, 2006/09/15
- Re: prologue alternatives, Joel E. Denny, 2006/09/15
- Re: prologue alternatives, Paul Eggert, 2006/09/16
- Re: prologue alternatives, Joel E. Denny, 2006/09/16
- Re: prologue alternatives,
Paul Eggert <=
- Re: prologue alternatives, Joel E. Denny, 2006/09/16
- Re: prologue alternatives, Joel E. Denny, 2006/09/16
- Re: prologue alternatives, Paul Eggert, 2006/09/16
- Re: prologue alternatives, Joel E. Denny, 2006/09/16
- Re: prologue alternatives, Paul Eggert, 2006/09/17
- Re: prologue alternatives, Joel E. Denny, 2006/09/18
- Re: prologue alternatives, Paul Eggert, 2006/09/18
- Re: prologue alternatives, Joel E. Denny, 2006/09/18