Risa is an embeddable and modular scripting language.
This implementation is extremely early, work-in-progress and, therefore, not yet ready for an alpha release. Many parts of the code are temporary, and WILL be changed.
This is the EBNF notation for Risa's grammar.
script::= ( spacedeclarationspace )*EOF;declaration::=fnDecl
| varDecl
| stmt;fnDecl::="function"spacefn;varDecl::="var"spaceIDENTIFIER ( space"="expr)? ";";fn::=IDENTIFIERspace"("spaceparams? space")" ( block | "=>"expr );params::=IDENTIFIER ( ","spaceIDENTIFIER )*;stmt::=exprStmt
| ifStmt
| whileStmt
| forStmt
| returnStmt
| continueStmt
| breakStmt
| block;exprStmt::=expr";"space;ifStmt::="if"space"("expr")"spacestmtspace ( space"else"spacestmtspace )? ;whileStmt::="while"space"("expr")"spacestmt;forStmt::="for""(" ( varDec | exprStmt | ";" ) expr? ";"expr? ")"spacestmt;returnStmt::=space"return"expr? ";";continueStmt::=space"continue"INTEGER? ";";breakStmt::=space"break"INTEGER? ";";block::=space"{"declaration*"}";expr::=spacecommaspace;comma::=assignmentspace","spaceassignment;assignment::= ( callspace"."space )? IDENTIFIERspace"="spaceassignment
| ternary;ternary::=orspace"?"expr":"expr;or::=and ( "||"and)*;and::=bitwiseOr ( "&&"bitwiseOr )*;bitwiseOr::=bitwiseXor ( "|"bitwiseXor )*;bitwiseXor::=bitwiseAnd ( "^"bitwiseAnd )*;bitwiseAnd::=equality ( "&"equality )*;equality::=comparison ( ( "==" | "!=" ) comparison )*;comparison::=shift ( ( "<" | "<=" | ">" | ">=" ) shift )*;shift::=addition ( ( "<<" | ">>" ) addition )*;addition::=multiplication ( ( "+" | "-" ) multiplication )*;multiplication::=unary ( ( "*" | "/" | "%" ) unary )*;unary::=space ( ( "!" | "-" | "~" ) unary | call ) space;call::=primary ( "("args? ")" | "["expr"]" | "."IDENTIFIER )*;args::=expr ( ","expr )*;primary::="null"
| "true"
| "false"
| NUMBER
| STRING
| IDENTIFIER
| "("expr")" | lambda
| array;lambda::="("args? ")"space"=>" ( expr | block ) ;array::="["args? "]";space::=""
| ""
| "\t"
| "\r"
| "\n"
| comment;comment::="//" ( COMMENTCHAR )*
| "/*" ( ANYCHAR )*"*/";COMMENTCHAR::= [#x00-#x09#x0B-#xFF] ;ANYCHAR::= [#x00-#xFF] ;NUMBER::=BYTE
| INTEGER
| FLOAT;STRING::="\"" STRCHAR "\"";IDENTIFIER::=ALPHA ( ALPHA | DIGIT )*;BYTE::=DIGIT+ "b";INTEGER::=DIGIT+ ;FLOAT::=DIGIT+ "."DIGIT+ [ "f" ]
| DIGIT+ "f";STRCHAR::= [#x00-#x09#x0B-#x21#x23-#xFF] | "\\\"" ;ALPHA ::= [a-zA-Z] | "_" ;DIGIT ::= [0-9] ;This project was created by The Exom Developers.
The Risa project is licensed under the MIT license.