# HG changeset patch # User Aziz K?ksal # Date 1201006808 -3600 # Node ID f14cd41fc87d003d9c1b1783032b712ee56d320f # Parent e8c09d13f2a5167b4f727a351229e315f6438293 Added new module dil.semantic.Interpreter. diff -r e8c09d13f2a5 -r f14cd41fc87d trunk/src/dil/semantic/Interpreter.d --- /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; + } + } +} diff -r e8c09d13f2a5 -r f14cd41fc87d trunk/src/main.d --- 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;