From b20a126768eb88f0ebd6e46b8a8358e75f48becd Mon Sep 17 00:00:00 2001 From: Nicolas Abril Date: Wed, 5 Jun 2024 17:47:03 +0200 Subject: [PATCH] Add tree syntax to syntax.md --- docs/syntax.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/syntax.md b/docs/syntax.md index dbfbd86c..fff0dddb 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -622,6 +622,18 @@ A List literal is surrounded by `[` `]`. The elements must be separated by `,`. It is desugared to constructor calls of the built-in type List, `List/cons(head, ~tail)` and `List/nil` . +### Tree Literals + +```python +![![1, 2], ![3, 4]] +``` + +The Tree literals `![]` and `!` are used to create values of the built-in type `Tree`. + +`![a b]` is equivalent to `Tree/Node(a, b)`. + +`!x` is equivalent to `Tree/Leaf(x)`. + ### Map Literals ```python @@ -1131,6 +1143,18 @@ The syntax above is desugared to: Using `,` is optional. +### Tree Literals + +```python +![![1, 2], ![3, 4]] +``` + +The Tree literals `![]` and `!` are used to create values of the built-in type `Tree`. + +`![a b]` is equivalent to `Tree/Node(a, b)`. + +`!x` is equivalent to `Tree/Leaf(x)`. + ### Nat Literal ```rust