Language Grammar G = (N,T,P,S) T = [...] N = { Program, Statement, Import, Variable Function, If, While, Class, Return, Annotation, Expression, Formals, Formal, BaseType, SimpleType, OptionType, Datatype, Block, ElseIf, Else, Expression_primary, Literal, Array, None, [...] } S = Program P = { Program = { Statement } . Statement = ( Import | Variable | Function | If | While | Class | Return | Annotation | Expression ) ";" . Import = "using" (TOKEN_WORD | TOKEN_STRING) . Variable = "let" [ "mut" ] TOKEN_WORD "=" Expression . Function = "func" TOKEN_WORD Formals ( ( "->" Datatype Block ) | Block ) . Formals = "(" [ formal { "," formal } ] ")" . Formal = [ "mut" ] TOKEN_WORD ":" Datatype . BaseType = "int" | "char" | "bool" | "float" | "generic" | "str" | "void" | TOKEN_WORD . SimpleType = BaseType { "[]" } . OptionType = "option" TOKEN_LESS ( SimpleType | OptionType ) TOKEN_GREATER . Datatype = SimpleType | OptionType . Block = "{" { Statement } "}" . If = "if" Expression Block { ElseIf } [ Else ] . ElseIf = "else" "if" Expression Block . Else = "else" Block . While = "while" Expression Block . Class = "type" TOKEN_WORD Formals Block . Return = "return" [ Expression ] . Annotation = "@" ( "Getter" | "Setter" | "Unused" ) . Expression = Expression_primary { Operator, Expression_primary } . Expression_primary = Literal | TOKEN_WORD | ( "(" Expression ")" ) | Unary | Call | Subscript | Subscript_sugar . SimpleLiteral = Float | Integer | String | Boolean | None . Literal = SimpleLiteral | Array . Array = "[", ( ( Expression { "," Expression } ) | ( "::" Datatype ) ) "]" . None = "None" TOKEN_LESS Datatype TOKEN_GREATER . Call = Expression "(" [ Expression { "," Expression } ] ")" . Subscript = Expression "[" Expression "]" . Subscript_sugar = Expression "." Ident . }