diff --git a/source/tlang/compiler/codegen/dgen.d b/source/tlang/compiler/codegen/dgen.d new file mode 100644 index 0000000..3df0332 --- /dev/null +++ b/source/tlang/compiler/codegen/dgen.d @@ -0,0 +1,35 @@ +module compiler.codegen.dgen; + +import compiler.symbols.data; +import compiler.codegen.core; +import gogga; + +/** +* This is only for testing, we will definately be using LLVM +* as we want control and no dmd runtime +*/ +public class DCodeGenerator : CodeGenerator +{ + this(Module modulle) + { + super(modulle); + } + + public void build() + { + Statement[] statements = modulle.getStatements(); + + foreach(Statement statement; statements) + { + /* Only for emiitables */ + Emittable emitter = cast(Emittable)statement; + + if(emitter) + { + string emittedCode = emitter.emit(); + gprintln("Emitted: "~emittedCode); + } + + } + } +} \ No newline at end of file diff --git a/source/tlang/compiler/compiler.d b/source/tlang/compiler/compiler.d index 4c20e97..f0e06de 100644 --- a/source/tlang/compiler/compiler.d +++ b/source/tlang/compiler/compiler.d @@ -62,6 +62,9 @@ void beginCompilation(string[] sourceFiles) { gprintln(e.msg, DebugType.ERROR); } + + import compiler.codegen.core; + CodeGenerator codegen = new CodeGenerator(modulle); // typeChecker.check(); }