How to create a small json lib using antlr and shapeless

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • sbt-antlr4

    Antlr4 plugin for sbt 1.1+ and 0.13.x

  • Now we are ready to create a new project. For project building i'll use sbt, but it is also possible to use maven or gradle. After project creation we need to add antlr4 compiler plugin – sbt-antlr4. Also, we will need a shapeless for codec derivation, so let's add this library too. After all, plugins.sbt and build.sbt will look like this:

  • grammars-v4

    Grammars written for ANTLR v4; expectation that the grammars are free of actions.

  • First of all, we need a grammar. I think, that the best place for exploring grammars and take some ideas is grammars-v4. There are a lot of grammar examples, but we need a special one – json.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • ANTLR

    ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

  • We will change it a little bit soon, but for now let's look on what's going on there. In general, grammar consists of parser and lexer rules.

  • json-serde

    Example of usage antlr4 and shapeless

  • The source code of a whole project could be found here: https://github.com/nryanov/json-serde

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts