Last active
May 20, 2016 03:32
-
-
Save tripplyons/5be6049973ad2f1493e346907aa917a7 to your computer and use it in GitHub Desktop.
thing
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
start = exps:(expr+) { | |
return exps.join('') | |
} | |
call = first:((func:function) / (identifier:id)) "(" exp:expr? ")" { | |
return first + "(" + exp + ")" | |
} | |
id = chars:([a-zA-Z]+) { | |
return chars.join('') | |
} | |
def = "#" identifier:id { | |
return 'var ' + identifier + ';' | |
} | |
digit = | |
[0-9] | |
int = val:([1-9] digit*/"0") { | |
return parseInt([val[0]].concat(val[1]).join("")); | |
} | |
function = "<" exps:(expr+) ">" { | |
return "(function(){"+exps+";})" | |
} / "<>" { | |
return "(function(){})" | |
} | |
arg = "$" exp:expr { | |
return "this.v["+exp+"]" | |
} | |
expr = int / arg / function / call / id / def |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment