From 6ff8463db442fdee1cf15838d6fcf53f67a62095 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Wed, 3 Aug 2022 00:10:44 +0400 Subject: [PATCH] Add main contract, contract interface, and guards to the docs syntax --- docs/sophia_syntax.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/sophia_syntax.md b/docs/sophia_syntax.md index a55fa60..6cdd9c8 100644 --- a/docs/sophia_syntax.md +++ b/docs/sophia_syntax.md @@ -91,7 +91,8 @@ A Sophia file consists of a sequence of *declarations* in a layout block. ```c 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) | '@compiler' PragmaOp Version | 'include' String @@ -103,6 +104,9 @@ Decl ::= 'type' Id ['(' TVar* ')'] '=' TypeAlias FunDecl ::= Id ':' Type // Type signature | Id Args [':' Type] '=' Block(Stmt) // Definition + | Id Args [':' Type] Block(GuardedDef) // Guarded definitions + +GuardedDef = '|' Sep(Expr, ',') '=' Block(Stmt) PragmaOp ::= '<' | '=<' | '==' | '>=' | '>' Version ::= Sep1(Int, '.')