tlang/source/tlang/compiler/codegen/emit/core.d

36 lines
776 B
D
Raw Normal View History

2021-11-02 08:41:03 +00:00
module compiler.codegen.emit.core;
2021-06-01 14:18:09 +01:00
import compiler.symbols.data;
2021-11-02 08:41:03 +00:00
import compiler.typecheck.core;
import std.container.slist : SList;
import compiler.codegen.instruction;
import std.stdio;
import std.file;
2021-06-01 14:18:09 +01:00
/**
* TODO: Perhaps have an interface that can emit(Context/Parent, Statement)
*/
/* TODO: Module linking (general overhaul required) */
2021-11-02 08:41:03 +00:00
public abstract class CodeEmitter
2021-06-01 14:18:09 +01:00
{
protected TypeChecker typeChecker;
2021-11-02 08:41:03 +00:00
/**
* The code queue
*/
protected SList!(Instruction) codeQueue;
alias instructions = codeQueue;
protected File file;
this(TypeChecker typeChecker, File file)
2021-06-01 14:18:09 +01:00
{
2021-11-02 08:41:03 +00:00
this.typeChecker = typeChecker;
codeQueue = typeChecker.getCodeQueue();
this.file = file;
2021-06-01 14:18:09 +01:00
}
2021-06-01 14:24:13 +01:00
2021-11-02 08:41:03 +00:00
public abstract void emit();
2021-06-01 14:18:09 +01:00
}