annotate ast/Exp.d @ 195:4e1a7265d620

Made a BuildTypes pass, to give all exp's a type.
author Anders Johnsen <skabet@gmail.com>
date Tue, 29 Jul 2008 15:50:24 +0200
parents 08f68d684047
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
1 module ast.Exp;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
2
129
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
3 import tango.text.Util,
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
4 Integer = tango.text.convert.Integer;
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
5 import tango.io.Stdout;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
6
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
7 import ast.Decl,
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
8 ast.Stmt;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
9
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
10 import lexer.Token;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
11
92
771ac63898e2 A few better parser errors plus renaming most of the sema classes to match that they do now. Some have changes a lot.
Anders Johnsen <skabet@gmail.com>
parents: 88
diff changeset
12 import sema.Scope,
129
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
13 sema.Symbol,
58
fc62c5296a1c Add types to our Exp
Anders Halager <halager@gmail.com>
parents: 56
diff changeset
14 sema.DType;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
15
119
c0b531362ca6 Non compileing commit. Work on floating points and casts
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
16 import basic.LiteralParsing;
c0b531362ca6 Non compileing commit. Work on floating points and casts
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
17
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
18 enum ExpType
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
19 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
20 Binary,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
21 Negate,
78
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
22 Deref,
176
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
23 AddressOfExp,
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
24 IntegerLit,
55
79cb0afafabe Now structs are somewhat useable to use.
Anders Johnsen <skabet@gmail.com>
parents: 48
diff changeset
25 MemberReference,
83
9e90694f5da0 Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents: 81
diff changeset
26 Index,
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
27 Identifier,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
28 AssignExp,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
29 CallExp,
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
30 CastExp,
104
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
31 StringExp,
158
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
32 NewExp,
194
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
33 NullExp,
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
34 ArrayLiteralExp,
172
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
35
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
36 IdentifierTypeExp,
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
37 ArrayTypeExp,
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
38 StaticArrayTypeExp,
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
39 PointerTypeExp,
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
40 FunctionTypeExp,
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
41 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
42
107
189c049cbfcc Cleanup of codegen, better support for operators a few bugfixes
Anders Halager <halager@gmail.com>
parents: 98
diff changeset
43 abstract class Exp
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
44 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
45 this(ExpType expType, SLoc loc)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
46 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
47 this.expType = expType;
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
48 this.loc = loc;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
49 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
50
129
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
51 /**
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
52 Get the fully qualified name for the expression (if it can be resolved to
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
53 one) - otherwise null is returned
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
54 **/
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
55 char[] getFQN() { return null; }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
56
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
57 /// The same as getFQN, except that the name is mangled
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
58 char[] getMangledFQN() { return null; }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
59
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
60 /**
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
61 Try to get the symbol the expression represents.
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
62
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
63 Returns null for most expressions as they don't represent any symbol.
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
64 Identifiers and member references can have a sensible value.
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
65 **/
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
66 Symbol getSymbol() { return null; }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
67
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
68 /// Get the type of the expression
195
4e1a7265d620 Made a BuildTypes pass, to give all exp's a type.
Anders Johnsen <skabet@gmail.com>
parents: 194
diff changeset
69 DType type;
58
fc62c5296a1c Add types to our Exp
Anders Halager <halager@gmail.com>
parents: 56
diff changeset
70
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
71 /// Indicates which type the expression is - to avoid a lot of casts
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
72 ExpType expType;
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
73
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
74 /// The environment of the expression
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
75 Scope env;
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
76
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
77 int stmtIndex;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
78
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
79 /**
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
80 The "main" location of the expression.
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
81 What exactly this represents varies but for most things its the start
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
82 while for a binary expression its the operator.
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
83 **/
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
84 SourceLocation loc;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
85
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
86 /// Return the starting location of this expression
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
87 SourceLocation startLoc() { return loc; }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
89 /// Get the full extents of the expression
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
90 SourceRange sourceRange() { return SourceRange(loc, loc + 1); }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
91
107
189c049cbfcc Cleanup of codegen, better support for operators a few bugfixes
Anders Halager <halager@gmail.com>
parents: 98
diff changeset
92 /// Do some simplifications
189c049cbfcc Cleanup of codegen, better support for operators a few bugfixes
Anders Halager <halager@gmail.com>
parents: 98
diff changeset
93 Exp simplify() { return this; }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
94 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
95
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
96 class CallExp : Exp
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
97 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
98 this(Exp exp, Exp[] args)
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
99 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
100 super(ExpType.CallExp, exp.loc);
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
101 this.exp = exp;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
102 this.args = args;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
103 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
104
193
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
105 DType callerType()
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
106 {
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
107 DFunction f = new DFunction(new Identifier("function"));
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
108 f.returnType = type;
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
109 foreach (a ; args)
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
110 f.params ~= a.type;
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
111
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
112 return f;
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
113 }
658178183018 Added error message for the case of calling a function pointer with wrong parameter count.
Anders Johnsen <skabet@gmail.com>
parents: 192
diff changeset
114
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
115 override CallExp simplify()
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
116 {
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
117 foreach (ref arg; args)
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
118 arg = arg.simplify();
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
119 exp = exp.simplify();
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
120 return this;
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
121 }
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
122
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
123 Exp exp;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
124 Exp[] args;
168
7982eb63c0eb Some changes to get function overloading to work. Also class inherit works now - to some extend. needs vtables and all the complex stuff of it.
Anders Johnsen <skabet@gmail.com>
parents: 164
diff changeset
125 Symbol callSym;
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
126 bool sret = false;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
127
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
128 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
129 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
130 SourceRange res = exp.sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
131 if (args.length > 0)
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
132 res = res + args[$ - 1].sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
133 return res;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
134 }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
135 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
136
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
137 class AssignExp : BinaryExp
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
138 {
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
139 this(SLoc op_loc, Operator op, Exp identifier, Exp exp)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
140 {
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
141 super(ExpType.AssignExp, op_loc, op, identifier, exp);
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
142 this.identifier = identifier;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
143 this.exp = exp;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
144 }
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
145
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
146 override AssignExp simplify()
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
147 {
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
148 identifier = identifier.simplify();
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
149 exp = exp.simplify();
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
150
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
151 return this;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
152 }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
153
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
154 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
155 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
156 return identifier.sourceRange + exp.sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
157 }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
158
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
159 Exp identifier;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
160 Exp exp;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
161 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
162
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
163 class BinaryExp : Exp
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
164 {
7
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
165 public enum Operator
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
166 {
48
b6c1dc30ca4b Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents: 44
diff changeset
167 Assign,
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
168 AddAssign,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
169 SubAssign,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
170 MulAssign,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
171 DivAssign,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
172 ModAssign,
48
b6c1dc30ca4b Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents: 44
diff changeset
173
7
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
174 Eq, Ne,
44
495188f9078e Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents: 28
diff changeset
175
10
2f493057cf17 Some support for the rest of the boolean operators
Anders Halager <halager@gmail.com>
parents: 7
diff changeset
176 Lt, Le,
2f493057cf17 Some support for the rest of the boolean operators
Anders Halager <halager@gmail.com>
parents: 7
diff changeset
177 Gt, Ge,
44
495188f9078e Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents: 28
diff changeset
178
7
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
179 Add, Sub,
44
495188f9078e Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents: 28
diff changeset
180 Mul, Div, Mod,
123
6a5f745d351c Parsing <<, >> and >>>.
Anders Johnsen <skabet@gmail.com>
parents: 119
diff changeset
181
6a5f745d351c Parsing <<, >> and >>>.
Anders Johnsen <skabet@gmail.com>
parents: 119
diff changeset
182 LeftShift, RightShift, UnsignedRightShift,
125
d604152de1eb Support shifts and binary logical operators in codegen
Anders Halager <halager@gmail.com>
parents: 123
diff changeset
183
d604152de1eb Support shifts and binary logical operators in codegen
Anders Halager <halager@gmail.com>
parents: 123
diff changeset
184 And, Or, Xor,
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
185 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
186
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
187 char[][] getOp = ["=","+=","-=","*=","/=","%=","==","!=","<","<=",">",">=","+","-","*","/","%","<<",">>",">>>"];
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
188
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
189 this(SLoc op_loc, Operator op, Exp left, Exp right)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
190 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
191 super(ExpType.Binary, op_loc);
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
192 this.op = op;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
193 this.left = left;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
194 this.right = right;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
195 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
196
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
197 protected this(ExpType e, SLoc op_loc, Operator op, Exp left, Exp right)
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
198 {
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
199 super(e, op_loc);
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
200 this.op = op;
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
201 this.left = left;
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
202 this.right = right;
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
203 }
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 125
diff changeset
204
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
205 override SLoc startLoc() { return left.startLoc(); }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
206
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
207 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
208 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
209 return left.sourceRange + right.sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
210 }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
211
7
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
212 char[] resultType()
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
213 {
10
2f493057cf17 Some support for the rest of the boolean operators
Anders Halager <halager@gmail.com>
parents: 7
diff changeset
214 if (op >= Operator.Eq && op <= Operator.Ge)
7
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
215 return "bool";
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
216 return null;
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
217 }
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
218
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
219 override BinaryExp simplify()
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
220 {
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
221 left = left.simplify();
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
222 right = right.simplify();
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
223 return this;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
224 }
7
2ce5209f1954 Starting to work on bool support, for now == works
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
225
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
226 Operator op;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
227 Exp left, right;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
228 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
229
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
230 class NegateExp : Exp
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
231 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
232 this(SLoc op, Exp exp)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
233 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
234 super(ExpType.Negate, op);
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
235 this.exp = exp;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
236 }
78
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
237
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
238 override NegateExp simplify()
78
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
239 {
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
240 exp = exp.simplify();
78
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
241 return this;
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
242 }
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
243
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
244 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
245 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
246 return SourceRange(loc) + exp.sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
247 }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
248
78
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
249 public Exp exp;
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
250 }
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
251
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
252 class DerefExp : Exp
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
253 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
254 this(SLoc op, Exp exp)
78
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
255 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
256 super(ExpType.Deref, op);
78
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
257 this.exp = exp;
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
258 }
ad956143dcdc Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents: 72
diff changeset
259
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
260 override DerefExp simplify()
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
261 {
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
262 exp = exp.simplify();
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
263 return this;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
264 }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
265
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
266 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
267 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
268 return SourceRange(loc) + exp.sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
269 }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
270
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
271 public Exp exp;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
272 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
273
176
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
274 class AddressOfExp : Exp
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
275 {
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
276 this(SLoc op, Exp exp)
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
277 {
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
278 super(ExpType.AddressOfExp, op);
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
279 this.exp = exp;
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
280 }
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
281
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
282 override AddressOfExp simplify()
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
283 {
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
284 exp = exp.simplify();
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
285 return this;
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
286 }
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
287
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
288 override SourceRange sourceRange()
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
289 {
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
290 return SourceRange(loc) + exp.sourceRange;
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
291 }
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
292
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
293 public Exp exp;
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
294 }
dc9bf56b7ace Can now use & as a unary operator and take an AddressOf
Anders Johnsen <skabet@gmail.com>
parents: 172
diff changeset
295
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
296 class IntegerLit : Exp
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
297 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
298 this(SLoc loc, char[] t)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
299 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
300 super(ExpType.IntegerLit, loc);
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
301 range = SourceRange(loc, loc + t.length);
111
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 110
diff changeset
302 this.name = t;
67
3fdf20b08a81 Been working on the floating point parsing. Still a bit of work to do here.
Anders Johnsen <skabet@gmail.com>
parents: 65
diff changeset
303 }
3fdf20b08a81 Been working on the floating point parsing. Still a bit of work to do here.
Anders Johnsen <skabet@gmail.com>
parents: 65
diff changeset
304
3fdf20b08a81 Been working on the floating point parsing. Still a bit of work to do here.
Anders Johnsen <skabet@gmail.com>
parents: 65
diff changeset
305 char[] get()
3fdf20b08a81 Been working on the floating point parsing. Still a bit of work to do here.
Anders Johnsen <skabet@gmail.com>
parents: 65
diff changeset
306 {
3fdf20b08a81 Been working on the floating point parsing. Still a bit of work to do here.
Anders Johnsen <skabet@gmail.com>
parents: 65
diff changeset
307 return name;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
308 }
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
309
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
310 override IntegerLit simplify()
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
311 {
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
312 return this;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
313 }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
314
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
315 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
316 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
317 return range;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
318 }
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
319
119
c0b531362ca6 Non compileing commit. Work on floating points and casts
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
320 Number number;
c0b531362ca6 Non compileing commit. Work on floating points and casts
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
321
67
3fdf20b08a81 Been working on the floating point parsing. Still a bit of work to do here.
Anders Johnsen <skabet@gmail.com>
parents: 65
diff changeset
322 char[] name;
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
323 private SourceRange range;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
324 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
325
55
79cb0afafabe Now structs are somewhat useable to use.
Anders Johnsen <skabet@gmail.com>
parents: 48
diff changeset
326 class MemberReference : Exp
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
327 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
328 this(SLoc dot, Exp target, Identifier child)
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
329 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
330 super(ExpType.MemberReference, dot);
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
331 this.target = target;
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
332 this.child = child;
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
333 }
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
334
129
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
335 override char[] getFQN()
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
336 {
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
337 return getSymbol().getFQN();
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
338 }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
339
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
340 override char[] getMangledFQN()
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
341 {
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
342 return target.type.mangle() ~ child.getMangledFQN();
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
343 }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
344
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
345 override Symbol getSymbol()
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
346 {
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
347 auto s = target.getSymbol();
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
348 if (s !is null)
158
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
349 return s.findMembers(child.get)[0];
129
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
350 return null;
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
351 }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
352
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
353 override MemberReference simplify()
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
354 {
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
355 target = target.simplify();
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
356 return this;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
357 }
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
358
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
359 override SLoc startLoc() { return target.startLoc(); }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
360
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
361 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
362 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
363 return target.sourceRange + child.sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
364 }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
365
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
366 Identifier child;
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
367 Exp target;
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
368 }
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
369
83
9e90694f5da0 Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents: 81
diff changeset
370 class IndexExp : Exp
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
371 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
372 this(Exp target, SLoc left_bracket, Exp index, SLoc right_bracket)
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
373 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
374 super(ExpType.Index, target.startLoc);
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
375 this.target = target;
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
376 this.left_bracket = left_bracket;
83
9e90694f5da0 Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents: 81
diff changeset
377 this.index = index;
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
378 this.right_bracket = right_bracket;
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
379 }
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
380
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
381 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
382 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
383 return target.sourceRange + SourceRange(right_bracket);
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
384 }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
385
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
386 override IndexExp simplify()
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
387 {
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
388 target = target.simplify();
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
389 index = index.simplify();
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
390 return this;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
391 }
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
392
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
393 Exp target;
83
9e90694f5da0 Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents: 81
diff changeset
394 Exp index;
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
395 SLoc left_bracket, right_bracket;
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
396 }
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 10
diff changeset
397
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
398 class CastExp : Exp
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
399 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
400 this(SLoc loc, Identifier castType, Exp exp)
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
401 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
402 super(ExpType.CastExp, loc);
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
403 this.castType = castType;
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
404 this.exp = exp;
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
405 }
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
406
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
407 override CastExp simplify()
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
408 {
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
409 castType = castType.simplify();
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
410 exp = exp.simplify();
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
411 return this;
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
412 }
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
413
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
414 override SourceRange sourceRange()
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
415 {
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
416 return SourceRange(loc) + exp.sourceRange;
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
417 }
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
418
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
419 Identifier castType;
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
420 Exp exp;
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
421 }
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 67
diff changeset
422
104
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
423 class StringExp : Exp
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
424 {
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
425 this(SLoc loc, char[] str)
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
426 {
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
427 super(ExpType.StringExp, loc);
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
428 this.str = str;
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
429 }
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
430
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
431 char[] str;
192
fda35d57847e Fixed String parsing, so that they get created with the right type in AST.
Anders Johnsen <skabet@gmail.com>
parents: 185
diff changeset
432 String data;
104
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
433 }
7ff4bc2accf2 Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents: 98
diff changeset
434
158
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
435 class NewExp : Exp
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
436 {
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
437 this(Identifier newType, Exp[] a_args, Exp[] c_args)
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
438 {
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
439 super(ExpType.NewExp, newType.loc);
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
440 this.newType = newType;
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
441 this.a_args = a_args;
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
442 this.c_args = c_args;
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
443 }
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
444
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
445 Exp[] a_args, c_args;
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
446 Identifier newType;
164
ba94fd563548 The symbol for the constructor a "new"-exp is calling is now stored in callSym in NewExp.
Anders Johnsen <skabet@gmail.com>
parents: 162
diff changeset
447 Symbol callSym;
158
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
448 }
57b0b4464a0b Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents: 145
diff changeset
449
194
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
450 class NullExp : Exp
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
451 {
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
452 this(SLoc loc)
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
453 {
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
454 super(ExpType.NullExp, loc);
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
455 }
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
456 }
08f68d684047 Rename some files. Hopefully we can get a more iterative sema pass, that's a lot easier to "get startet with".
Anders Johnsen <skabet@gmail.com>
parents: 193
diff changeset
457
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
458 class Identifier : Exp
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
459 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
460 this(SLoc loc, char[] name)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
461 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
462 super(ExpType.Identifier, loc);
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
463 this.name = name;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
464 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
465
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
466 protected this(ExpType t, SLoc loc)
72
628cb46ab13b First update on the way to Arrays! :)
Anders Johnsen <skabet@gmail.com>
parents: 68
diff changeset
467 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
468 super(t, loc);
72
628cb46ab13b First update on the way to Arrays! :)
Anders Johnsen <skabet@gmail.com>
parents: 68
diff changeset
469 }
628cb46ab13b First update on the way to Arrays! :)
Anders Johnsen <skabet@gmail.com>
parents: 68
diff changeset
470
129
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
471 override char[] getFQN()
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
472 {
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
473 return name;
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
474 }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
475
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
476 override char[] getMangledFQN()
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
477 {
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
478 return Integer.toString(name.length) ~ name;
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
479 }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
480
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
481 override Symbol getSymbol()
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
482 {
195
4e1a7265d620 Made a BuildTypes pass, to give all exp's a type.
Anders Johnsen <skabet@gmail.com>
parents: 194
diff changeset
483 if (!env)
4e1a7265d620 Made a BuildTypes pass, to give all exp's a type.
Anders Johnsen <skabet@gmail.com>
parents: 194
diff changeset
484 return null;
145
a14ac9e5c858 Changes Scope to use char[]'s insted of Identifiers for lookup.
Anders Johnsen <skabet@gmail.com>
parents: 139
diff changeset
485 if (auto decl = env.find(this.get))
168
7982eb63c0eb Some changes to get function overloading to work. Also class inherit works now - to some extend. needs vtables and all the complex stuff of it.
Anders Johnsen <skabet@gmail.com>
parents: 164
diff changeset
486 if(decl.length)
7982eb63c0eb Some changes to get function overloading to work. Also class inherit works now - to some extend. needs vtables and all the complex stuff of it.
Anders Johnsen <skabet@gmail.com>
parents: 164
diff changeset
487 return decl[$-1].sym;
7982eb63c0eb Some changes to get function overloading to work. Also class inherit works now - to some extend. needs vtables and all the complex stuff of it.
Anders Johnsen <skabet@gmail.com>
parents: 164
diff changeset
488 return null;
129
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
489 }
ed815b31479b Added a Symbol
Anders Halager <halager@gmail.com>
parents: 126
diff changeset
490
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
491 this(char[] name)
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
492 {
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 86
diff changeset
493 super(ExpType.Identifier, SLoc.Invalid);
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
494 this.name = name;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
495 }
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
496
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
497 char[] get()
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
498 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
499 return name;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
500 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
501
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
502 hash_t toHash()
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
503 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
504 return jhash(name);
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
505 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
506
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
507 int opCmp(Object o)
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
508 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
509 if (auto id = cast(Identifier)o)
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
510 return typeid(char[]).compare(&name, &id.name);
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
511 return 0;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
512 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
513
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
514 int opEquals(Object o)
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
515 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
516 if (auto id = cast(Identifier)o)
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
517 return typeid(char[]).equals(&name, &id.name);
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
518 return 0;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
519 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
520
139
a22e3663de89 Fixed up our simplify functions
Anders Halager <halager@gmail.com>
parents: 136
diff changeset
521 override Identifier simplify()
56
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
522 {
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
523 return this;
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
524 }
4ae365eff712 Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents: 55
diff changeset
525
179
2a1a635bd531 Changes the way messages can be displayed. Also added a toString to DType's for type printing.
Anders Johnsen <skabet@gmail.com>
parents: 176
diff changeset
526 override SourceRange sourceRange()
2a1a635bd531 Changes the way messages can be displayed. Also added a toString to DType's for type printing.
Anders Johnsen <skabet@gmail.com>
parents: 176
diff changeset
527 {
2a1a635bd531 Changes the way messages can be displayed. Also added a toString to DType's for type printing.
Anders Johnsen <skabet@gmail.com>
parents: 176
diff changeset
528 return SourceRange(loc, loc + name.length);
2a1a635bd531 Changes the way messages can be displayed. Also added a toString to DType's for type printing.
Anders Johnsen <skabet@gmail.com>
parents: 176
diff changeset
529 }
2a1a635bd531 Changes the way messages can be displayed. Also added a toString to DType's for type printing.
Anders Johnsen <skabet@gmail.com>
parents: 176
diff changeset
530
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
531 char[] name;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
532 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
533
172
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
534 class IdentifierTypeExp : Identifier
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
535 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
536 this(SLoc loc, char[] name)
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
537 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
538 super(ExpType.IdentifierTypeExp, loc);
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
539 this.name = name;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
540 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
541
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
542 protected this(ExpType t, SLoc loc)
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
543 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
544 super(t, loc);
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
545 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
546 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
547
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
548 class PointerTypeExp : IdentifierTypeExp
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
549 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
550 this(IdentifierTypeExp pointerOf)
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
551 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
552 super(ExpType.PointerTypeExp, pointerOf.loc);
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
553 this.pointerOf = pointerOf;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
554 this.name = pointerOf.name;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
555 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
556
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
557 Identifier pointerOf;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
558 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
559
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
560 class StaticArrayTypeExp : IdentifierTypeExp
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
561 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
562 this(IdentifierTypeExp arrayOf, IntegerLit size)
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
563 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
564 super(ExpType.StaticArrayTypeExp, arrayOf.loc);
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
565 this.arrayOf = arrayOf;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
566 this.size = Integer.parse(size.get);
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
567 this.name = arrayOf.name;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
568 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
569
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
570 Identifier arrayOf;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
571 int size;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
572 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
573
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
574 class ArrayTypeExp : IdentifierTypeExp
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
575 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
576 this(IdentifierTypeExp arrayOf)
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
577 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
578 super(ExpType.ArrayTypeExp, arrayOf.loc);
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
579 this.arrayOf = arrayOf;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
580 this.name = arrayOf.name;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
581 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
582
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
583 Identifier arrayOf;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
584 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
585
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
586 class FunctionTypeExp : IdentifierTypeExp
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
587 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
588 this(IdentifierTypeExp returnType, VarDecl[] decls)
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
589 {
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
590 super(ExpType.FunctionTypeExp, returnType.loc);
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
591 this.returnType = returnType;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
592 this.decls = decls;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
593 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
594
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
595 VarDecl[] decls;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
596 IdentifierTypeExp returnType;
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
597 }
01c2c49775ef - Changed Parser to be more clean on type parsing.
Anders Johnsen <skabet@gmail.com>
parents: 168
diff changeset
598
185
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
599 class ArrayLiteralExp : Exp
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
600 {
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
601 this(Exp[] exps, SLoc begin, SLoc end)
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
602 {
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
603 super(ExpType.ArrayLiteralExp, begin);
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
604 this.exps = exps;
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
605 this.begin = begin;
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
606 this.end = end;
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
607 }
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
608
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
609 Exp[] exps;
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
610 SLoc begin, end;
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
611 }
7b274cfdc1dc Added support for array literals. Codegen is broken, though.
Anders Johnsen <skabet@gmail.com>
parents: 183
diff changeset
612