Program = Statement* PROGRAM_END Statement = Enum / Interface / Module / Expression Module = "EVERYTHING" _ "CHANGED" _ "WHEN" _ name:PASCAL_CASE _ "EXISTS" _ SCOPE_START _ body:ModuleBody _ SCOPE_END ModuleBody = Constructor? _? Declaration* Constructor = "PRACTICALLY" _ "IMPOSSIBLE" _ "TO" _ "HAVE" _ module:Identifier _ "WITHOUT" _ args:ArgList _ SCOPE_START _ body:FunctionBody _ SCOPE_END Expression = FunctionCall / BinaryExpression / UnaryOperation / Literal / Declaration FunctionCall = name:Identifier _ "OF" _ args:(Expression _? COMMA _?)* Expression BinaryExpression = left:Expression op:BinaryOperation right:Expression BinaryOperation = ArithmeticOperation / ComparisonOperation / BooleanOperation ArithmeticOperation = "\\+" / "\\-" / "/" / "\\%" / "\\*\\*" / "\\*" / ">>" / "<<" ComparisonOperation = "<" / ">" / "<=" / ">=" BooleanOperation = "\\|\\|" / "\\|" / "&&" / "&" Declaration = VarDeclaration / FunctionDeclaration VarDeclaration = "EXPERTS" _ "CLAIM" _ name:CAMEL_CASE _ "TO" _ "BE" _ Type _ val:(option:OptionMatch / "OF" _ expr:Expression)? OptionMatch = "WHO" _ "IS" _ "DATING" _ SCOPE_START _ (some:SomeMatch _ none:NoneMatch) / (none:NoneMatch _ some:SomeMatch) _ SCOPE_END SomeMatch = "Someone" LPAREN name:Identifier RPAREN _ "SO" _ expr:Expression NoneMatch = "Nobody" _ "SO" _ expr:Expression Literal = String / Integer / Float / StructInit / Identifier String = '(["\'])(?:(?=(\\\\?))\\2.)*?\\1' Integer = "^-?0*\\d+$" Float = "^-?\\d+(\\.\\d+)?$" UnaryOperation = PrefixOperation Expression / Expression PostfixOperation PrefixOperation = "!" / "~" PostfixOperation = LBRACKET index:POSITIVE_INT RBRACKET StructInit = "STUFF" _ "MADE" _ "OF" _ SCOPE_START _ init:Declaration* _ SCOPE_END Type = name:(PASCAL_CASE / (PASCAL_CASE _ generic:Generic) / (tupleType:Type _ LBRACKET _ tupleLength:POSITIVE_INT _ RBRACKET) / union:(Type _ "OR" _ Type)) Generic = LPAREN _? generic:(Type _? COMMA _?)* Type RPAREN FunctionDeclaration = FunctionSignature _ SCOPE_START _ body:FunctionBody _ SCOPE_END FunctionBody = (Expression / ReturnStatement)* FunctionSignature = "DISCOVER" _ "HOW" _ "TO" _ name:CAMEL_CASE _ "WITH" _ args:ArgList _ "GIVES" _ "YOU" _ type:Type ArgList = args:(type:Type name:CAMEL_CASE COMMA _?)* type:Type name:CAMEL_CASE ReturnStatement = "SHOCKING" _ "DEVELOPMENT" _ Expression Interface = "STUFF" _ "OF" _ name:PASCAL_CASE _ "LOOKS" _ "LIKE" SCOPE_START methods:FunctionSignature* Enum = "ONLY" _ "OPTIONS" _ "OF" name:PASCAL_CASE _ "ARE" _ SCOPE_START _ options:EnumBody* _ SCOPE_END EnumBody = name:Identifier COMMA Identifier = [a-zA-Z][\w\d|.]* SCOPE_START = "RUMOR" _ "HAS" _ "IT" SCOPE_END = "END" _ "OF" _ "STORY" PROGRAM_END = "PLEASE" _ "LIKE" _ "AND" _ "SUBSCRIBE" PASCAL_CASE = [A-Z][\w\d]* CAMEL_CASE = [a-z][\w\d]* LPAREN = "(" RPAREN = ")" LBRACKET = "[" RBRACKET = "]" COMMA = "," POSITIVE_INT = [1-9][0-9]* _ = [\s]+