Skip to content

Instantly share code, notes, and snippets.

@danking
Created November 15, 2010 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danking/676294 to your computer and use it in GitHub Desktop.
Save danking/676294 to your computer and use it in GitHub Desktop.
<statement> ::= <definition>
| <expression>
| "return " <expression>
<definition> ::= "var" <id> " = " <expression>
| "function " <id> " (" <argument-list> ") { " <statements> " }"
<statements> ::= <statment> ";\n" <statements>
| <statement> ";\n"
<expression> ::= <id>
| <primitive>
| <application>
| <lambda>
| "new " <application>
<id> ::= [A-z_][A-z0-9]*
Except:
abstract boolean break byte case catch char class const continue debugger
default delete do double else enum export extends false final finally
float for function goto if implements import in instanceof int interface
long native new null package private protected public return short
static super switch synchronized this throw throws transient true try
typeof var void volatile while with
<primitive> ::= true
| false
| undefined
| null
| <string>
| <number>
<application> ::= <expression> "(" <argument-list> ")"
<lambda> ::= "function (" <argument-list> ") { " <statements> " }"
<argument-list> ::= <expression> ", " <argument-list>
::= <expression>
<string> ::= "\"" [^\"]* "\""
<number> ::= usual definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment