Report abuse

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
Number primitive example, '2.3'
String primitive example, "hi"
Tuple primitive example, ['1', "a"]
Operator like operator example, '2' + '2'
Keyword like operator example, println "hello world"
Function like operator example find ["c", ["a", "c", "b"]]
Simple constructor example {type "integer", name "n"}

Input:
{type "type",
name "list"}

{type "virtual binary operator",
name "add",
left "list",
returns "void"}

{type "virtual binary operator",
name "get",
left "list",
right "integer"}

{type "virtual unary operator",
name "get",
argument "list"}

{type "unary operator",
name "concatenate",
argument "[list, list]",
returns "list",
does (
     {type "integer", name "n", value '0'};
     while [(n < size argument[1]), (argument[0] add (argument[1] get n))];
     return argument[0];
)}

{type "binary operator",
name "+=",
left "list,
right "list",
returns "list",
does (concatenate [left, right])}

{type "type",
name "linked list",
parent "list",
adjectives ["of"],
types {
     type "type",
     name "node",
     members [["node, "next"], ["node, "previous"]
}
members [["node", "head"] ["node", "tail"]]}

{type "linked list", of "integer", name "samplelist"}

samplelist add '23'

print samplelist

Output:
Compiler error, operator "list add *" is virtual.

If you were to define a "linked list add *" operator then it would work.