Mercurial > projects > dil
changeset 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 | e8c09d13f2a5 |
children | 839c0c61af2b |
files | trunk/src/dil/semantic/Interpreter.d trunk/src/main.d |
diffstat | 2 files changed, 64 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/dil/semantic/Interpreter.d Tue Jan 22 14:00:08 2008 +0100 @@ -0,0 +1,62 @@ +/++ + Author: Aziz Köksal + License: GPL3 ++/ +module dil.semantic.Interpreter; + +import dil.ast.Visitor; +import dil.ast.Node, + dil.ast.Declarations, + dil.ast.Expressions, + dil.ast.Statements, + dil.ast.Types, + dil.ast.Parameters; + +import dil.semantic.Symbol, + dil.semantic.Symbols, + dil.semantic.Scope, + dil.semantic.Types; +import dil.Information; + +class Interpreter : Visitor +{ + Scope scop; + InfoManager infoMan; + + static class Result : Expression + { + } + + static const Result CantInterpret; + + static this() + { + CantInterpret = new Result; + CantInterpret.type = Types.Error; + } + + this(InfoManager infoMan) + { + this.infoMan = infoMan; + } + + /// Start interpretation. + Expression start(Expression e) + { + return e; + } + + bool isImmutable(Expression e) + { + switch (e.kind) + { + alias NodeKind NK; + case NK.IntExpression, NK.RealExpression, + NK.ComplexExpression, NK.CharExpression, + NK.BoolExpression, NK.StringExpression: + return true; + default: + return false; + } + } +}
--- a/trunk/src/main.d Tue Jan 22 13:56:21 2008 +0100 +++ b/trunk/src/main.d Tue Jan 22 14:00:08 2008 +0100 @@ -15,7 +15,8 @@ import dil.semantic.Module; import dil.semantic.Symbols; import dil.semantic.Pass1, - dil.semantic.Pass2; + dil.semantic.Pass2, + dil.semantic.Interpreter; import dil.translator.German; import dil.doc.Doc; import dil.Messages;