Syntaxdiagramme
Program
ObjectDefinition
Statement
IfStatement
WhileStatement
ForStatement
DoWhileStatement
SwitchStatement
BreakStatement
ContinueStatement
ReturnStatement
Expression
JsonExpression
Identifier
Call
Argument
Array
Matrix
ConditionalExpression
ObjectType
IdentifierPart
Name
PrefixOperator
SuffixOperator
BinaryOperator
AssignOperator
Integer
HexConstant
FloatingPoint
Imaginary
StringConstant
CharacterConstant
JsonString
RawString
Boolean
Digit
Letter
HexDigit
Character
XMLCharacter
EBNF Syntaxbeschreibung
Eine Visualisierung kann auf https://www.bottlecaps.de/rr/ui erstellt werden
Program ::= ( ObjectDefinition )+
ObjectDefinition ::= ObjectType Name ( "(" Name ( "," Name )* ")" )? ( ":" Name ( "(" Expression ( "," Expression )* ")" )? )? "{" ( Statement )* "}" ";"
Statement ::= ";" | Expression ";" | "{" ( Statement )* "}" | IfStatement | WhileStatement | ForStatement | DoWhileStatement | ObjectDefinition | SwitchStatement | BreakStatement | ContinueStatement | ReturnStatement
ReturnStatement ::= "return " Expression ";"
BreakStatement ::= "break" ";"
ContinueStatement ::= "continue" ";"
IfStatement ::= "if" "(" Expression ")" Statement ( "else" Statement )?
WhileStatement ::= "while" "(" Expression ")" Statement
DoWhileStatement ::= "do" Statement "while" "(" Expression ")" ";"
ForStatement ::= "for" "(" ( Expression )? ";" ( Expression )? ";" ( Expression )? ")" Statement
SwitchStatement ::= "switch" "(" Expression ")" "{" ( "case" Expression ( ".." Expression )? ":" "{" ( Statement )* "}" )* ( "default" ":" "{" ( Statement )* "}" )? "}"
Expression ::= ( PrefixOperator )* ( Integer | Imaginary | HexConstant | StringConstant | CharacterConstant | RawString | Boolean | "null" | Array | Matrix | ConditionalExpression | Call | Identifier ( ( ( "." | "@" ) Identifier )+ | ( ( ".<" | "@<") Name ":=" Expression )? )? | "(" Expression ")" ) ( SuffixOperator )? ( ( BinaryOperator | AssingOperator ) Expression )?
JsonExpression ::= "{" ( StringConstant ":" (JsonExpression | Expression ) ("," StringConstant ":" (JsonExpression | Expression ))* )? "}" | "[" ( (JsonExpression | Expression ) ("," (JsonExpression | Expression ))* )? "]"
Identifier ::= ("_" | Letter ) ( ( "_" | Digit | Letter | IdentifierPart )* ( ".[" Expression "]" | "[" Expression "]" )* ( "." IdentifierPart )? )*
Call ::= Identifier "(" ( Argument ( "," Argument)* )? ")"
Argument ::= Expression | ( "&" Identifier )
Array ::= "[" ( Expression ( "," Expression )* )? "]"
Matrix ::= "[" Array ( "," Array )* "]"
ConditionalExpression ::= Expression "?" Expression ":" Expression
ObjectType ::= "object" | "global" | "function" | "main"
IdentifierPart ::= "{" Expression "}"
Name ::= ("_" | Letter ) ( "_" | Digit | Letter | IdentifierPart )*
PrefixOperator ::= "-" | "+" | "~" | "!" | "++" | "--" | "`"
SuffixOperator ::= "++" | "--"
BinaryOperator ::= "+" | "-" | "*" | "/" | "&" | "|" | "^" | "%" | "&&" | "||" | "^^" | "**" | "<" | ">" | "<<" | ">>" | "==" | "<=" | ">=" | "!=" | ".*" | ".**" | "./" | "in" | "."
AssignOperator ::= "=" | ":=" | "+=" | "-=" | "*=" | "/=" | "&=" | "|=" | "^=" | "&&=" | "||=" | "^^=" | "**="
Integer ::= Digit ( Digit )*
HexConstant ::= ("0x" | "0X") HexDigit ( HexDigit )*
FloatingPoint ::= ( "+" | "-" )? ( Digit )+ ( "." ( Digit )+ ( ( "e" | "E" ) ( "+" | "-" )? ( Digit )+ )? )? | "NaN"
Imaginary ::= FloatingPoint "i"
StringConstant ::= '"' ( ( Character | "\n" | "\r" | "\t" | "\a" | "\b" | "\f" | "\v" | "\\" | '\"' | "\?" | "\'" | "\" [0-3] [0-7]* | "u" HexDigit+ )* )+ '"'
CharacterConstant ::= "'" ( ( Character | "\n" | "\r" | "\t" | "\a" | "\b" | "\f" | "\v" | "\\" | '\"' | "\?" | "\'" | "\" [0-3] [0-7]* | "u" HexDigit+ )* )+ "'"
JsonString ::= '"' ( ( Character | "\n" | "\r" | "\t" | "\a" | "\b" | "\f" | "\v" | "\\" | '\"' | "\?" | "\'" | "\" [0-3] [0-7]* | "u" HexDigit+ | "\/" )* )+ '"'
RawString ::= "R" '"' RawStringDelimiter "(" ( Character | "`" Expression "`" )* ")" RawStringDelimiter '"'
Boolean ::= "true" | "false"
Digit ::= [0-9]
Letter ::= [a-z] | [A-Z]
HexDigit ::= [a-fA-F] | Digit
Character ::= [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
XMLCharacter ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]