This is an introduction to parsers in JavaScript with examples of PEG.js
Hello WorldParsers withJavaScript
View Slide
Programming === Hiking
CompilersReverseEngineering Building DeveloperTools
You don't Say
Every single program can be reduced toInputTransformationOutput* Former Boss
Human ReadableParsingMachine ReadableGrammar
"in 11 seconds" 11"11 seconds ago" -11"in 5 minutes" 300"in 1 minute and30 seconds ago"90"now" 0
Leif Demo
// 1 + 2add(1,2)// 1 + (5 - 3)add(1, subtract(5,3))// 1 + 5 * 3add(1, multiply(5,3))// (1 + 5) * 3multiply(add(1,5), 3)
What else? Domain SpecificNLPConfigFiles(Re)ImplementProgramming Languages
Abstract Syntax Treeadd(1, multiply(5,3)){type: "callExpression",name: "add",arguments: [1 {type: "callExpression",name: "add",arguments: [5, 3]}]}
Why?
Focus!
- Parsers seem intimidating- Helps you understand Recursion- Try out formulon.io
Shopping List
Back