bison-patches
[Top][All Lists]
Advanced

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

Re: Locations in bison itself are wrong


From: Akim Demaille
Subject: Re: Locations in bison itself are wrong
Date: Mon, 31 Mar 2003 11:38:07 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

 Paul> Akim Demaille <address@hidden> writes:
 >> Instead of a macro to set the fields of the initial location, I was
 >> thinking of having a reference value, as in the piece of patch above.
 >> But contrary to yyloc_default in GLR, the user would be able to
 >> override the value, including using the name of a variable which
 >> contents are set at runtime.

 Paul> Sorry, I don't quite follow.  lalr1.cc has the leftmost location be an
 Paul> argument to the constructor for the parser class.  But yacc.c doesn't
 Paul> have the notion of parsers that are constructed, so we have to do it
 Paul> differently in C somehow.  (Perhaps we should define a more
 Paul> object-oriented API for C parsers, but that's a separate and bigger
 Paul> subject.)

Right.

 Paul> So, how would you have the user override the default value in yacc.c?
 Paul> Would this be another %-directive?  If so, how would such a directive
 Paul> affect other languages, and parsers other than yacc.c?

That is to be defined on a per output basis.  The yyparse invocation
could include such a default location, but for sake of backward
compatibility, we can't do that for yacc.c, so I'm suggesting
%initial-location to circumvent this problem.

 Paul> Surely whatever method is used to override the default, would have to
 Paul> be done consistently with how the user defines the YYLLOC_DEFAULT and
 Paul> YYLTYPE macros.  Were you thinking of deprecating those macros too?

Whatever can improve consistency is a good thing.  Whatever protects
us from CPP is a good thing too imho.




reply via email to

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