Re: Porting to typed C++ parser (was: Dynamic token kinds)

2018-12-17 Thread Hans Åberg
> On 17 Dec 2018, at 19:09, Frank Heckenbach wrote: [Note: you don't cc me, only others, for some reason.] >>> On 17 Dec 2018, at 18:37, Frank Heckenbach wrote: >>> >>> Do you actually use Bison's variant? Otherwise, what you do is >>> irrelevant here (sorry), as this is a proposal specifica

Re: Porting to typed C++ parser (was: Dynamic token kinds)

2018-12-17 Thread Frank Heckenbach
Hans Åberg wrote: > > On 17 Dec 2018, at 18:37, Frank Heckenbach wrote: > > > > Do you actually use Bison's variant? Otherwise, what you do is > > irrelevant here (sorry), as this is a proposal specifically about > > Bison's variant. > > As I said, I do not use it now, but I wanted to know whet

Re: Dynamic token kinds

2018-12-17 Thread Hans Åberg
> On 17 Dec 2018, at 18:37, Frank Heckenbach wrote: > > Do you actually use Bison's variant? Otherwise, what you do is > irrelevant here (sorry), as this is a proposal specifically about > Bison's variant. As I said, I do not use it now, but I wanted to know whether I could use it before actu

Re: Dynamic token kinds

2018-12-17 Thread Frank Heckenbach
Hans Åberg wrote: > > What I suggest to add (without changing the above), is: > > > > symbol_type make_symbol (token_type type); > > // checks at runtime that type is V_FOO or V_BAR > > > > symbol_type make_symbol (token_type type, int &&); > > // checks at runtime that type is I_BAZ or I_QU

Re: Dynamic token kinds

2018-12-17 Thread Hans Åberg
> On 17 Dec 2018, at 11:17, Frank Heckenbach wrote: > > Hans Åberg wrote: > >>> On 17 Dec 2018, at 10:48, Frank Heckenbach wrote: >> >> Might Bison generate a function with a switch statement, generate the right >> return for the lexer to use? > > Different semantic types need separate fun

Re: Dynamic token kinds

2018-12-17 Thread Frank Heckenbach
Hans Åberg wrote: > > On 17 Dec 2018, at 10:48, Frank Heckenbach wrote: > > > > I think we agree here, and that was actually my concern when I > > started this thread. I don't want to have to write a separate case > > for each token kind in my lexer. Of course, we need a separate case > > for ea

Re: Dynamic token kinds

2018-12-17 Thread Hans Åberg
> On 17 Dec 2018, at 10:48, Frank Heckenbach wrote: > > Hans Åberg wrote: > >>> On 16 Dec 2018, at 15:48, Frank Heckenbach wrote: >>> >>> Hans Åberg wrote: >>> The idea would be that rather than returning the token value, something that does not need translation. I don't know if t

Re: Dynamic token kinds

2018-12-17 Thread Frank Heckenbach
Hans Åberg wrote: > > On 16 Dec 2018, at 15:48, Frank Heckenbach wrote: > > > > Hans Åberg wrote: > > > >> 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, though. > > > > Not su