Comments (5)
Thanks for sharing, that's pretty cool!
Is there an action point you are suggesting for us here? Is there an advantage for us to replace the right recursion with left recursion as you have done? I'm a bit out of my depth with yacc/bison stuff.
from panda3d.
For LALR
parser left recursion is preferable for less stack usage see here https://www.gnu.org/software/bison/manual/bison.html#Recursion and for my playground that automatically produce a parse tree left recursion produces shallow trees (easier to visualize without vertical scroll), but In some places when I've tried to replace then a lot of conflicts appeared so I only did in the ones that didn't generated conflicts for now.
After all of the latest fixes and continuing trying to parse sqlite3.c
I found one syntax omission:
cppparser-nb -v -D__PANDA_CC__ -D__builtin_va_list=void* -Dwchar_t=pccwchar_t -S/usr/include -S/usr/lib/gcc/x86_64-linux-gnu/9/include sqlite3.c
Predefining __PANDA_CC__ as
Predefining __builtin_va_list as void*
Predefining wchar_t as pccwchar_t
Reading sqlite3.c
...
sqlite3.c:35320:24: error: syntax error, unexpected KW_VOLATILE
static void dekkerMul2(volatile double *x, double y, double yy){
^~~~~~~~
Error in parsing.
And experimenting in the playground (https://mingodad.github.io/parsertl-playground/playground/) I came with this possible fix:
--- <unnamed>
+++ <unnamed>
@@ -294,10 +294,14 @@
optional_attributes :
%empty
- | optional_attributes ATTR_LEFT attribute_specifiers ATTR_RIGHT
- | optional_attributes ATTR_LEFT KW_USING name ':' /*4R*/ attribute_specifiers ATTR_RIGHT
- | optional_attributes KW_ALIGNAS '(' /*20L*/ const_expr ')'
- | optional_attributes KW_ALIGNAS '(' /*20L*/ type_decl ')'
+ | attributes
+ ;
+
+attributes :
+ attributes ATTR_LEFT attribute_specifiers ATTR_RIGHT
+ | attributes ATTR_LEFT KW_USING name ':' /*4R*/ attribute_specifiers ATTR_RIGHT
+ | attributes KW_ALIGNAS '(' /*20L*/ const_expr ')'
+ | attributes KW_ALIGNAS '(' /*20L*/ type_decl ')'
;
attribute_specifiers :
@@ -553,13 +557,20 @@
;
function_parameter :
- optional_attributes type formal_parameter_identifier maybe_initialize
- | optional_attributes KW_CONST type formal_parameter_identifier maybe_initialize
- | optional_attributes KW_CONST KW_REGISTER type formal_parameter_identifier maybe_initialize
- | optional_attributes type_pack parameter_pack_identifier maybe_initialize
- | optional_attributes KW_CONST type_pack parameter_pack_identifier maybe_initialize
- | optional_attributes KW_CONST KW_REGISTER type_pack parameter_pack_identifier maybe_initialize
- | optional_attributes KW_REGISTER function_parameter
+ optional_attributes type_qualifier_list type formal_parameter_identifier maybe_initialize
+ | optional_attributes type_qualifier_list type_pack parameter_pack_identifier maybe_initialize
+ | function_parameter attributes
+ ;
+
+type_qualifier_list :
+ %empty
+ | type_qualifier_list type_qualifier
+ ;
+
+type_qualifier :
+ KW_CONST
+ | KW_REGISTER
+ | KW_VOLATILE
;
formal_parameter :
The above fix works on the playground and now when I looked at cppBison.yy
to try it there I found that it's not using named
references (it's using $0-9
) and I'll try to convert it to named references first and probably propose it here.
from panda3d.
Here is the first working conversion from numeric references to named references using a script and manually fixing it.
Any feedback is welcome !
from panda3d.
I appreciate the effort.
That said, it doesn't seem that this works with the bison 2.3 that ships with XCode. Are named references a more recent feature?
I am a bit reluctant to drop support for bison 2.3. I suppose we could require macOS users to install from homebrew, or have them use the pre-built file, but there have to be some compelling benefits.
from panda3d.
Yes that's a known problem, named references need a newer bison 2.5 (2011-05-14).
from panda3d.
Related Issues (20)
- PGEntry getCursorY fails on word-wrapped or multiline text HOT 2
- 2 small Preprocessor bugs HOT 11
- Reimplement core functionality of DIRECT in C++ codebase HOT 1
- Cppparser preprocessor do not expand macros with arguments correctly HOT 94
- bam_model_extensions changes external path references in distributions
- FSM object has no attribute 'notifier' in requestNext/requestPrev
- Importing Pyrender with Panda3D results in the code not processing HOT 1
- Triangulator running out of memory HOT 1
- Interrogate limitations
- PandAI website link in the manual is broken, navmesh converter source "BlenderMeshGen.py" is lost. HOT 1
- DirectEntry with both backgroundFocus=1 and overflow=1 leave hanging events after being destroyed, causing a segmentation fault HOT 2
- Generated interrogate wrapper is not deterministic on macOS HOT 1
- PNMImage.flip() documentation doesn't match method, can't transpose with x/y mirror HOT 2
- Type Definition for functions and methods HOT 2
- Actor Animation Problem HOT 2
- Bam cache should remember loader used
- PStats: Scrubbing Through Flame-Charts
- Implement Khronos' reference PBR tone mapping operator HOT 3
- `Python 3.12.3`: No found distribution for panda3d HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panda3d.