aboutsummaryrefslogtreecommitdiff
path: root/notes/fields_data.txt
blob: 58c8f450de4e457649487fe4403408716b242de1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

Fields/Data
===========

How to represent fields/data?

1. At top of file, without a keyword?
    - could use `if` keyword for unions
2. At top of file, with a keyword?
    - could use `if` keyword for unions
3. At top of file, within a block?
    - can handle unions easilly

What should the keyword be?
* data
* fields
* state

See also `union_sum_types.txt`


Syntax test
-----------

At top of file, without a keyword. With `if` per line.

    int line
    int column
    Expr operand  if UnaryExpr or BinaryExpr
    Expr operand2 if BinaryExpr
    String value  if StringLiteral
    uint64 value  if IntegerLiteral
    bool is_neg   if IntegerLiteral

At top of file, without a keyword. With sections.

    int line
    int column
    only UnaryExpr
        Expr operand
    only BinaryExpr
        Expr operand1
        Expr operand2
    only StringLiteral
        String value
    only IntegerLiteral
        uint64 value
        bool is_neg

At top of file, with a keyword. With `if` per line.

    data int line
    data int column
    data Expr operand  if UnaryExpr or BinaryExpr
    data Expr operand2 if BinaryExpr
    data String value  if StringLiteral
    data uint64 value  if IntegerLiteral
    data bool is_neg   if IntegerLiteral

At top of file, within a block?

    data
        int line
        int column
    only UnaryExpr
        Expr operand
    only BinaryExpr
        Expr operand1
        Expr operand2
    only StringLiteral
        String value
    only IntegerLiteral
        uint64 value
        bool is_neg
    end