nix-make | Experimental Nix build management stuff
kandi X-RAY | nix-make Summary
kandi X-RAY | nix-make Summary
Experimental Nix build management stuff
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of nix-make
nix-make Key Features
nix-make Examples and Code Snippets
Community Discussions
Trending Discussions on nix-make
QUESTION
I am trying to use boost spirit to create a parser for a simple language. The first statement I am trying to parse is a simple numeric addition: "3.14 + 1". It segfaults, and my research indicates it is because of a left-recursive implementation, but I can't wrap my head around the solution for this that isn't left-recursive. Here is my parser implementation:
...ANSWER
Answered 2020-Apr-14 at 10:41There are a number of things about your example.
First off, you use auto
with Spirit Qi expressions. That's not valid, and leads to UB:
- Assigning parsers to auto variables
- also boost spirit qi parser failed in release and pass in debug
- undefined behaviour somewhere in boost::spirit::qi::phrase_parse
- boost spirit V2 qi bug associated with optimization level
Next off, you chose to use polymorphic Ast nodes. That's possible but likely not efficient:
- How can I use polymorphic attributes with boost::spirit::qi parsers?
- Semantic actions runs multiple times in boost::spirit parsing
- but also making a vector of shared pointers from Spirit Qi which you may have found
Finally, there's the left recursion, since your expression starts with itself, leading to infinite recursion. The only way to solve it is to split your productions up into "levels" of expressions. This also aids in generating the desired operator precedence:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install nix-make
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page