2.1. At a glance
Several spellings differ from the mainstream languages Laurel is a target for. They are worth skimming once, because they are the most common source of a first parse error.
Intent | Laurel syntax |
|---|---|
Field read or write |
|
Instance procedure call |
|
Assignment |
|
String concatenation |
|
Eager Boolean and/or |
|
Short-circuit and/or |
|
Implication |
|
Euclidean integer division/remainder |
|
Truncating integer division/remainder |
|
Deterministic unknown |
|
Nondeterministic unknown |
|
Label and jump |
|
Note that ^ is concatenation — not exponentiation, and not exclusive or. Fields use the #
selector rather than the . most languages use, because . is an identifier character in Laurel
and not a selector.
Three structural rules cover most of the rest:
-
A Laurel source file (
.lr.stor.laurel.st) is a bare sequence of declarations. Theprogram Laurel;header belongs only to#stratablocks embedded in Lean, so a standalone file must not carry it. Examples in this guide are shown without it. -
Statements inside a block are separated by
;, and the final one may omit it. A procedure declaration itself always ends in;; acomposite,datatype,constrained,type, oropaquedeclaration does not. -
Tabs are rejected as inter-token whitespace.