diff --git a/docs/sophia_syntax.md b/docs/sophia_syntax.md index d3fb383..b40d24d 100644 --- a/docs/sophia_syntax.md +++ b/docs/sophia_syntax.md @@ -96,11 +96,13 @@ TopDecl ::= ['payable'] ['main'] 'contract' Con '=' Block(Decl) | 'namespace' Con '=' Block(Decl) | '@compiler' PragmaOp Version | 'include' String + | Using Decl ::= 'type' Id ['(' TVar* ')'] '=' TypeAlias | 'record' Id ['(' TVar* ')'] '=' RecordType | 'datatype' Id ['(' TVar* ')'] '=' DataType | (EModifier* 'entrypoint' | FModifier* 'function') Block(FunDecl) + | Using FunDecl ::= Id ':' Type // Type signature | Id Args [':' Type] '=' Block(Stmt) // Definition @@ -108,6 +110,10 @@ FunDecl ::= Id ':' Type // Type signature GuardedDef ::= '|' Sep1(Expr, ',') '=' Block(Stmt) +Using ::= 'using' Con ['as' Con] [UsingParts] +UsingParts ::= 'for' '[' Sep1(Id, ',') ']' + | 'hiding' '[' Sep1(Id, ',') ']' + PragmaOp ::= '<' | '=<' | '==' | '>=' | '>' Version ::= Sep1(Int, '.') @@ -176,6 +182,7 @@ Stmt ::= 'switch' '(' Expr ')' Block(Case) | 'elif' '(' Expr ')' Block(Stmt) | 'else' Block(Stmt) | 'let' LetDef + | Using | Expr LetDef ::= Id Args [':' Type] '=' Block(Stmt) // Function definition