[Top][All Lists]

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

Re: Dynamic token kinds

From: Hans Åberg
Subject: Re: Dynamic token kinds
Date: Sun, 16 Dec 2018 14:36:50 +0100

> On 16 Dec 2018, at 11:13, Frank Heckenbach <address@hidden> wrote:
> Hans Åberg wrote:
>> Perhaps an entirely static approach can be achieved by the type
>> being a part of the token_type. On the other hand, the use is for
>> dynamic token lookup, so it may be too much of an effort for that.
> Not sure what you mean with "part of", but with Bison's variant the
> semantic type is determined by token_type, if that's what you mean.

The idea would be that rather than returning the token value, something that 
does not need translation. I don't know if that helps up the static approach, 

>> Personally, I am already at C++17, so I have no reason for using a
>> simpler variant. Having the type stored just adds a size_t, and
>> that is used a lot in other circumstances, so no overhead to worry
>> about.
> Well, we had this discussion recently (as far as Bison is
> concerned).

Indeed, but that was where it seemed not requiring the type being stored in the 
variant. This situation might be different in that respect.

Here, not making sure the type is properly returned may bomb the program, so 
preventing that seems higher than a rather small overhead.

reply via email to

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