[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Enhancement request: enabling Variant in C parsers
From: |
Victor Khomenko |
Subject: |
RE: Enhancement request: enabling Variant in C parsers |
Date: |
Sun, 19 Aug 2018 12:24:21 +0000 |
Hi Akim,
> Bison’s variants are for C++, I don’t think porting this to C would be
> trivial.
> They are made to live in a C++ container, not a C array. Existing variants
> show
> a path though, granted.
If a c++ compiler is to be used, having a c++ container is ok. Generally, the c
vs c++ dichotomy is unhelpful; I'd rather view these as different interfaces.
E.g. one could choose independently function vs object and variant vs union.
Then, if the user uses a pure C compiler, some options are not available to
them.
> It seems to me that you are comparing
>
> yyparse();
>
> with
>
> yy::parser p;
> p.yyparse();
BTW, can I suggest to provide operator() in yy::parser so that it can be used
as a functor? This will shorten the above to yy::parser()(); also it would work
well with the standard template library, e.g. one could use std::for_each to
apply the parser to a list of file names, etc.
> I would strongly suggest that you look at the examples/ in Bison, the C++
> calculator
I did look at it - this example scared me off c++ parsers :-(
Maybe it would be less scary to start with something simpler, like the example
you attached.
Generally, the c++ section of the bison manual is rather sketchy, it would be
nice to add the detailed description of the generated parsing class, in
particular how to reset it to parse another file, how to reset it after an
error (or explicitly state that no reset is required).
All the best,
Victor.
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/17
- Message not available
- Message not available
- Message not available
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/18
- Message not available
- Message not available
- RE: Enhancement request: enabling Variant in C parsers, Victor Khomenko, 2018/08/18
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/18
- Message not available
- Message not available
- Message not available
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/19
- Message not available
- Message not available
- RE: Enhancement request: enabling Variant in C parsers,
Victor Khomenko <=
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/19
- Re: Enhancement request: enabling Variant in C parsers, Rici Lake, 2018/08/19
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/19
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/23
- Re: Enhancement request: enabling Variant in C parsers, Hans Åberg, 2018/08/21
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/23
- Re: Enhancement request: enabling Variant in C parsers, Hans Åberg, 2018/08/23
- Re: Enhancement request: enabling Variant in C parsers, Akim Demaille, 2018/08/23
- Re: Enhancement request: enabling Variant in C parsers, Hans Åberg, 2018/08/23
- Message not available
- Message not available
- Re: Enhancement request: enabling Variant in C parsers, Hans Åberg, 2018/08/23