diff options
author | Christian <c@ethdev.com> | 2014-10-09 21:57:49 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-10 00:35:41 +0800 |
commit | 924f7c62bdcb203f42514d298f15570ff53d2bac (patch) | |
tree | 627dcfa5883597c1d19d58902eca3c2aa8ca4d73 /grammar.txt | |
parent | c3faa433ef2cb864764320adcb3c980b0fab7c0d (diff) | |
download | dexon-solidity-924f7c62bdcb203f42514d298f15570ff53d2bac.tar.gz dexon-solidity-924f7c62bdcb203f42514d298f15570ff53d2bac.tar.zst dexon-solidity-924f7c62bdcb203f42514d298f15570ff53d2bac.zip |
Initial implementation of Solidity parser finished, not yet tested much.
Diffstat (limited to 'grammar.txt')
-rw-r--r-- | grammar.txt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/grammar.txt b/grammar.txt index 1946325f..c0ab0607 100644 --- a/grammar.txt +++ b/grammar.txt @@ -15,18 +15,21 @@ TypeName = ElementaryTypeName | Identifier | Mapping Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')' Block = '{' Statement* '}' -Statement = IfStatement | WhileStatement | Continue | Break | Return | VariableAssignment | Expression ';' | Block +Statement = IfStatement | WhileStatement | Block | + ( Continue | Break | Return | VariableDefinition | Expression ) ';' IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )? WhileStatement = 'while' '(' Expression ')' Statement Continue = 'continue' ';' Break = 'break' ';' Return = 'return' Expression? ';' -VariableAssignment = VariableDeclaration ( AssignmentOp Expression )? ';' +VariableDefinition = VariableDeclaration ( = Expression )? ';' -Expression = Assignment | UnaryOperation | BinaryOperation | FunctionCall | IndexAccess | MemberAccess | PrimaryExpression +Expression = Assignment | UnaryOperation | BinaryOperation | FunctionCall | IndexAccess | + MemberAccess | PrimaryExpression +// The expression syntax is actually much more complicated Assignment = Expression (AssignmentOp Expression) -FunctionCall = Identifier '(' ( Expression ( ',' Expression )* ) ')' +FunctionCall = Expression '(' ( Expression ( ',' Expression )* ) ')' MemberAccess = Expression '.' Identifier IndexAccess = Expression '[' Expresison ']' -PrimaryExpression = Identifier | NumberLiteral | StringLiteral | '(' Expression ')' +PrimaryExpression = Identifier | NumberLiteral | StringLiteral | ElementaryTypeName | '(' Expression ')' |