bug-bison
[Top][All Lists]
Advanced

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

I need simpler examples (was: RE: Enhancement request: enabling Variant


From: Askar Safin
Subject: I need simpler examples (was: RE: Enhancement request: enabling Variant in C parsers)
Date: Fri, 07 Dec 2018 01:07:24 +0300

Hi, Akim.

> I did look at it - this example scared me off c++ parsers :-(
I completely agree.
I will talk about Bison 3.2.2 manual.
If the user looks in manual and tries to find some C++ example, then he finds 
either too simple example ("10.1.1 A Simple C++ Example", which doesn't use 
Flex), either mammoth big example ("10.1.7 A Complete C++ Example"), which will 
definitely scary user away.
Moreover, Bison is normally used with Flex. And unfortunately, Bison manual 
gives only one Flex+Bison example, and this example is already mentioned big 
scary "10.1.7 A Complete C++ Example".

Okey, what to do? Well, we usually use Bison with Flex, so manual should 
contain:
1. At least one example which shows how to use Bison parser in C language with 
Flex. It should be as simple as possible. No location tracking, no everything. 
Bison should generate C code, and Flex too. It will be used as starting point 
for C users.
2. The same, but for C++. Bison will generate C++ code, and Flex too.

When I tried to understand Flex and Bison, I spent a lot of time trying to 
figure everything out.

I just described bare minimum. Now I will describe my dream.

Ideally there should be many examples, which are different in this aspects:
* Whether we use C or C++
* Whether we use Bison+Flex or just Bison
* What build system we use (plain Make, Cmake or Autotools)
* Other aspects, which require consistent changes to both Bison and Flex files 
and thus can be hard to get right for beginners. Possible candidates: whether 
we use location tracking, whether we use reentrant Bison parser etc

So far we got at least 2 * 2 * 3 * 2 * 2 = 48 examples and possibly more.

Ideally this should be public Web service, where a user configures his example 
using some checkboxes, radiobuttons etc and then presses "Generate". And the 
service generates the example for him. Personally I think that such service 
will be *very* useful for users. This would be very cool if it would be 
available when I tried to understand all this. I would run such Web service if 
I would have free time.

If anybody here agree, please say "Yes, I need such service!" in the answer. I 
hope that there will be a lot of us.

Also, this could be service which let you to create and edit your .y, .l and .c 
(or .cpp) files simultaneously online and immediately see results. I. e. 
something like https://jsfiddle.net/ , but with Bison + Flex + C/C++ instead of 
HTML + JS + CSS. Of course, this service should come with some already included 
examples. They should contain already mentioned 2 * 2 * 3 * 2 * 2 examples, as 
well as some more practical examples (toy C-like language, toy Pascal-like 
language, etc)

==
Askar Safin
http://vk.com/safinaskar

reply via email to

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