reducing dependencies

This commit is contained in:
Irmen de Jong 2022-03-10 21:28:35 +01:00
parent 1e1d1efd90
commit 844ad09464
7 changed files with 14 additions and 27 deletions

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>

View File

@ -25,7 +25,6 @@ compileTestKotlin {
dependencies {
implementation project(':compilerInterfaces')
implementation project(':compilerAst')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
// implementation "org.jetbrains.kotlin:kotlin-reflect"
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.14"

View File

@ -9,7 +9,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<orderEntry type="module" module-name="compilerAst" />
<orderEntry type="module" module-name="compilerInterfaces" />
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
</component>

View File

@ -1,9 +1,9 @@
package prog8.codegen.experimental6502
import prog8.ast.Program
import prog8.compilerinterface.*
import prog8.compilerinterface.intermediate.PtProgram
class AsmGen(internal val program: Program,
class AsmGen(internal val program: PtProgram,
internal val errors: IErrorReporter,
internal val symbolTable: SymbolTable,
internal val options: CompilationOptions): IAssemblyGenerator {
@ -14,10 +14,7 @@ class AsmGen(internal val program: Program,
symbolTable.print()
symbolTable.flat.forEach { println(it) }
// TODO temporary location to do this:
val intermediateAst = IntermediateAstMaker(program).transform()
intermediateAst.print()
program.print()
println("..todo: create assembly code into ${options.outputDir.toAbsolutePath()}..")
return AssemblyProgram("dummy")

View File

@ -398,8 +398,12 @@ internal fun asmGeneratorFor(program: Program,
options: CompilationOptions): IAssemblyGenerator
{
if(options.experimentalCodegen) {
if (options.compTarget.machine.cpu in arrayOf(CpuType.CPU6502, CpuType.CPU65c02))
return prog8.codegen.experimental6502.AsmGen(program, errors, symbolTable, options)
if (options.compTarget.machine.cpu in arrayOf(CpuType.CPU6502, CpuType.CPU65c02)) {
// TODO for now, only use the new Intermediary Ast for this experimental codegen:
val intermediateAst = IntermediateAstMaker(program).transform()
return prog8.codegen.experimental6502.AsmGen(intermediateAst, errors, symbolTable, options)
}
} else {
if (options.compTarget.machine.cpu in arrayOf(CpuType.CPU6502, CpuType.CPU65c02))
return prog8.codegen.cpu6502.AsmGen(program, errors, symbolTable, options)

View File

@ -1,10 +1,10 @@
package prog8.codegen.experimental6502
package prog8.compiler
import prog8.ast.Module
import prog8.ast.Program
import prog8.ast.Module
import prog8.ast.base.FatalAstException
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.ast.expressions.*
import prog8.compilerinterface.VarDeclType
import prog8.compilerinterface.intermediate.*
@ -414,4 +414,4 @@ class IntermediateAstMaker(val srcProgram: Program) {
cast.add(transformExpression(srcCast.expression))
return cast
}
}
}

View File

@ -4,8 +4,8 @@ import io.kotest.assertions.fail
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeGreaterThan
import io.kotest.matchers.shouldBe
import prog8.codegen.experimental6502.IntermediateAstMaker
import prog8.codegen.target.C64Target
import prog8.compiler.IntermediateAstMaker
import prog8.compilerinterface.intermediate.PtVariable
import prog8tests.helpers.compileText