Add main contract, contract interface, and guards to the docs syntax

This commit is contained in:
Gaith Hallak 2022-08-03 00:10:44 +04:00
parent 4dbc9858fb
commit 6ff8463db4

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, '.')