comparison trunk/src/dil/semantic/Interpreter.d @ 687:f14cd41fc87d

Added new module dil.semantic.Interpreter.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Tue, 22 Jan 2008 14:00:08 +0100
parents
children 276e2866f5fd
comparison
equal deleted inserted replaced
686:e8c09d13f2a5 687:f14cd41fc87d
1 /++
2 Author: Aziz Köksal
3 License: GPL3
4 +/
5 module dil.semantic.Interpreter;
6
7 import dil.ast.Visitor;
8 import dil.ast.Node,
9 dil.ast.Declarations,
10 dil.ast.Expressions,
11 dil.ast.Statements,
12 dil.ast.Types,
13 dil.ast.Parameters;
14
15 import dil.semantic.Symbol,
16 dil.semantic.Symbols,
17 dil.semantic.Scope,
18 dil.semantic.Types;
19 import dil.Information;
20
21 class Interpreter : Visitor
22 {
23 Scope scop;
24 InfoManager infoMan;
25
26 static class Result : Expression
27 {
28 }
29
30 static const Result CantInterpret;
31
32 static this()
33 {
34 CantInterpret = new Result;
35 CantInterpret.type = Types.Error;
36 }
37
38 this(InfoManager infoMan)
39 {
40 this.infoMan = infoMan;
41 }
42
43 /// Start interpretation.
44 Expression start(Expression e)
45 {
46 return e;
47 }
48
49 bool isImmutable(Expression e)
50 {
51 switch (e.kind)
52 {
53 alias NodeKind NK;
54 case NK.IntExpression, NK.RealExpression,
55 NK.ComplexExpression, NK.CharExpression,
56 NK.BoolExpression, NK.StringExpression:
57 return true;
58 default:
59 return false;
60 }
61 }
62 }