Differences From Artifact [cf8f245149fce4dc]:
- File
polemy/ast.d
- 2010-11-23 07:42:13 - part of checkin [6ac127ddd0] on branch trunk - new evaluator (user: kinaba) [annotate]
To Artifact [f7a981003352ec6b]:
- File
polemy/ast.d
- 2010-11-23 09:36:27 - part of checkin [b97bd4f713] on branch trunk - automatic AST to table encoder (user: kinaba) [annotate]
9 9 import polemy.failure;
10 10 import polemy.layer;
11 11
12 12 ///
13 13 abstract class AST
14 14 {
15 15 LexPosition pos;
16 +
16 17 mixin SimpleConstructor;
17 - mixin SimplePatternMatch;
18 18 }
19 19
20 20 ///
21 21 class Int : AST
22 22 {
23 23 BigInt data;
24 +
24 25 mixin SimpleClass;
25 26 this(LexPosition pos, int n) {super(pos); data = n;}
26 27 this(LexPosition pos, long n) {super(pos); data = n;}
27 28 this(LexPosition pos, BigInt n) {super(pos); data = n;}
28 29 this(LexPosition pos, string n) {super(pos); data = BigInt(n);}
29 30 }
30 31
31 32 ///
32 33 class Str : AST
33 34 {
34 35 string data;
36 +
35 37 mixin SimpleClass;
36 38 }
37 39
38 40 ///
39 41 class Var : AST
40 42 {
41 43 string name;
44 +
42 45 mixin SimpleClass;
43 46 }
44 47
45 48 ///
46 49 class Lay : AST
47 50 {
48 51 Layer layer;
49 52 AST expr;
53 +
50 54 mixin SimpleClass;
51 55 }
52 56
53 57 ///
54 58 class Let : AST
55 59 {
56 60 string name;
57 61 Layer layer;
58 62 AST init;
59 63 AST expr;
64 +
60 65 mixin SimpleClass;
61 66 }
62 67
63 68 ///
64 69 class App : AST
65 70 {
66 71 AST fun;
67 72 AST[] args;
68 - this(LexPosition pos, AST fun, AST[] args...)
69 - { super(pos); this.fun=fun; this.args=args.dup; }
73 +
70 74 mixin SimpleClass;
75 + this(LexPosition pos, AST fun, AST[] args...) { super(pos); this.fun=fun; this.args=args.dup; }
71 76 }
72 77
73 78 ///
74 79 class Parameter
75 80 {
76 81 string name;
77 82 Layer[] layers;
83 +
78 84 mixin SimpleClass;
79 85 }
80 86
81 87 ///
82 88 class Fun : AST
83 89 {
84 90 Parameter[] params;
85 91 AST funbody;
92 +
86 93 mixin SimpleClass;
87 94 }
88 95
89 96 /// Handy Generator for AST nodes. To use this, mixin EasyAst;
90 97
91 98 /*mixin*/
92 99 template EasyAST()