Plure |
topLevelDef* EOF |
TopLevelDef |
classDef | objectDef | traitDef | def |
ClassDef |
CLASS IDENTIFIER classBody |
ObjectDef |
OBJECT IDENTIFIER classBody |
TraitDef |
TRAIT IDENTIFIER traitBody |
Def |
DEF IDENTIFIER parameterList returnType EQ defBlock |
ClassBody |
LBRACE classMember* RBRACE |
TraitBody |
LBRACE traitMember* RBRACE |
ClassMember |
classDef | def | assignment SEMICOLON | definition SEMICOLON |
TraitMember |
traitDef | def |
ParameterList |
LPAREN parameter (COMMA parameter)* RPAREN | LPAREN RPAREN |
Parameter |
IDENTIFIER COLON IDENTIFIER |
ReturnType |
COLON IDENTIFIER | *epsilon* |
DefBlock |
LBRACE statement* returnVal? RBRACE |
Block |
LBRACE statement* RBRACE |
ReturnVal |
RETURN expressionStatement |
Statement |
block | ifStatement | whileStatement | forStatement | expressionStatement |
IfStatement |
IF LPAREN logicExpression RPAREN (block | statement) (ELSE (block | statement))? |
WhileStatement |
WHILE LPAREN logicExpression RPAREN block |
ForStatement |
FOR LPAREN logicExpression RPAREN block |
Enumeration |
IDENTIFIER ARROW expression |
ExpressionStatement |
expression SEMICOLON |
LogicExpression |
expression binaryOperator expression | unaryOperator expression | LPAREN expression RPAREN |
Expression |
literal | IDENTIFIER | functionCall | objectMethodAccess | assignment | definition |
FunctionCall |
IDENTIFIER argumentList |
ObjectMethodAccess |
IDENTIFIER DOT IDENTIFIER argumentList? |
ArgumentList |
LPAREN (expression (COMMA expression)*)? RPAREN |
Definition |
(VAR | VAL) IDENTIFIER |
Assignment |
(VAR | VAL) IDENTIFIER EQ (operation | creation) |
Operation |
(IDENTIFIER | literal) (simpleOperator (IDENTIFIER | literal))* |
Creation |
NEW functionCall |
BinaryOperator |
EQEQ | NEQ | LT | GT | LTEQ | GTEQ | AND | OR | PRO |
UnaryOperator |
PLUS | MINUS | BANG |
SimpleOperator |
PLUS | MINUS | ASTERISK | SLASH |
Literal |
BOOLEAN_LITERAL | INT_LITERAL | STRING_LITERAL |