ailrk / cppparsec Goto Github PK
View Code? Open in Web Editor NEWparsec in c++
License: Other
parsec in c++
License: Other
Currently the parser is unbarely slow. The calculator demo takes about 1 second to parse a simple arithmetic expression. It's expected becaues a lot of implementations are based on pass by value. It was intened to speed up the development process.
It''s nice to clean up all references and benchmark to see how much it will speed up before doing optmizations on the program's structure.
Parsers can have dependencies with each other, and we can't guarantee a parser always lives longer than those who depend on it. The current solution is simply copying the parser all the time. The plan is to use shared_ptr.
shared_ptr always has less overhead than std::functional when there is closure.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The error message is not informative enough. It will print the errors that are marked by label
combinator, and add into a message list. But for a complex parser this error messages are usually lack of context and are hardly useful. For example. the error message for the demo/json.h currently looks like this
cmake --build . --target json-demo 11.90s user 0.48s system 99% cpu 12.447 total
/home/jimmy/newDisk/Repo/cppparsec/demo//demo1.json
terminate called after throwing an instance of 'cppparsec::parse_failed'
what(): parse failed. line: 2, column: 3. 2 errors occurred.
details (lastest on top):
- expect character: }
- "
This only shows that something happened when parsig the character "
, and it's saying it's expecting }
. We don't know what's the context, and what parser it is currenly in.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Make error message more descrptive. Some information should be included:
"
, but some messages like error when parsing the character " in parser: ch. [empty error]
. The last bracket marks which continuation it invoked.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Maybe add some compilication options to compile with all errors turned on, so we can read a trace of all errors. It's really hard to debug without knowing where things go wrong.
These two combinators are located at cppparsec/combinator.h:line 222
. The implementation is roughly the same as sep_by
. The expected behavior is documented in the comment.
address sanitizer reports stack buffer overflow when token
in core.h
is calling the match callback passed from satisfy
.
set up fuzzers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.