//******************************************* //* //* Help, comments and credits at eof //** //* Section 1 : Token Definition Rules //* //******************************************* closureString -> closure returnString -> return identifier -> [a-zA-Z_](?:[0-9a-zA-Z_]++)? splquotes -> '((?:(?:[^'\\]|\\.)++)?)' dblquotes -> "((?:(?:[^"\\]|\\.)++)?)" true -> \$true false -> \$false null -> \$null binary -> 0[bB]([01]++) octal -> 0([0-7]++) decimal -> [0-9]++ hexa -> 0[xX]([0-9A-Fa-f]++) float -> [0-9]++\.[0-9]++ ( -> \( ) -> \) [ -> \[ ] -> \] { -> \{ } -> \} ? -> \? : -> \: ?? -> \?\? :: -> \:\: ^ -> \^ * -> \* / -> \/ % -> \% + -> \+ - -> \- ~ -> \~ | -> \| & -> \& << -> \<\< >> -> \>\> && -> \&\& || -> \|\| ! -> \! < -> \< <= -> \<\= > -> \> >= -> \>\= === -> \=\=\= == -> \=\= .!== -> \!\=\= .!= -> \!\= ; -> \; . -> \. +. -> \+\. => -> \=\> , -> \, @ -> \@ -> -> \-\> \ -> \\ //******************************************* //* Ignore terminals //******************************************* !space -> \s++|\n++ //******************************************* //* //* Section 2 : Grammar Production Rules //* //******************************************* %% iexpr -> returnString? expr ;? pair -> expr : expr pairList -> pair pairQueue* ,? pairQueue -> , pair exprList -> expr exprQueue* ,? exprQueue -> , expr exprs -> ( exprList? ) expr *-> closure expr *-> function expr -> method expr -> filter expr -> arrayAccess expr *-> unaryOp expr -> binaryOp expr -> ternaryOp expr *-> isolation expr *-> map expr *-> list expr *-> scalar closure *-> closureString ( identifier* ) { iexpr* } function -> namespace? identifier methodName? exprs filter -> expr 99>@ namespace? identifier methodName? exprs? method -> expr 99>. identifier exprs arrayAccess -> expr 99>[ expr ] arrayAccess -> expr 99>. index unaryOp -> 95>! expr unaryOp -> 95>~ expr unaryOp -> 55>- expr binaryOp -> expr 60>^ expr binaryOp -> expr 50<* expr binaryOp -> expr 50 expr 50<% expr binaryOp -> expr 40<+ expr binaryOp -> expr 40<- expr binaryOp -> expr 35<<< expr binaryOp -> expr 35<>> expr binaryOp -> expr 34<+.. expr binaryOp -> expr 30<=== expr binaryOp -> expr 30<== expr binaryOp -> expr 30 expr 30 expr 30<<= expr binaryOp -> expr 30<< expr binaryOp -> expr 30<>= expr binaryOp -> expr 30<> expr binaryOp -> expr 25<& expr binaryOp -> expr 24<| expr binaryOp -> expr 20<&&. expr binaryOp -> expr 19<|| expr binaryOp -> expr 10>??. expr binaryOp -> expr 10>:: expr ternaryOp -> expr 10>? expr 10<: expr isolation -> ( expr ) list -> [ exprList? ] map -> [ pairList? ] scalar -> float scalar -> integer scalar -> identifier scalar -> splquotes scalar -> dblquotes scalar -> true scalar -> false scalar -> null index -> integer index -> identifier integer -> hexa integer -> binary integer -> octal integer -> decimal methodName -> -> identifier namespace -> \? subspace+ subspace -> identifier \ %% //******************************************* //* //* Section 3 : Comments //* //******************************************* The following rules would be cool but it introduces too much "non determinism" not in parsing ( that's a PEG...), but in language interpretation because, among other things, of too many precedences levels. filterMethod -> expr 99>@ expr 100>.. identifier exprs? method -> expr 99exprs closure -> expr 99>exprs A rule for handling closure invocation would also be very cool, but still, the syntax would become unbearable... expr -> metaExpr metaExpr -> { meta expr }