GithubHelp home page GithubHelp logo

char0n / json-parsers Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 80 KB

Monorepo containing research for various json-parsers

Home Page: https://github.com/char0n/json-parsers

License: BSD 3-Clause "New" or "Revised" License

JavaScript 91.35% ANTLR 2.35% Batchfile 0.31% Nearley 5.99%
javascript json parser

json-parsers's Introduction

JavaScript JSON parsers

Monorepo containing research for various JSON parsers for JavaSript.

Requirements

I consider quality JSON parser to support source maps and implements error recovery mechanism.

This is the list of researched JSON parsers. Clicking on specific json parser will lead you to specific research whitepaper of that particular parser.

Other JSON parser

This list contains parsers that seemed worth analyzing but after initial analysis lacked features I'd expect from the proper parser:

  • parsimmon - very primitive, no location, nor error recovery mechanism
  • Hand-build parser
  • PEG.js - no advanced JSON grammar available (no location, no error recovery)
  • jison - seems dead (no commits for 3 years), error recovery in alpha mode
  • nyma - usage in community is minimal, documentation consist of 1 A4 document
  • ohm.js - sparse documentation, no release in 2 years, no mention about error recovery mechanism

Summary

This section describes candidates of JSON parsers that got into final selection. The order that the libraries are mentioned in doesn't express any preference.

One of the most interesting parsers (not a parser generator) that I've researched here is jsonc-parser developed by Microsoft. It's really a piece of art, with no dependencies, advanced error recovery mechanism and source maps support. It also goes beyond the JSON spec and optionally supports JS comments and trailing commas. Contains API for incremental parsing and edits.

The rest of the parsers that got into this selection falls into categories of true parser generators. tree-sitter, Chevrotain and Antlr4 are on the same level feature-vise.

Chevrotain seems like most configurable one, allowing switching the fault tolerance/error recovery mechanism on and off, along with optional parsing of comments and switching between CST and AST trees. It's also the fastest (JavaScript) parser generator out there.

Antlr4 is a very mature library with JavaScript runtime, considered a second fastest out there. It's masterfully documented and there is an actual book written about it. Error recovery strategies can be altered.

tree-sitter supports incremental parsing, AST updates and has one of the most sophisticated error recovery mechanism out there. The library is super fast as is written in C and can be used via node.js bindings or WASM. The biggest thing about this library is that Github uses it to highlight all it's code and Atom editor uses it as well. Error recovery mechanism cannot be turned off by a configuration.

Additional resources

json-parsers's People

Contributors

char0n avatar dependabot[bot] avatar

Stargazers

Yonathan Probeh avatar Thomas.G avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

json-parsers's Issues

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.