Created
February 5, 2015 03:15
-
-
Save hdemon/e3088d63c9c194e197fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Classic example grammar, which recognizes simple arithmetic expressions like | |
* "2*(3+4)". The parser generated from this grammar then computes their value. | |
*/ | |
start | |
= right:digits " plus " left:digits { | |
return right + left; | |
} | |
digits | |
= digits:[0-9]+ { return parseInt(digits.join(""), 10); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment