Grammar Index
This page collects the core productions in one place. Follow nonterminal references to the corresponding topic for meaning, examples, and implementation status.
See Lexical Rules for the notation and Logic Expressions for operator precedence. This index and the topic pages are generated from the same grammar definitions.
Syntax
Specification :=
FunctionContract
| TypeInvariant
| ContractStatement
FunctionContract :=
Precondition
| Postcondition
Precondition :=
# [ precondition ( Condition ) ]
Postcondition :=
# [ postcondition ( ResultPredicate ) ]
ResultPredicate :=
| IDENTIFIER (: Type)? | Condition
TypeInvariant :=
# [ invariant ( Condition ) ]
ContractStatement :=
Assertion
| Assumption
Assertion :=
contract_assert ! ( Condition ) ;
Assumption :=
contract_assume ! ( Condition ) ;
Expr :=
Literal
| Path
| self
| ( Expr )
| UnaryOp Expr
| Expr BinaryOp Expr
| Expr . Field
| Expr [ Expr ]
| Expr ( Arguments? )
| Expr . IDENTIFIER ( Arguments? )
| Quantifier
| Implication
| OldExpression
Arguments :=
Expr (, Expr)* ,?
Field :=
IDENTIFIER
| TUPLE_INDEX
UnaryOp :=
! | - | * | & | & mut
BinaryOp :=
+ | - | * | / | % | << | >> | & | ^ | | | == | != | < | <= | > | >= | && | ||
Quantifier :=
(forall | exists) ! ( QuantifierPredicate )
QuantifierPredicate :=
| IDENTIFIER : Type | Condition
Implication :=
implies ( Condition , Condition ,? )
OldExpression :=
old ( Expr ,? )