mirror of
https://github.com/irmen/prog8.git
synced 2024-11-20 03:32:05 +00:00
move
This commit is contained in:
parent
f249ccd414
commit
f37a822725
@ -3,7 +3,7 @@ package prog8.code.ast
|
||||
import prog8.code.core.*
|
||||
import java.nio.file.Path
|
||||
|
||||
// New (work-in-progress) simplified AST for the code generator.
|
||||
// New simplified AST for the code generator.
|
||||
|
||||
|
||||
sealed class PtNode(val position: Position) {
|
||||
|
@ -446,13 +446,12 @@ internal fun asmGeneratorFor(program: Program,
|
||||
{
|
||||
if(options.experimentalCodegen) {
|
||||
if (options.compTarget.machine.cpu in arrayOf(CpuType.CPU6502, CpuType.CPU65c02)) {
|
||||
// TODO for now, use the new Intermediary Ast for this experimental codegen:
|
||||
val intermediateAst = IntermediateAstMaker(program).transform()
|
||||
return prog8.codegen.experimental.AsmGen(intermediateAst, symbolTable, options, errors)
|
||||
}
|
||||
} else {
|
||||
if (options.compTarget.machine.cpu in arrayOf(CpuType.CPU6502, CpuType.CPU65c02))
|
||||
// TODO rewrite 6502 codegen on new Intermediary Ast
|
||||
// TODO rewrite 6502 codegen on new Intermediary Ast or on new Intermediate Representation
|
||||
return prog8.codegen.cpu6502.AsmGen(program, symbolTable, options, errors)
|
||||
if (options.compTarget.name == VMTarget.NAME) {
|
||||
val intermediateAst = IntermediateAstMaker(program).transform()
|
||||
|
@ -1,4 +1,4 @@
|
||||
package prog8.compiler
|
||||
package prog8.compiler.astprocessing
|
||||
|
||||
import com.github.michaelbull.result.Ok
|
||||
import com.github.michaelbull.result.Result
|
||||
@ -12,11 +12,16 @@ import prog8.code.ast.*
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.core.SourceCode
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
import prog8.compiler.builtinFunctionReturnType
|
||||
import java.io.File
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.isRegularFile
|
||||
|
||||
|
||||
/**
|
||||
* Convert 'old' compiler-AST into the 'new' simplified AST with baked types.
|
||||
*/
|
||||
class IntermediateAstMaker(val program: Program) {
|
||||
fun transform(): PtProgram {
|
||||
val ptProgram = PtProgram(
|
@ -7,7 +7,7 @@ import io.kotest.matchers.shouldBe
|
||||
import prog8.code.ast.*
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.IntermediateAstMaker
|
||||
import prog8.compiler.astprocessing.IntermediateAstMaker
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
class TestIntermediateAst: FunSpec({
|
||||
|
@ -6,6 +6,7 @@ For next release
|
||||
- vm: intermediate code: don't flatten everything. Instead, as a new intermediary step,
|
||||
convert the new Ast into *structured* intermediary code.
|
||||
Basically keep the blocks and subroutines structure, including full subroutine signature information,
|
||||
don't do variable and zeropage allocations yet.
|
||||
|
||||
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user