Prototyping grammars in JavaScript / TypeScript

Context-free grammars are a popular technique for parsing input in software development. Implementing a grammar can be difficult or require complex dependencies. Ambiguous and recursive grammars can be particularly challenging.

Read on for a technique I like to use when rapidly prototype grammars in JavaScript or TypeScript. The technique uses yield to simulate Prolog's definite clause grammars in JavaScript.

Continue Reading (Published 25 January 2021)

Published 1 January 2021 by Benjamin Johnston.