bison-patches
[Top][All Lists]
Advanced

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

Lookahead correction for the C++ skeleton lalr1.cc


From: Adrian Vogelsgesang
Subject: Lookahead correction for the C++ skeleton lalr1.cc
Date: Tue, 9 Jul 2019 12:12:22 +0000
User-agent: Microsoft-MacOutlook/10.10.b.190609

Dear bison community,

Attached to this email you can find two small patches which I would like to
contribute to bison.

cxx-table-indentation.patch is really minor: it fixes the indentation of the 
generated
tables `yypact_` and friends in the headers for the lalr1.cc skeleton.

cxx-lac.patch is more interesting:
This patch adds support for Lookahead Correction to the lalr1.cc C++ skeleton.
It contains pretty much a direct port of LAC from the yacc.c C skeleton.

The largest difference from the C skeleton's LAC is probably memory management:
In C++, I simply reused the existing `stack` class while the C equivalent does
memory management through `yy_lac_stack_realloc` etc.
Also, the C++ port uses functions instead of macros for `yy_lac_establish_`,
`yy_lac_discard_`.

All existing bison tests are passing and I am quite sure that the patch works 
as expected
because integrating a C++ parser with those patches into Hyper (a SQL database;
https://www.tableau.com/products/new-features/hyper; https://hyper-db.de) went 
smoothly
and our internal test suite for Hyper is still passing. (Only test failures: 
the list of expected
tokens is now correct and our test cases were expecting the incorrect list in 
some places)

The patch does not yet add any new test cases to bison’s test suite since I 
wasn’t
sure how to do so. `tests/regression.at` and `tests/conflicts.at` contain tests 
for
the existing LAC support in the C parser. However, I did not just want to copy 
& paste
those test cases for C++ and instead would prefer to factor out common test
setup/expectations.
Unfortunately, I never used autotest or m4 before, so I don’t know how to do 
this.
Any help here would be appreciated :)

Cheers,
Adrian



Attachment: cxx-lac.patch
Description: cxx-lac.patch

Attachment: cxx-table-indentation.patch
Description: cxx-table-indentation.patch


reply via email to

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