file: import? expression_list import: "import" module_name ("," module_name)* ";" module_name: identifier expression_list: expression ";" (expression ";")* expression: (declaration_expression | statement_expression) declaration_expression: const_declaration | var_declaration | class_declaration | enum_declaration | interface_declaration | function_declaration | delegate_declaration | bunch_declaration | macro_declaration | type_declaration const_declaration: "const" identifier_list (":" type_id)? ("=" simple_expression) ("," identifier_list (":" type_id)? ("=" simple_expression))* var_declaration: "var" identifier_list (":" type_id)? ("=" simple_expression)? ("," identifier_list (":" type_id)? ("=" simple_expression)?)* | "var" variable_destructuring "=" unary_expression | "var" object_destructuring "=" unary_expression class_declaration: "class" identifier (":" ancestors)? class_body ancestors: identifier_list class_body: "{" declaration* "}" enum_declaration: "enum" identifier "{" enum_members "}" enum_members: enum_member ";" (enum_member ";")* enum_member: identifier "=" simple_expression interface_declaration: "interface" identifier (":" ancestors)? interface_body interface_body: "{" function_declaration* "}" function_declaration: ("fn"|"fn*") identifier "(" parameter_list ")" function_body function_body: "{" expression_list "}" | "=>" expression | empty delegate_declaration: "delegate" identifier "(" parameter_list? ")" parameter_list: parameter ("," parameter)* parameter: ("this" | "params")? identifier (":" type_id)? ("=" simple_expression) bunch_declaration: "bunch" "{" bunch_function_declaration ("," bunch_function_declaration)* "}" bunch_function_declaration: ("fn"|"fn*") identifier "(" parameter_list? ")" ("when" "(" simple_expression ")")? function_body macro_declaration: "macro" string_literal "=" identifier type_declaration: "type" identifier "=" (class_expression | interface_expression | enum_expression | range_expression) statement_expression: block_expression | return_expression | throw_expression | break_expression | continue_expression | yield_expression | delete_expression | reset_expression | if_expression | while_expression | for_expression | simple_expression block_expression: "{" expression_list "}" return_expression: "return" simple_expression throw_expression: "throw" simple_expression break_expression: "break" continue_expression: "continue" yield_expression: "yield" simple_expression delete_expression: "delete" identifier reset_expression: "reset" identifier if_expression: "if" "(" simple_expression ")" ("else" simple_expression)? simple_expression while_expression: "while" "(" simple_expression ")" simple_expression for_expression: for_in_expression | c_style_expression for_in_expression: "for" "(" "var"? identifier "in" simple_expression ")" simple_expression c_style_expression: "for" "(" for_initializer? ";" for_condition? ";" for_iterator? ")" simple_expression for_initializer: var_declaration | expression_list for_condition: simple_expression for_iterator: expression_list simple_expression: assignment_expression | conditional_expression assignment_expression: unrary_expression assignment_operator simple_expression assignment_operator: "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "&=" | "|=" | ">>=" | "<=" conditional_expression: logical_or_expression | logical_or_expression "?" simple_expression ":" simple_expression | logical_or_expression "?? simple_expression logical_or_expression: logical_and_expression ("||" logical_and_expression)* logical_and_expression: equality_expression ("&&" equality_expression)* equality_expression: comparison_expression (equality_operator comparison_expression)? equality_operator: "==" | "!=" | "===" | "!==" comparison_expression: bitwise_or_expression (comparison_operator bitwise_or_expression)? comparison_operator: ">" | ">=" | "<" | "<=" | "is" | "as" bitwise_or_expression: bitwise_xor_expression ("|" bitwise_xor_expression)* bitwise_xor_expression: bitwise_and_expression ("^" bitwise_and_expression)* bitwise_and_expression: shift_expression ("&" shift_expression)? shift_expression: additive_expression (("<<" | ">>") additive_expression)? additive_expression: multiplicative_expression (("+" | "-") multiplicative_expression)* multiplicative_expression: unary_expression (("*" | "/" | "%") unary_expression)* unary_expression: unary_operator unary_exoression | primary_expression unary_operator: "+" | "-" | "++" | "--" | "&" | "@" primary_expression: integer_literal | double_literal | string_literal | boolean_literal | "(" expression ")" | this_expression | base_expression | new_expression | tuple_literal | type_id | function_expression | class_expression | interface_expression | enum_expression | if_expression | while_expression | for_expression | identifier post_expression* tuple_literal: ("[" | "@[") (simple_expression ("," simple_expression)*)* "]" this_expression "this" "." identifier base_expression "base" identifier? "(" (simple_expression ("," simple_expression)*)* ")" new_expression: "new" identifier "(" (simple_expression ("," simple_expression)*)* ")" | "new" identifier "[" (simple_expression ("," simple_expression)*)* "]" post_expression: "++" | "--" | "!" | "!!" | field_expression post_expression? | element_expression post_expression? | call_expression post_expression? | access_expression post_expression? field_expression: "." identifier element_expression: "[" simple_expression "]" call_expression: "(" (simple_expression ("," simple_expression)*)* ")" class_expression: "class" identifier? (":" ancestors)? class_body access_expression: "::" identifier interface_expression: "interface" identifier? (":" ancestors)? class_body enum_expression: "enum" identifier? "{" enum_members "}" function_expression: ("fn"|"fn*") identifier? "(" parameter_list? ")" function_body range_expression: constant ".." constant variable_destructuring: "[" destr_var ("," destr_var)* "]" destr_var: identifier (":" type_id)? ("=" simple_expression)? | "_" | variable_destructuring | "..." object_destructuring: "{" obj_var ("," obj_var)* "}" obj_var: identifier (":" identifier) identifier_list: identifier ("," identifier)*