Parser
✓ Published0🌍 Public
CCurran Kelleher
Last edited Aug 12, 2017
Created on Aug 12, 2017
This example presents a recursive descent parser for a simple grammar of arithmetic-like expressions using the operators "+" and "/" to represent horizontal and vertical composition. The code defines a tokenizer and parsing functions for factors, terms, and expressions, building a nested tree structure with orientation and children properties. It includes a comprehensive test suite that verifies parsing results for various input strings, including precedence, parentheses, and multi-character names. The parser runs entirely in the browser console, using no external libraries.
AI-generated descriptionBuilt with blockbuilder.org
mit Licensed