You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/plutus/syntax.md
+14-10Lines changed: 14 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,33 @@
1
1
# Syntax
2
2
3
-
The following listing shows the syntax of Plutus.
3
+
The following listing shows the concrete syntax of Plutus.
4
4
The corresponding Haskell definition can be found in [UntypedPlutusCore.Core.Type](https://plutus.cardano.intersectmbo.org/haddock/latest/plutus-core/UntypedPlutusCore-Core-Type.html#t:Term).
5
5
6
6
```text
7
7
𝐿, 𝑀, 𝑁 ∈ Term ::= 𝑥 variable
8
8
| (con T 𝑐) constant 𝑐 with type T
9
-
| (builtin 𝑏) builtin
9
+
| (builtin 𝑏) built-in
10
10
| (lam 𝑥 𝑀) lambda abstraction
11
11
| [𝑀 𝑁] application
12
12
| (delay 𝑀) delayed execution of a term
13
13
| (force 𝑀) force execution of a term
14
-
| (constr 𝑘 𝑀₀ … 𝑀ₘ₋₁) constructor with tag 𝑘 and 𝑚 arguments
15
-
| (case 𝑀 𝑁₀ … 𝑁ₘ₋₁) case analysis with 𝑚 alternatives
16
-
| (error) error
14
+
| (constr 𝑘 𝑀₁ … 𝑀ₘ) constructor with tag 𝑘 and 𝑚 arguments (𝑚 ≥ 0).
15
+
Available since 1.1.0
16
+
| (case 𝑀 𝑁₁ … 𝑁ₘ) case analysis with 𝑚 alternatives (𝑚 ≥ 0).
17
+
Available since 1.1.0
18
+
| (error) error
17
19
18
20
𝑃 ∈ Program ::= (program 𝑣 𝑀) versioned program
19
21
```
20
22
21
-
Plutus (Untyped Plutus Core) is untyped in the sense that variables don't have type tags, and the same variable can have different types during evaluation.
23
+
Plutus (Untyped Plutus Core) is untyped in the sense that variables don't have type tags.
22
24
Constants, however, do carry type tags.
23
-
A constant must be of a builtin type.
24
-
Builtin types and functions are listed in [Builtin Types and Functions](./builtin.md).
25
+
A constant must be of a built-in type.
26
+
Built-in types and functions are listed in [Built-in Types and Functions](./builtin.md).
25
27
26
28
## Version Numbers
27
29
28
-
The 𝑣 in a program is the _Plutus Core language version_.
30
+
The 𝑣 in a program is the _Plutus Core language version_, in the form of `x.y.z`.
29
31
This is distinct from the Plutus ledger language version.
30
32
For a detailed explanation, see [Different Notions of Version](https://plutus.cardano.intersectmbo.org/docs/essential-concepts/versions).
31
33
@@ -44,9 +46,11 @@ The Haskell definition uses `Word64` for the tag.
44
46
## de Bruijn Indices
45
47
46
48
Variable `𝑥` in the above listing can be either textual strings or de Bruijn indices.
47
-
de Bruijn indices are used in serialized scripts.
49
+
De Bruijn indices are used in serialized scripts.
48
50
It therefore makes the most sense for a CEK machine implementation to use de Bruijn indices.
49
51
52
+
When using de Bruijn indices, the binder `𝑥` in `(lam 𝑥 𝑀)` is irrelevant, and any number can be used.
53
+
50
54
## The `data` Type
51
55
52
56
We provide a built-in type, `data`, which permits the encoding of simple data structures
0 commit comments