Added plumbing for testing D (not final, we shall use LLVM) code generation

This commit is contained in:
Tristan B. Kildaire 2021-06-01 15:18:21 +02:00
parent 274ea767a2
commit d8f82e17de
2 changed files with 38 additions and 0 deletions

View File

@ -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);
}
}
}
}

View File

@ -62,6 +62,9 @@ void beginCompilation(string[] sourceFiles)
{
gprintln(e.msg, DebugType.ERROR);
}
import compiler.codegen.core;
CodeGenerator codegen = new CodeGenerator(modulle);
// typeChecker.check();
}