This file contains hidden or 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
/* | |
* Grammar to generate an S-Expressions parser for Javascript using http://pegjs.majda.cz/ | |
* Example: (+ 1 2) (car (quote (1 2 "test"))) | |
* Features: | |
- backslash symbols ("quote\"here"), | |
- one-line comments starts from ";" | |
- add "__" for identifiers - convert (car (quote (1 2 "three"))) to ["__car",["__quote",[1,2,"three"]]] | |
-- to change behavior replace | |
return "__"+identifier.map(function(a) {return concat(a)}).join(""); |