Git Product home page Git Product logo

cppparsec's People

Contributors

ailrk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ailrk-sarchives

cppparsec's Issues

Better error messages, and compilation option to turn on all error generated

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:

  • The proximity of the error -- where it happened, what does text around it looks like.
  • The cause of the error. Not only ", 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.

Performance issue becaue of copy.

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.

`satisfy` crashes

address sanitizer reports stack buffer overflow when token in core.h is calling the match callback passed from satisfy.

use shared_ptr to mange lifetime

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.