Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
three-pass-compiler
Solution to the Three Pass Compiler kata on CodeWars, parsing and manipulating a very simple AST
-
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.
Parser combinators [0] are great for quick parsing, usage from typescript is very neat. You can collapse tokenisation, parsing and some evaluation for simple grammars (they appear in production from time to time) into single parser combinator phase (there’s nothing else) where you get desired, typed result.
[0] https://github.com/appliedblockchain/parser-combinators
I’ve found generator functions work great for parsers. You yield the tokens you expect to be next. The token could be a string, a regular expression to be matched, or another generator function.
The library is open source here, contributions welcome: https://github.com/RoyalIcing/yieldparser
Generator functions have great support in modern browsers (not IE) and Node.js.
For example here’s a simple v4 IP address parser:
import { parse, mustEnd } from 'yieldparser';
function* Digit() {
You might enjoy checking out Instaparse, a Clojure library. Its project page reads, “What if context-free grammars were as easy to use as regular expressions?”
It’s not over-promising, either. I went from never having heard of it before to getting complete and correct parse trees of some ancient JSP Expression Language in about 20 minutes. Most of that time was spent typing in the BNF description that I could find only in an image.
https://github.com/Engelberg/instaparse