Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Created September 3, 2014 03:22
Show Gist options
  • Save mattdeboard/e91ef5c0a27cda2328c3 to your computer and use it in GitHub Desktop.
Save mattdeboard/e91ef5c0a27cda2328c3 to your computer and use it in GitHub Desktop.
[0] _empty ::=
[1] Root ::= _empty | Body
[2] Body ::= Line _Body_1
[2.1] _Body_1 ::= _empty | _Body_3
[2.3] _Body_3 ::= _Body_2 _Body_1
[2.2] _Body_2 ::= _Body_4 | TERMINATOR
[2.4] _Body_4 ::= TERMINATOR Line
[3] Line ::= Expression | Statement
[4] Statement ::= Return | Comment | STATEMENT
[5] Expression ::= Value
| Invocation
| Code
| Operation
| Assign
| If
| Try
| While
| For
| Switch
| Class
| Throw
[6] Block ::= _Block_1 | _Block_2
[6.1] _Block_1 ::= INDENT OUTDENT
[6.2] _Block_2 ::= INDENT Body OUTDENT
[7] Identifier ::= IDENTIFIER
[8] AlphaNumeric ::= NUMBER | STRING
[9] Literal ::= AlphaNumeric
| JS
| REGEX
| DEBUGGER
| UNDEFINED
| NULL
| BOOL
[10] Assign ::= _Assign_1 | _Assign_2 | _Assign_3
[10.1] _Assign_1 ::= Assignable "=" Expression
[10.2] _Assign_2 ::= Assignable "=" TERMINATOR Expression
[10.3] _Assign_3 ::= Assignable "=" INDENT Expression OUTDENT
[11] AssignObj ::= ObjAssignable
| _AssignObj_1
| _AssignObj_2
| Comment
[11.1] _AssignObj_1 ::= ObjAssignable ":" Expression
[11.2] _AssignObj_2 ::= ObjAssignable ":" INDENT Expression OUTDENT
[12] ObjAssignable ::= Identifier | AlphaNumeric | ThisProperty
[13] Return ::= _Return_1 | RETURN
[13.1] _Return_1 ::= RETURN Expression
[14] Comment ::= HERECOMMENT
[15] Code ::= _Code_1 | _Code_2
[15.1] _Code_1 ::= PARAM_START ParamList PARAM_END FuncGlyph Block
[15.2] _Code_2 ::= FuncGlyph Block
[16] FuncGlyph ::= "->" | "=>"
[17] OptComma ::= _empty | ","
[18] ParamList ::= _empty | _ParamList_1
[18.1] _ParamList_1 ::= Param | _ParamList_2 | _ParamList_3 | _ParamList_4
[18.2] _ParamList_2 ::= ParamList "," Param
[18.3] _ParamList_3 ::= ParamList OptComma TERMINATOR Param
[18.4] _ParamList_4 ::= ParamList
OptComma
INDENT
ParamList
OptComma
OUTDENT
[19] Param ::= ParamVar | _Param_1 | _Param_2
[19.1] _Param_1 ::= ParamVar "..."
[19.2] _Param_2 ::= ParamVar "=" Expression
[20] ParamVar ::= Identifier | ThisProperty | Array | Object
[21] Splat ::= Expression "..."
[22] SimpleAssignable ::= Identifier
| _SimpleAssignable_1
| _SimpleAssignable_2
| ThisProperty
[22.1] _SimpleAssignable_1 ::= Value Accessor
[22.2] _SimpleAssignable_2 ::= Invocation Accessor
[23] Assignable ::= SimpleAssignable | Array | Object
[24] Value ::= Assignable
| Literal
| Parenthetical
| Range
| This
[25] Accessor ::= _Accessor_1
| _Accessor_2
| _Accessor_3
| _Accessor_4
| "::"
| _Accessor_5
[25.1] _Accessor_1 ::= "." Identifier
[25.2] _Accessor_2 ::= "?." Identifier
[25.3] _Accessor_3 ::= "::" Identifier
[25.4] _Accessor_4 ::= "?::" Identifier
[25.5] _Accessor_5 ::= _Accessor_6 INDEX_START IndexValue INDEX_END
[25.6] _Accessor_6 ::= _empty | _Accessor_7
[25.7] _Accessor_7 ::= INDEX_SOAK _Accessor_6
[26] IndexValue ::= Expression | Slice
[27] Object ::= "{" AssignList OptComma "}"
[28] AssignList ::= _empty | _AssignList_1
[28.1] _AssignList_1 ::= AssignObj
| _AssignList_2
| _AssignList_3
| _AssignList_4
[28.2] _AssignList_2 ::= AssignList "," AssignObj
[28.3] _AssignList_3 ::= AssignList OptComma TERMINATOR AssignObj
[28.4] _AssignList_4 ::= AssignList
OptComma
INDENT
AssignList
OptComma
OUTDENT
[29] Class ::= CLASS
| _Class_1
| _Class_2
| _Class_3
| _Class_4
| _Class_5
| _Class_6
| _Class_7
[29.1] _Class_1 ::= CLASS Block
[29.2] _Class_2 ::= CLASS EXTENDS Expression
[29.3] _Class_3 ::= CLASS EXTENDS Expression Block
[29.4] _Class_4 ::= CLASS SimpleAssignable
[29.5] _Class_5 ::= CLASS SimpleAssignable Block
[29.6] _Class_6 ::= CLASS SimpleAssignable EXTENDS Expression
[29.7] _Class_7 ::= CLASS SimpleAssignable EXTENDS Expression Block
[30] Invocation ::= _Invocation_1 _Invocation_2
[30.1] _Invocation_1 ::= _Invocation_3 | SUPER | _Invocation_4
[30.3] _Invocation_3 ::= Value OptFuncExist Arguments
[30.4] _Invocation_4 ::= SUPER Arguments
[30.2] _Invocation_2 ::= _empty | _Invocation_6
[30.6] _Invocation_6 ::= _Invocation_5 _Invocation_2
[30.5] _Invocation_5 ::= OptFuncExist Arguments
[31] OptFuncExist ::= _empty | FUNC_EXIST
[32] Arguments ::= _Arguments_1 | _Arguments_2
[32.1] _Arguments_1 ::= CALL_START CALL_END
[32.2] _Arguments_2 ::= CALL_START ArgList OptComma CALL_END
[33] This ::= THIS | "@"
[34] ThisProperty ::= "@" Identifier
[35] Array ::= _Array_1 | _Array_2
[35.1] _Array_1 ::= "[" "]"
[35.2] _Array_2 ::= "[" ArgList OptComma "]"
[36] RangeDots ::= ".." | "..."
[37] Range ::= "[" Expression RangeDots Expression "]"
[38] Slice ::= _Slice_1 | _Slice_2 | _Slice_3 | RangeDots
[38.1] _Slice_1 ::= Expression RangeDots Expression
[38.2] _Slice_2 ::= Expression RangeDots
[38.3] _Slice_3 ::= RangeDots Expression
[39] ArgList ::= Arg
| _ArgList_1
| _ArgList_2
| _ArgList_3
| _ArgList_4
[39.1] _ArgList_1 ::= ArgList "," Arg
[39.2] _ArgList_2 ::= ArgList OptComma TERMINATOR Arg
[39.3] _ArgList_3 ::= INDENT ArgList OptComma OUTDENT
[39.4] _ArgList_4 ::= ArgList OptComma INDENT ArgList OptComma OUTDENT
[40] Arg ::= Expression | Splat
[41] SimpleArgs ::= Expression _SimpleArgs_1
[41.1] _SimpleArgs_1 ::= _empty | _SimpleArgs_3
[41.3] _SimpleArgs_3 ::= _SimpleArgs_2 _SimpleArgs_1
[41.2] _SimpleArgs_2 ::= "," Expression
[42] Try ::= _Try_1 | _Try_2 | _Try_3 | _Try_4
[42.1] _Try_1 ::= TRY Block
[42.2] _Try_2 ::= TRY Block Catch
[42.3] _Try_3 ::= TRY Block FINALLY Block
[42.4] _Try_4 ::= TRY Block Catch FINALLY Block
[43] Catch ::= _Catch_1 | _Catch_2 | _Catch_3
[43.1] _Catch_1 ::= CATCH Identifier Block
[43.2] _Catch_2 ::= CATCH Object Block
[43.3] _Catch_3 ::= CATCH Block
[44] Throw ::= THROW Expression
[45] Parenthetical ::= _Parenthetical_1 | _Parenthetical_2
[45.1] _Parenthetical_1 ::= "(" Body ")"
[45.2] _Parenthetical_2 ::= "(" INDENT Body OUTDENT ")"
[46] WhileSource ::= _WhileSource_1
| _WhileSource_2
| _WhileSource_3
| _WhileSource_4
[46.1] _WhileSource_1 ::= WHILE Expression
[46.2] _WhileSource_2 ::= WHILE Expression WHEN Expression
[46.3] _WhileSource_3 ::= UNTIL Expression
[46.4] _WhileSource_4 ::= UNTIL Expression WHEN Expression
[47] While ::= _While_1 | _While_2 | _While_3 | Loop
[47.1] _While_1 ::= WhileSource Block
[47.2] _While_2 ::= Statement WhileSource
[47.3] _While_3 ::= Expression WhileSource
[48] Loop ::= _Loop_1 | _Loop_2
[48.1] _Loop_1 ::= LOOP Block
[48.2] _Loop_2 ::= LOOP Expression
[49] For ::= _For_1 | _For_2 | _For_3
[49.1] _For_1 ::= Statement ForBody
[49.2] _For_2 ::= Expression ForBody
[49.3] _For_3 ::= ForBody Block
[50] ForBody ::= _ForBody_1 | _ForBody_2
[50.1] _ForBody_1 ::= FOR Range
[50.2] _ForBody_2 ::= ForStart ForSource
[51] ForStart ::= _ForStart_1 | _ForStart_2
[51.1] _ForStart_1 ::= FOR ForVariables
[51.2] _ForStart_2 ::= FOR OWN ForVariables
[52] ForValue ::= Identifier | ThisProperty | Array | Object
[53] ForVariables ::= ForValue | _ForVariables_1
[53.1] _ForVariables_1 ::= ForValue "," ForValue
[54] ForSource ::= _ForSource_1
| _ForSource_2
| _ForSource_3
| _ForSource_4
| _ForSource_5
| _ForSource_6
| _ForSource_7
[54.1] _ForSource_1 ::= FORIN Expression
[54.2] _ForSource_2 ::= FOROF Expression
[54.3] _ForSource_3 ::= FORIN Expression WHEN Expression
[54.4] _ForSource_4 ::= FOROF Expression WHEN Expression
[54.5] _ForSource_5 ::= FORIN Expression BY Expression
[54.6] _ForSource_6 ::= FORIN Expression WHEN Expression BY Expression
[54.7] _ForSource_7 ::= FORIN Expression BY Expression WHEN Expression
[55] Switch ::= _Switch_1 | _Switch_2 | _Switch_3 | _Switch_4
[55.1] _Switch_1 ::= SWITCH Expression INDENT Whens OUTDENT
[55.2] _Switch_2 ::= SWITCH Expression INDENT Whens ELSE Block OUTDENT
[55.3] _Switch_3 ::= SWITCH INDENT Whens OUTDENT
[55.4] _Switch_4 ::= SWITCH INDENT Whens ELSE Block OUTDENT
[56] Whens ::= When _Whens_1
[56.1] _Whens_1 ::= _empty | _Whens_2
[56.2] _Whens_2 ::= When _Whens_1
[57] When ::= _When_1 | _When_2
[57.1] _When_1 ::= LEADING_WHEN SimpleArgs Block
[57.2] _When_2 ::= LEADING_WHEN SimpleArgs Block TERMINATOR
[58] IfBlock ::= IF Expression Block _IfBlock_1
[58.1] _IfBlock_1 ::= _empty | _IfBlock_3
[58.3] _IfBlock_3 ::= _IfBlock_2 _IfBlock_1
[58.2] _IfBlock_2 ::= ELSE IF Expression Block
[59] If ::= IfBlock | _If_1 | _If_2 | _If_3
[59.1] _If_1 ::= IfBlock ELSE Block
[59.2] _If_2 ::= Statement POST_IF Expression
[59.3] _If_3 ::= Expression POST_IF Expression
[60] Operation ::= _Operation_1
| _Operation_2
| _Operation_3
| _Operation_4
| _Operation_5
| _Operation_6
| _Operation_7
| _Operation_8
| _Operation_9
| _Operation_10
| _Operation_11
| _Operation_12
| _Operation_13
| _Operation_14
| _Operation_15
| _Operation_16
| _Operation_17
| _Operation_18
| _Operation_19
[60.1] _Operation_1 ::= UNARY Expression
[60.2] _Operation_2 ::= "-" Expression
[60.3] _Operation_3 ::= "+" Expression
[60.4] _Operation_4 ::= "--" SimpleAssignable
[60.5] _Operation_5 ::= "++" SimpleAssignable
[60.6] _Operation_6 ::= SimpleAssignable "--"
[60.7] _Operation_7 ::= SimpleAssignable "++"
[60.8] _Operation_8 ::= Expression "?"
[60.9] _Operation_9 ::= Expression "+" Expression
[60.10] _Operation_10 ::= Expression "-" Expression
[60.11] _Operation_11 ::= Expression MATH Expression
[60.12] _Operation_12 ::= Expression SHIFT Expression
[60.13] _Operation_13 ::= Expression COMPARE Expression
[60.14] _Operation_14 ::= Expression LOGIC Expression
[60.15] _Operation_15 ::= Expression RELATION Expression
[60.16] _Operation_16 ::= SimpleAssignable COMPOUND_ASSIGN Expression
[60.17] _Operation_17 ::= SimpleAssignable
COMPOUND_ASSIGN
INDENT
Expression
OUTDENT
[60.18] _Operation_18 ::= SimpleAssignable
COMPOUND_ASSIGN
TERMINATOR
Expression
[60.19] _Operation_19 ::= SimpleAssignable EXTENDS Expression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment