Update Sophia syntax docs to include missing information about existing syntax #896

Merged
ghallak merged 9 commits from ghallak/docs-update into master 2022-08-04 05:25:42 +09:00
Showing only changes of commit 6ff8463db4 - Show all commits

View File

@ -91,7 +91,8 @@ A Sophia file consists of a sequence of *declarations* in a layout block.
```c ```c
File ::= Block(TopDecl) File ::= Block(TopDecl)
TopDecl ::= ['payable'] 'contract' Con '=' Block(Decl) TopDecl ::= ['payable'] ['main'] 'contract' Con '=' Block(Decl)
| 'contract' 'interface' Con '=' Block(Decl)
| 'namespace' Con '=' Block(Decl) | 'namespace' Con '=' Block(Decl)
| '@compiler' PragmaOp Version | '@compiler' PragmaOp Version
| 'include' String | 'include' String
@ -103,6 +104,9 @@ Decl ::= 'type' Id ['(' TVar* ')'] '=' TypeAlias
FunDecl ::= Id ':' Type // Type signature FunDecl ::= Id ':' Type // Type signature
| Id Args [':' Type] '=' Block(Stmt) // Definition | Id Args [':' Type] '=' Block(Stmt) // Definition
| Id Args [':' Type] Block(GuardedDef) // Guarded definitions
GuardedDef = '|' Sep(Expr, ',') '=' Block(Stmt)
PragmaOp ::= '<' | '=<' | '==' | '>=' | '>' PragmaOp ::= '<' | '=<' | '==' | '>=' | '>'
Version ::= Sep1(Int, '.') Version ::= Sep1(Int, '.')