Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Parsers in JavaScript

Parsers in JavaScript

This is an introduction to parsers in JavaScript with examples of PEG.js

Leif Gensert

April 22, 2020
Tweet

More Decks by Leif Gensert

Other Decks in Technology

Transcript

  1. "in 11 seconds" 11 "11 seconds ago" -11 "in 5

    minutes" 300 "in 1 minute and 30 seconds ago" 90 "now" 0
  2. // 1 + 2 add(1,2) // 1 + (5 -

    3) add(1, subtract(5,3)) // 1 + 5 * 3 add(1, multiply(5,3)) // (1 + 5) * 3 multiply(add(1,5), 3)
  3. Abstract Syntax Tree add(1, multiply(5,3)) { type: "callExpression", name: "add",

    arguments: [1 { type: "callExpression", name: "add", arguments: [5, 3] }] }