doc: add daletl spec, paragraph, line break, unordered list

This commit is contained in:
Artemy Egorov 2024-07-23 13:57:22 +03:00
parent 090052a6e0
commit 1b5b0c342f
4 changed files with 183 additions and 57 deletions

49
specification/daletl.md Normal file
View file

@ -0,0 +1,49 @@
# Daletl specification for Dalet v1.0-preview
## Data format
Daletl must be serialized as [MessagePack](https://github.com/msgpack/msgpack/blob/master/spec.md). All data transfer between server and client is done in this format.
## Data representation
### Root
Daletl root is array of tags. For convenience, we will use the json5 representation of the data.
```json5
[]
```
### Tag
All tags specification is in [Tags](./tags.md).
Each tag is array of 1-3 elements.
1. Tag id
2. Tag body (optional)
3. Tag argument (optional)
Tag id is integer number.
Body can be only a string, null, or an array of tags.
Argument can be number or string.
#### Heading example
```json5
[1, "This is heading", 1]
```
#### Unordered list example
```json5
[
4,
[
[0, "Item 1"],
[0, "Item 2"],
],
]
```

View file

@ -10,7 +10,7 @@
### Daletl
**Daletl** is a low-level language for machines. It is used in data transmission, processing and generation. It is specifically optimized to transfer as little data as possible using json, messagepack[^3] or daletpack[^2].
**Daletl** is a low-level language for machines. It is used in data transmission, processing and generation. It is specifically optimized to transfer as little data as possible using MessagePack.
## Stages
@ -24,10 +24,9 @@ At this stage, only daletl is used. This stage is used by programs for generatio
## Specification
[Tags](./tags/main.md)
[Tags](./tags.md)
[Daletl](./daletl.md)
## References
[^1]: In the first versions only. Detranslation is planned for the future for the sake of devtools.
[^2]: Daletpack is not created and is not used at the moment. It is planned for the future.
[^3]: Daletl can be used through a variety of serialization formats.

131
specification/tags.md Normal file
View file

@ -0,0 +1,131 @@
# Tags specification for Dalet v1.0-preview
## Element
| Property | Description |
| -------- | ----------- |
| id | 0 |
| name | el |
| argument | no |
| body | text, tags |
Most primitive tag. Also used if no tag is specified.
**Daleth example**:
```yaml
el: I am Element
el: { h[1]: I am first level heading }
Element also used if no tag is specified.
```
**Daletl example (json5 representation)**:
```json5
[0, "Dalet"]
```
## Heading
| Property | Description |
| -------- | ------------------- |
| id | 1 |
| name | h |
| argument | int x; 1 <= x <= 10 |
| body | text |
Heading is used for text formatting.
**Daleth example**:
```yaml
h[1]: Dalet
h[2]: Daleth
h[3]: High level
h[2]: Daletl
h[3]: Low level
```
**Daletl example (json5 representation)**:
```json5
[1, "Dalet", 1]
```
## Paragraph
| Property | Description |
| -------- | ----------- |
| id | 2 |
| name | p |
| argument | no |
| body | text, tags |
Paragraph is used for text formatting.
**Daleth example**:
```yaml
p: This is a paragraph
```
**Daletl example (json5 representation)**:
```json5
[2, "This is a paragraph"]
```
## Line break
| Property | Description |
| -------- | ----------- |
| id | 3 |
| name | br |
| argument | no |
| body | no |
Line break is used to insert a line break into the text.
**Daleth example**:
```yaml
br
```
**Daletl example (json5 representation)**:
```json5
[3]
```
## Unordered list
| Property | Description |
| -------- | ----------- |
| id | 4 |
| name | ul |
| argument | no |
| body | tags |
Unordered list is used to create a list. Each list item is a tag.
**Daleth example**:
```yaml
ul: {
Item 1
Item 2,
}
```
**Daletl example (json5 representation)**:
```json5
[
4,
[
[0, "Item 1"],
[0, "Item 2"],
],
]
```

View file

@ -1,53 +0,0 @@
# Tags specification for Dalet v1.0-preview
## Element
| Property | Description |
| -------- | ----------- |
| id | 0 |
| name | element |
| argument | no |
| body | any |
Most primitive tag. Also used if no tag is specified.
Example:
```yaml
element: Dalet
element: { h[1]: Daleth }
Daletl
```
Daletl json5 data representation:
```json5
[0, "Dalet"]
```
## Heading
| Property | Description |
| -------- | ------------------- |
| id | 1 |
| name | h |
| argument | int x; 1 <= x <= 10 |
| body | text |
Heading is used for text formatting.
Example:
```yaml
h[1]: Dalet
h[2]: Daleth
h[3]: High level
h[2]: Daletl
h[3]: Low level
```
Daletl json5 representation:
```json5
[1, "Dalet", 1]
```