Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 968 Bytes

README.md

File metadata and controls

17 lines (10 loc) · 968 Bytes

Part 13

Code for Part 13 of my math expression parser series at inspirnathan.com

Commands

  • npm install: Install the necessary dependencies to run the Peggy parser generator tool.

  • npm run parse: Parse the calc.g grammar using LALR1 mode.

  • npm run generate: Generate a parser named calc-parser.js from the calc.g grammar using LALR1 mode.

  • npm run parse-ast: Parse the calc-ast.g grammar using LALR1 mode.

  • npm run generate-ast: Generate a parser named calc-ast-parser.js from the calc-ast.g grammar using LALR1 mode.

  • node calc-example: Run example code for evaluating a math expression using a generated parser from the calc.g grammar file.

  • node calc-ast-example: Run example code for displaying an abstract syntax tree (AST) from a math expression using a generated parser from the calc-ast.g grammar file.