Added plumbing for testing D (not final, we shall use LLVM) code generation
parent
274ea767a2
commit
d8f82e17de
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,6 +62,9 @@ void beginCompilation(string[] sourceFiles)
|
||||||
{
|
{
|
||||||
gprintln(e.msg, DebugType.ERROR);
|
gprintln(e.msg, DebugType.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import compiler.codegen.core;
|
||||||
|
CodeGenerator codegen = new CodeGenerator(modulle);
|
||||||
|
|
||||||
// typeChecker.check();
|
// typeChecker.check();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue