Closed jthoene closed 4 years ago
Over the last year the Yul language extended and supports more statements and expressions than we currently support in the grammar. The current EBNF for Yul looks like the following:
Block = '{' Statement* '}' Statement = Block | FunctionDefinition | VariableDeclaration | Assignment | If | Expression | Switch | ForLoop | BreakContinue | Leave FunctionDefinition = 'function' Identifier '(' TypedIdentifierList? ')' ( '->' TypedIdentifierList )? Block VariableDeclaration = 'let' TypedIdentifierList ( ':=' Expression )? Assignment = IdentifierList ':=' Expression Expression = FunctionCall | Identifier | Literal If = 'if' Expression Block Switch = 'switch' Expression ( Case+ Default? | Default ) Case = 'case' Literal Block Default = 'default' Block ForLoop = 'for' Block Expression Block Block BreakContinue = 'break' | 'continue' Leave = 'leave' FunctionCall = Identifier '(' ( Expression ( ',' Expression )* )? ')' Identifier = [a-zA-Z_$] [a-zA-Z_$0-9.]* IdentifierList = Identifier ( ',' Identifier)* TypeName = Identifier TypedIdentifierList = Identifier ( ':' TypeName )? ( ',' Identifier ( ':' TypeName )? )* Literal = (NumberLiteral | StringLiteral | HexLiteral | TrueLiteral | FalseLiteral) ( ':' TypeName )? NumberLiteral = HexNumber | DecimalNumber HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'') StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"' TrueLiteral = 'true' FalseLiteral = 'false' HexNumber = '0x' [0-9a-fA-F]+ DecimalNumber = [0-9]+
Over the last year the Yul language extended and supports more statements and expressions than we currently support in the grammar. The current EBNF for Yul looks like the following: