Code Monkey home page Code Monkey logo

Comments (2)

ColinH avatar ColinH commented on June 5, 2024

The PEGTL is for parsing, so it can't help you with serialisation, regardless of text or binary formats.

For deserialisation I'd say the PEGTL isn't especially well suited to binary data, however (a) we have used the PEGTL infrastructure in our taoJSON library for parsing binary JSON-like data formats (CBOR, UBJSON and MsgPack) and (b) support for binary data will be improved as soon as I get around to finishing the back-porting of some experiments to the main branch.

You can look at the taoJSON code here: https://github.com/taocpp/json/tree/main/include/tao/json and If you want to try parsing binary data with the PEGTL then please feel free to contact us here, both for questions and for feedback, it's always useful to see how other people use the library.

from pegtl.

w4454962 avatar w4454962 commented on June 5, 2024

Yes, I am considering using "pegtl" for binary deserialization parsing. Binary data blocks are also composed of different rules, and there are two parsing methods

  1. Describe the specified binary block by parsing the "protobuf" syntax, and use a virtual machine like method to complete data deconstruction

  2. The rules for defining binary blocks with c++templates are parsed through template expansion.

The first method may cause some consumption, but supports hot update

The second method may be zero consumption, but each rule modification requires recompilation, and templating may not be suitable for the hash table structure

from pegtl.

Related Issues (20)

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.