Last Updated: January 21, 2017
·
264
· gajus

Parsing absolutely anything in JavaScript using Earley algorithm

Let me start by saying — I was surprised how easy it was to write grammar for an Earley parser. I have been using regular expressions for over a decade. And I am used to parse things using regular expressions. Its fragile, its not always possible, etc. But it is fast and for the most part it serves the purpose.

Familiarising with parsing algorithms changed this attitude forever.

I describe my journey learning to parse complex data structures using Earley algorithm. From "1+2+3" to CSS selectors.

Read the entire article https://medium.com/@gajus/parsing-absolutely-anything-in-javascript-using-earley-algorithm-886edcc31e5e#.i2kyqlnwz