mirror of
https://github.com/irmen/prog8.git
synced 2025-02-22 16:29:05 +00:00
consolidating modules
This commit is contained in:
parent
e51c274a18
commit
3961f26635
2
.idea/modules.xml
generated
2
.idea/modules.xml
generated
@ -6,11 +6,9 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/codeCore/codeCore.iml" filepath="$PROJECT_DIR$/codeCore/codeCore.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/codeGenCpu6502/codeGenCpu6502.iml" filepath="$PROJECT_DIR$/codeGenCpu6502/codeGenCpu6502.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/codeGenExperimental6502/codeGenExperimental6502.iml" filepath="$PROJECT_DIR$/codeGenExperimental6502/codeGenExperimental6502.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/codeGenTargets/codeGenTargets.iml" filepath="$PROJECT_DIR$/codeGenTargets/codeGenTargets.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/codeOptimizers/codeOptimizers.iml" filepath="$PROJECT_DIR$/codeOptimizers/codeOptimizers.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/compiler.iml" filepath="$PROJECT_DIR$/compiler/compiler.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compilerAst/compilerAst.iml" filepath="$PROJECT_DIR$/compilerAst/compilerAst.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compilerInterfaces/compilerInterfaces.iml" filepath="$PROJECT_DIR$/compilerInterfaces/compilerInterfaces.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/dbusCompilerService/dbusCompilerService.iml" filepath="$PROJECT_DIR$/dbusCompilerService/dbusCompilerService.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/docs/docs.iml" filepath="$PROJECT_DIR$/docs/docs.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/examples/examples.iml" filepath="$PROJECT_DIR$/examples/examples.iml" />
|
||||
|
@ -1,9 +1,8 @@
|
||||
package prog8.code.core
|
||||
|
||||
import com.github.michaelbull.result.Result
|
||||
import com.github.michaelbull.result.Err
|
||||
import com.github.michaelbull.result.Ok
|
||||
import prog8.code.core.*
|
||||
import com.github.michaelbull.result.Result
|
||||
|
||||
|
||||
class ZeropageAllocationError(message: String) : Exception(message)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package prog8.codegen.target
|
||||
package prog8.code.target
|
||||
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.atari.AtariMachineDefinition
|
||||
import prog8.code.target.atari.AtariMachineDefinition
|
||||
|
||||
|
||||
class AtariTarget: ICompilationTarget, IStringEncoding by Encoder, IMemSizer {
|
@ -1,11 +1,11 @@
|
||||
package prog8.codegen.target
|
||||
package prog8.code.target
|
||||
|
||||
import prog8.code.core.Encoding
|
||||
import prog8.code.core.ICompilationTarget
|
||||
import prog8.code.core.IMemSizer
|
||||
import prog8.code.core.IStringEncoding
|
||||
import prog8.codegen.target.c128.C128MachineDefinition
|
||||
import prog8.codegen.target.cbm.CbmMemorySizer
|
||||
import prog8.code.target.c128.C128MachineDefinition
|
||||
import prog8.code.target.cbm.CbmMemorySizer
|
||||
|
||||
|
||||
class C128Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by CbmMemorySizer {
|
@ -1,11 +1,11 @@
|
||||
package prog8.codegen.target
|
||||
package prog8.code.target
|
||||
|
||||
import prog8.code.core.Encoding
|
||||
import prog8.code.core.ICompilationTarget
|
||||
import prog8.code.core.IMemSizer
|
||||
import prog8.code.core.IStringEncoding
|
||||
import prog8.codegen.target.c64.C64MachineDefinition
|
||||
import prog8.codegen.target.cbm.CbmMemorySizer
|
||||
import prog8.code.target.c64.C64MachineDefinition
|
||||
import prog8.code.target.cbm.CbmMemorySizer
|
||||
|
||||
|
||||
class C64Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by CbmMemorySizer {
|
@ -1,11 +1,11 @@
|
||||
package prog8.codegen.target
|
||||
package prog8.code.target
|
||||
|
||||
import prog8.code.core.Encoding
|
||||
import prog8.code.core.ICompilationTarget
|
||||
import prog8.code.core.IMemSizer
|
||||
import prog8.code.core.IStringEncoding
|
||||
import prog8.codegen.target.cbm.CbmMemorySizer
|
||||
import prog8.codegen.target.cx16.CX16MachineDefinition
|
||||
import prog8.code.target.cbm.CbmMemorySizer
|
||||
import prog8.code.target.cx16.CX16MachineDefinition
|
||||
|
||||
|
||||
class Cx16Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by CbmMemorySizer {
|
@ -1,12 +1,12 @@
|
||||
package prog8.codegen.target
|
||||
package prog8.code.target
|
||||
|
||||
import com.github.michaelbull.result.fold
|
||||
import prog8.code.core.Encoding
|
||||
import prog8.code.core.IStringEncoding
|
||||
import prog8.codegen.target.cbm.AtasciiEncoding
|
||||
import prog8.codegen.target.cbm.IsoEncoding
|
||||
import prog8.codegen.target.cbm.PetsciiEncoding
|
||||
import prog8.code.core.InternalCompilerException
|
||||
import prog8.code.target.cbm.AtasciiEncoding
|
||||
import prog8.code.target.cbm.IsoEncoding
|
||||
import prog8.code.target.cbm.PetsciiEncoding
|
||||
|
||||
|
||||
internal object Encoder: IStringEncoding {
|
@ -1,7 +1,7 @@
|
||||
package prog8.codegen.target.atari
|
||||
package prog8.code.target.atari
|
||||
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.c64.normal6502instructions
|
||||
import prog8.code.target.c64.normal6502instructions
|
||||
import java.nio.file.Path
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package prog8.codegen.target.atari
|
||||
package prog8.code.target.atari
|
||||
|
||||
import prog8.code.core.CompilationOptions
|
||||
import prog8.code.core.ZeropageType
|
||||
import prog8.code.core.InternalCompilerException
|
||||
import prog8.code.core.Zeropage
|
||||
import prog8.code.core.ZeropageType
|
||||
|
||||
class AtariZeropage(options: CompilationOptions) : Zeropage(options) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package prog8.codegen.target.c128
|
||||
package prog8.code.target.c128
|
||||
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.c64.normal6502instructions
|
||||
import prog8.codegen.target.cbm.Mflpt5
|
||||
import prog8.code.target.c64.normal6502instructions
|
||||
import prog8.code.target.cbm.Mflpt5
|
||||
import java.nio.file.Path
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package prog8.codegen.target.c128
|
||||
package prog8.code.target.c128
|
||||
|
||||
import prog8.code.core.CompilationOptions
|
||||
import prog8.code.core.ZeropageType
|
||||
import prog8.code.core.InternalCompilerException
|
||||
import prog8.code.core.Zeropage
|
||||
import prog8.code.core.ZeropageType
|
||||
|
||||
|
||||
class C128Zeropage(options: CompilationOptions) : Zeropage(options) {
|
@ -1,7 +1,7 @@
|
||||
package prog8.codegen.target.c64
|
||||
package prog8.code.target.c64
|
||||
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.cbm.Mflpt5
|
||||
import prog8.code.target.cbm.Mflpt5
|
||||
import java.io.IOException
|
||||
import java.nio.file.Path
|
||||
|
@ -1,9 +1,9 @@
|
||||
package prog8.codegen.target.c64
|
||||
package prog8.code.target.c64
|
||||
|
||||
import prog8.code.core.CompilationOptions
|
||||
import prog8.code.core.ZeropageType
|
||||
import prog8.code.core.InternalCompilerException
|
||||
import prog8.code.core.Zeropage
|
||||
import prog8.code.core.ZeropageType
|
||||
|
||||
|
||||
class C64Zeropage(options: CompilationOptions) : Zeropage(options) {
|
@ -1,4 +1,4 @@
|
||||
package prog8.codegen.target.cbm
|
||||
package prog8.code.target.cbm
|
||||
|
||||
import com.github.michaelbull.result.Ok
|
||||
import com.github.michaelbull.result.Result
|
@ -1,4 +1,4 @@
|
||||
package prog8.codegen.target.cbm
|
||||
package prog8.code.target.cbm
|
||||
|
||||
import prog8.code.core.*
|
||||
|
@ -1,4 +1,4 @@
|
||||
package prog8.codegen.target.cbm
|
||||
package prog8.code.target.cbm
|
||||
|
||||
import com.github.michaelbull.result.Err
|
||||
import com.github.michaelbull.result.Ok
|
@ -1,4 +1,4 @@
|
||||
package prog8.codegen.target.cbm
|
||||
package prog8.code.target.cbm
|
||||
|
||||
import prog8.code.core.IMachineFloat
|
||||
import prog8.code.core.InternalCompilerException
|
@ -1,4 +1,4 @@
|
||||
package prog8.codegen.target.cbm
|
||||
package prog8.code.target.cbm
|
||||
|
||||
import com.github.michaelbull.result.Err
|
||||
import com.github.michaelbull.result.Ok
|
@ -1,7 +1,7 @@
|
||||
package prog8.codegen.target.cx16
|
||||
package prog8.code.target.cx16
|
||||
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.cbm.Mflpt5
|
||||
import prog8.code.target.cbm.Mflpt5
|
||||
import java.nio.file.Path
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package prog8.codegen.target.cx16
|
||||
package prog8.code.target.cx16
|
||||
|
||||
import prog8.code.core.*
|
||||
|
@ -27,7 +27,6 @@ dependencies {
|
||||
implementation project(':codeAst')
|
||||
implementation project(':codeCore')
|
||||
implementation project(':compilerAst')
|
||||
implementation project(':compilerInterfaces')
|
||||
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"
|
||||
|
@ -12,7 +12,6 @@
|
||||
<orderEntry type="module" module-name="codeAst" />
|
||||
<orderEntry type="module" module-name="codeCore" />
|
||||
<orderEntry type="module" module-name="compilerAst" />
|
||||
<orderEntry type="module" module-name="compilerInterfaces" />
|
||||
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -8,7 +8,8 @@ import prog8.ast.statements.*
|
||||
import prog8.code.SymbolTable
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.cpu6502.assignment.*
|
||||
import prog8.compilerinterface.*
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
import prog8.compiler.builtinFunctionReturnType
|
||||
import prog8.parser.SourceCode
|
||||
import java.util.*
|
||||
import kotlin.io.path.Path
|
||||
|
@ -10,7 +10,9 @@ import prog8.ast.statements.DirectMemoryWrite
|
||||
import prog8.ast.statements.Subroutine
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.cpu6502.assignment.*
|
||||
import prog8.compilerinterface.*
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
import prog8.compiler.FSignature
|
||||
import prog8.compiler.builtinFunctionReturnType
|
||||
|
||||
|
||||
internal class BuiltinFunctionsAsmGen(private val program: Program,
|
||||
|
@ -3,8 +3,6 @@ package prog8.codegen.cpu6502
|
||||
import prog8.ast.Program
|
||||
import prog8.ast.expressions.*
|
||||
import prog8.code.core.*
|
||||
import prog8.code.core.AssemblyError
|
||||
import prog8.code.core.CpuType
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
internal class ExpressionsAsmGen(private val program: Program,
|
||||
|
@ -5,12 +5,7 @@ import prog8.ast.Program
|
||||
import prog8.ast.expressions.IdentifierReference
|
||||
import prog8.ast.expressions.RangeExpression
|
||||
import prog8.ast.statements.ForLoop
|
||||
import prog8.code.core.ArrayToElementTypes
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.RegisterOrPair
|
||||
import prog8.code.core.toHex
|
||||
import prog8.code.core.AssemblyError
|
||||
import prog8.code.core.Zeropage
|
||||
import prog8.code.core.*
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
internal class ForLoopsAsmGen(private val program: Program, private val asmgen: AsmGen, private val zeropage: Zeropage) {
|
||||
|
@ -13,7 +13,6 @@ import prog8.codegen.cpu6502.assignment.AsmAssignSource
|
||||
import prog8.codegen.cpu6502.assignment.AsmAssignTarget
|
||||
import prog8.codegen.cpu6502.assignment.AsmAssignment
|
||||
import prog8.codegen.cpu6502.assignment.TargetStorageKind
|
||||
import prog8.code.core.AssemblyError
|
||||
|
||||
|
||||
internal class FunctionCallAsmGen(private val program: Program, private val asmgen: AsmGen) {
|
||||
|
@ -5,7 +5,6 @@ import prog8.ast.expressions.IdentifierReference
|
||||
import prog8.ast.expressions.NumericLiteral
|
||||
import prog8.ast.statements.PostIncrDecr
|
||||
import prog8.code.core.*
|
||||
import prog8.code.core.AssemblyError
|
||||
|
||||
|
||||
internal class PostIncrDecrAsmGen(private val program: Program, private val asmgen: AsmGen) {
|
||||
|
@ -7,7 +7,7 @@ import prog8.code.*
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.cpu6502.assignment.AsmAssignTarget
|
||||
import prog8.codegen.cpu6502.assignment.TargetStorageKind
|
||||
import prog8.compilerinterface.*
|
||||
import prog8.compiler.CallGraph
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import kotlin.math.absoluteValue
|
||||
|
@ -5,7 +5,6 @@ import prog8.ast.expressions.*
|
||||
import prog8.ast.statements.*
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.cpu6502.AsmGen
|
||||
import prog8.code.core.AssemblyError
|
||||
|
||||
|
||||
internal enum class TargetStorageKind {
|
||||
|
@ -6,9 +6,7 @@ import prog8.ast.statements.*
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.cpu6502.AsmGen
|
||||
import prog8.codegen.cpu6502.VariableAllocator
|
||||
import prog8.code.core.AssemblyError
|
||||
import prog8.code.core.CpuType
|
||||
import prog8.compilerinterface.builtinFunctionReturnType
|
||||
import prog8.compiler.builtinFunctionReturnType
|
||||
|
||||
|
||||
internal class AssignmentAsmGen(private val program: Program,
|
||||
|
@ -7,8 +7,6 @@ import prog8.ast.statements.Subroutine
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.cpu6502.AsmGen
|
||||
import prog8.codegen.cpu6502.VariableAllocator
|
||||
import prog8.code.core.AssemblyError
|
||||
import prog8.code.core.CpuType
|
||||
|
||||
|
||||
internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
|
@ -1,45 +0,0 @@
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = javaVersion
|
||||
}
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = javaVersion
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':codeCore')
|
||||
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"
|
||||
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = ["${project.projectDir}/src"]
|
||||
}
|
||||
resources {
|
||||
srcDirs = ["${project.projectDir}/res"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// note: there are no unit tests in this module!
|
@ -1,15 +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" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
|
||||
<orderEntry type="module" module-name="codeCore" />
|
||||
</component>
|
||||
</module>
|
@ -1,2 +0,0 @@
|
||||
Unittests for things in this module are located in the Compiler module instead,
|
||||
for convenience sake, and to not spread the test cases around too much.
|
@ -25,7 +25,6 @@ compileTestKotlin {
|
||||
|
||||
dependencies {
|
||||
implementation project(':codeCore')
|
||||
implementation project(':compilerInterfaces')
|
||||
implementation project(':compilerAst')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
|
@ -11,6 +11,5 @@
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="module" module-name="codeCore" />
|
||||
<orderEntry type="module" module-name="compilerAst" />
|
||||
<orderEntry type="module" module-name="compilerInterfaces" />
|
||||
</component>
|
||||
</module>
|
@ -15,7 +15,6 @@ import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.CompilationOptions
|
||||
import prog8.code.core.DataType
|
||||
import prog8.compilerinterface.isIOAddress
|
||||
|
||||
|
||||
class BinExprSplitter(private val program: Program, private val options: CompilationOptions) : AstWalker() {
|
||||
|
@ -9,8 +9,6 @@ import prog8.ast.statements.*
|
||||
import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.*
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.InternalCompilerException
|
||||
|
||||
// Fix up the literal value's type to match that of the vardecl
|
||||
// (also check range literal operands types before they get expanded into arrays for instance)
|
||||
|
@ -7,9 +7,9 @@ import prog8.ast.statements.*
|
||||
import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.IntegerDatatypes
|
||||
import prog8.code.core.NumericDatatypes
|
||||
import prog8.code.core.IErrorReporter
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.log2
|
||||
import kotlin.math.pow
|
||||
|
@ -7,9 +7,8 @@ import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.ICompilationTarget
|
||||
import prog8.compilerinterface.CallGraph
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.compilerinterface.isIOAddress
|
||||
import prog8.compiler.CallGraph
|
||||
|
||||
|
||||
class UnusedCodeRemover(private val program: Program,
|
||||
|
@ -29,10 +29,8 @@ def prog8version = rootProject.file('compiler/res/version.txt').text.trim()
|
||||
dependencies {
|
||||
implementation project(':codeAst')
|
||||
implementation project(':codeCore')
|
||||
implementation project(':compilerInterfaces')
|
||||
implementation project(':codeOptimizers')
|
||||
implementation project(':compilerAst')
|
||||
implementation project(':codeGenTargets')
|
||||
implementation project(':codeGenCpu6502')
|
||||
implementation project(':codeGenExperimental6502')
|
||||
implementation 'org.antlr:antlr4-runtime:4.9.3'
|
||||
|
@ -19,9 +19,7 @@
|
||||
<orderEntry type="module" module-name="codeCore" />
|
||||
<orderEntry type="module" module-name="codeAst" />
|
||||
<orderEntry type="module" module-name="compilerAst" />
|
||||
<orderEntry type="module" module-name="compilerInterfaces" />
|
||||
<orderEntry type="module" module-name="codeOptimizers" />
|
||||
<orderEntry type="module" module-name="codeGenTargets" />
|
||||
<orderEntry type="module" module-name="codeGenCpu6502" />
|
||||
<orderEntry type="module" module-name="codeGenExperimental6502" />
|
||||
</component>
|
||||
|
@ -3,10 +3,10 @@ package prog8
|
||||
import kotlinx.cli.*
|
||||
import prog8.ast.base.AstException
|
||||
import prog8.code.core.CbmPrgLauncherType
|
||||
import prog8.codegen.target.AtariTarget
|
||||
import prog8.codegen.target.C128Target
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.code.target.AtariTarget
|
||||
import prog8.code.target.C128Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8.compiler.CompilationResult
|
||||
import prog8.compiler.CompilerArguments
|
||||
import prog8.compiler.compileProgram
|
||||
@ -46,7 +46,8 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
|
||||
val asmListfile by cli.option(ArgType.Boolean, fullName = "asmlist", description = "make the assembler produce a listing file as well")
|
||||
val experimentalCodegen by cli.option(ArgType.Boolean, fullName = "expericodegen", description = "use experimental codegen")
|
||||
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}')").default(C64Target.NAME)
|
||||
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}')").default(
|
||||
C64Target.NAME)
|
||||
val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator)
|
||||
val moduleFiles by cli.argument(ArgType.String, fullName = "modules", description = "main module file(s) to compile").multiple(999)
|
||||
|
||||
|
@ -13,12 +13,11 @@ import prog8.ast.statements.VarDecl
|
||||
import prog8.ast.walk.IAstVisitor
|
||||
import prog8.code.SymbolTable
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.AtariTarget
|
||||
import prog8.codegen.target.C128Target
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.code.target.AtariTarget
|
||||
import prog8.code.target.C128Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8.compiler.astprocessing.*
|
||||
import prog8.compilerinterface.*
|
||||
import prog8.optimizer.*
|
||||
import prog8.parser.ParseError
|
||||
import java.nio.file.Path
|
||||
@ -205,7 +204,7 @@ fun parseImports(filepath: Path,
|
||||
|
||||
if (compilerOptions.launcher == CbmPrgLauncherType.BASIC && compilerOptions.output != OutputType.PRG)
|
||||
errors.err("BASIC launcher requires output type PRG", program.toplevelModule.position)
|
||||
if(compilerOptions.launcher == CbmPrgLauncherType.BASIC && compTarget.name==AtariTarget.NAME)
|
||||
if(compilerOptions.launcher == CbmPrgLauncherType.BASIC && compTarget.name== AtariTarget.NAME)
|
||||
errors.err("atari target cannot use CBM BASIC launcher, use NONE", program.toplevelModule.position)
|
||||
|
||||
errors.report()
|
||||
|
@ -1,7 +1,7 @@
|
||||
package prog8.compiler
|
||||
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.Position
|
||||
|
||||
|
||||
internal class ErrorReporter: IErrorReporter {
|
||||
|
@ -6,8 +6,8 @@ import prog8.ast.Program
|
||||
import prog8.ast.base.SyntaxError
|
||||
import prog8.ast.statements.Directive
|
||||
import prog8.ast.statements.DirectiveArg
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.Position
|
||||
import prog8.parser.Prog8Parser
|
||||
import prog8.parser.SourceCode
|
||||
import java.io.File
|
||||
|
@ -7,7 +7,8 @@ import prog8.ast.expressions.*
|
||||
import prog8.ast.statements.*
|
||||
import prog8.ast.walk.IAstVisitor
|
||||
import prog8.code.core.*
|
||||
import prog8.compilerinterface.*
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
import prog8.compiler.builtinFunctionReturnType
|
||||
import java.io.CharConversionException
|
||||
import java.io.File
|
||||
import kotlin.io.path.Path
|
||||
|
@ -9,9 +9,9 @@ import prog8.ast.expressions.StringLiteral
|
||||
import prog8.ast.statements.*
|
||||
import prog8.ast.walk.IAstVisitor
|
||||
import prog8.code.core.ICompilationTarget
|
||||
import prog8.code.core.Position
|
||||
import prog8.compilerinterface.BuiltinFunctions
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.Position
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
|
||||
|
||||
internal class AstIdentifiersChecker(private val errors: IErrorReporter,
|
||||
|
@ -8,7 +8,6 @@ import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.ast.walk.IAstVisitor
|
||||
import prog8.code.core.*
|
||||
import prog8.compilerinterface.*
|
||||
|
||||
internal class BeforeAsmAstChanger(val program: Program,
|
||||
private val options: CompilationOptions,
|
||||
|
@ -8,11 +8,7 @@ import prog8.ast.statements.BuiltinFunctionCallStatement
|
||||
import prog8.ast.statements.FunctionCallStatement
|
||||
import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.ByteDatatypes
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.PassByReferenceDatatypes
|
||||
import prog8.code.core.WordDatatypes
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.*
|
||||
|
||||
|
||||
internal class BeforeAsmTypecastCleaner(val program: Program,
|
||||
|
@ -8,8 +8,8 @@ import prog8.ast.expressions.PrefixExpression
|
||||
import prog8.ast.statements.*
|
||||
import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.Position
|
||||
|
||||
|
||||
private var generatedLabelSequenceNumber: Int = 0
|
||||
|
@ -7,10 +7,9 @@ import prog8.ast.statements.*
|
||||
import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.*
|
||||
import prog8.compilerinterface.BuiltinFunctions
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.codegen.cpu6502.asmsub6502ArgsEvalOrder
|
||||
import prog8.codegen.cpu6502.asmsub6502ArgsHaveRegisterClobberRisk
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
|
||||
internal class StatementReorderer(val program: Program,
|
||||
val errors: IErrorReporter,
|
||||
|
@ -9,7 +9,7 @@ import prog8.ast.statements.*
|
||||
import prog8.ast.walk.AstWalker
|
||||
import prog8.ast.walk.IAstModification
|
||||
import prog8.code.core.*
|
||||
import prog8.compilerinterface.BuiltinFunctions
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
|
||||
|
||||
class TypecastsAdder(val program: Program, val options: CompilationOptions, val errors: IErrorReporter) : AstWalker() {
|
||||
|
@ -9,10 +9,10 @@ import prog8.ast.expressions.TypecastExpression
|
||||
import prog8.ast.statements.*
|
||||
import prog8.ast.walk.IAstVisitor
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.Position
|
||||
import prog8.compilerinterface.BuiltinFunctions
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.compilerinterface.builtinFunctionReturnType
|
||||
import prog8.code.core.Position
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
import prog8.compiler.builtinFunctionReturnType
|
||||
|
||||
internal class VerifyFunctionArgTypes(val program: Program, val errors: IErrorReporter) : IAstVisitor {
|
||||
|
||||
|
@ -11,8 +11,8 @@ import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import prog8.ast.Program
|
||||
import prog8.ast.internedStringsModuleName
|
||||
import prog8.compiler.ModuleImporter
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.compiler.ModuleImporter
|
||||
import prog8.parser.ParseError
|
||||
import prog8.parser.SourceCode
|
||||
import prog8tests.helpers.*
|
||||
|
@ -4,7 +4,7 @@ import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
@ -5,7 +5,7 @@ import io.kotest.matchers.shouldBe
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.NumericDatatypes
|
||||
import prog8.code.core.RegisterOrPair
|
||||
import prog8.compilerinterface.BuiltinFunctions
|
||||
import prog8.compiler.BuiltinFunctions
|
||||
|
||||
class TestBuiltinFunctions: FunSpec({
|
||||
|
||||
|
@ -9,8 +9,8 @@ import io.kotest.matchers.string.shouldContain
|
||||
import prog8.ast.Program
|
||||
import prog8.ast.statements.Block
|
||||
import prog8.ast.statements.Subroutine
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.compilerinterface.CallGraph
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.CallGraph
|
||||
import prog8.parser.Prog8Parser.parseModule
|
||||
import prog8.parser.SourceCode
|
||||
import prog8tests.helpers.*
|
||||
|
@ -11,7 +11,7 @@ import prog8.ast.expressions.NumericLiteral
|
||||
import prog8.ast.statements.VarDeclType
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.Encoding
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
||||
|
@ -3,8 +3,8 @@ package prog8tests
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import prog8.code.core.ICompilationTarget
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8.compiler.CompilationResult
|
||||
import prog8.compiler.CompilerArguments
|
||||
import prog8.compiler.compileProgram
|
||||
|
@ -9,7 +9,7 @@ import prog8.ast.expressions.IdentifierReference
|
||||
import prog8.ast.expressions.StringLiteral
|
||||
import prog8.ast.statements.FunctionCallStatement
|
||||
import prog8.ast.statements.Label
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8tests.helpers.*
|
||||
import kotlin.io.path.name
|
||||
|
||||
|
@ -15,8 +15,8 @@ import prog8.ast.statements.VarDecl
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.Encoding
|
||||
import prog8.code.core.Position
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.cartesianProduct
|
||||
import prog8tests.helpers.compileText
|
||||
@ -218,7 +218,8 @@ class TestCompilerOnRanges: FunSpec({
|
||||
|
||||
test("testForLoopWithRange_str_downto_str") {
|
||||
val errors = ErrorReporterForTests()
|
||||
compileText(Cx16Target(), true, """
|
||||
compileText(
|
||||
Cx16Target(), true, """
|
||||
main {
|
||||
sub start() {
|
||||
ubyte i
|
||||
@ -234,7 +235,8 @@ class TestCompilerOnRanges: FunSpec({
|
||||
}
|
||||
|
||||
test("testForLoopWithIterable_str") {
|
||||
val result = compileText(Cx16Target(), false, """
|
||||
val result = compileText(
|
||||
Cx16Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
ubyte i
|
||||
@ -266,7 +268,8 @@ class TestCompilerOnRanges: FunSpec({
|
||||
}
|
||||
|
||||
test("range with negative step should be constvalue") {
|
||||
val result = compileText(C64Target(), false, """
|
||||
val result = compileText(
|
||||
C64Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
ubyte[] array = 100 to 50 step -2
|
||||
@ -286,7 +289,8 @@ class TestCompilerOnRanges: FunSpec({
|
||||
}
|
||||
|
||||
test("range with start/end variables should be ok") {
|
||||
val result = compileText(C64Target(), false, """
|
||||
val result = compileText(
|
||||
C64Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
byte from = 100
|
||||
@ -305,7 +309,8 @@ class TestCompilerOnRanges: FunSpec({
|
||||
|
||||
|
||||
test("for statement on all possible iterable expressions") {
|
||||
compileText(C64Target(), false, """
|
||||
compileText(
|
||||
C64Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
ubyte xx
|
||||
@ -346,7 +351,8 @@ class TestCompilerOnRanges: FunSpec({
|
||||
}
|
||||
|
||||
test("if containment check on all possible iterable expressions") {
|
||||
compileText(C64Target(), false, """
|
||||
compileText(
|
||||
C64Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
ubyte xx
|
||||
@ -407,7 +413,8 @@ class TestCompilerOnRanges: FunSpec({
|
||||
}
|
||||
|
||||
test("containment check in expressions") {
|
||||
compileText(C64Target(), false, """
|
||||
compileText(
|
||||
C64Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
ubyte xx
|
||||
|
@ -2,7 +2,7 @@ package prog8tests
|
||||
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8.compiler.CompilationResult
|
||||
import prog8.compiler.CompilerArguments
|
||||
import prog8.compiler.compileProgram
|
||||
|
@ -6,7 +6,7 @@ import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.string.shouldStartWith
|
||||
import prog8.ast.internedStringsModuleName
|
||||
import prog8.code.core.ZeropageType
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.determineCompilationOptions
|
||||
import prog8.compiler.parseImports
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
@ -17,7 +17,8 @@ import prog8tests.helpers.outputDir
|
||||
class TestImportedModulesOrderAndOptions: FunSpec({
|
||||
|
||||
test("testImportedModuleOrderAndMainModuleCorrect") {
|
||||
val result = compileText(C64Target(), false, """
|
||||
val result = compileText(
|
||||
C64Target(), false, """
|
||||
%import textio
|
||||
%import floats
|
||||
|
||||
@ -48,7 +49,8 @@ main {
|
||||
}
|
||||
|
||||
test("testCompilationOptionsCorrectFromMain") {
|
||||
val result = compileText(C64Target(), false, """
|
||||
val result = compileText(
|
||||
C64Target(), false, """
|
||||
%import textio
|
||||
%import floats
|
||||
%zeropage dontuse
|
||||
|
@ -13,9 +13,8 @@ import prog8.ast.statements.*
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.core.ZeropageWish
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.printProgram
|
||||
import prog8.compilerinterface.isIOAddress
|
||||
import prog8.parser.SourceCode
|
||||
import prog8tests.helpers.DummyFunctions
|
||||
import prog8tests.helpers.DummyMemsizer
|
||||
@ -227,7 +226,8 @@ class TestMemory: FunSpec({
|
||||
|
||||
|
||||
test("memory() with spaces in name works") {
|
||||
compileText(C64Target(), false, """
|
||||
compileText(
|
||||
C64Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
uword @shared mem = memory("a b c", 100, $100)
|
||||
@ -237,7 +237,8 @@ class TestMemory: FunSpec({
|
||||
}
|
||||
|
||||
test("memory() with invalid argument") {
|
||||
compileText(C64Target(), false, """
|
||||
compileText(
|
||||
C64Target(), false, """
|
||||
main {
|
||||
sub start() {
|
||||
uword @shared mem1 = memory("abc", 100, -2)
|
||||
|
@ -6,10 +6,10 @@ import io.kotest.matchers.doubles.plusOrMinus
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import prog8.code.core.toHex
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.cbm.Mflpt5
|
||||
import prog8.code.core.InternalCompilerException
|
||||
import prog8.code.core.toHex
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.cbm.Mflpt5
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
@ -14,7 +14,7 @@ import prog8.ast.Program
|
||||
import prog8.ast.expressions.*
|
||||
import prog8.ast.statements.*
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.astprocessing.processAstBeforeAsmGeneration
|
||||
import prog8.compiler.printProgram
|
||||
import prog8tests.helpers.*
|
||||
|
@ -13,7 +13,7 @@ import prog8.ast.statements.Pipe
|
||||
import prog8.ast.statements.VarDecl
|
||||
import prog8.code.core.DataType
|
||||
import prog8.code.core.Position
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.astprocessing.AstPreprocessor
|
||||
import prog8.parser.Prog8Parser.parseModule
|
||||
import prog8.parser.SourceCode
|
||||
|
@ -11,7 +11,7 @@ import prog8.ast.GlobalNamespace
|
||||
import prog8.ast.ParentSentinel
|
||||
import prog8.ast.expressions.NumericLiteral
|
||||
import prog8.ast.statements.*
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
@ -8,11 +8,11 @@ import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.codegen.target.cbm.AtasciiEncoding
|
||||
import prog8.codegen.target.cbm.IsoEncoding
|
||||
import prog8.codegen.target.cbm.PetsciiEncoding
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8.code.target.cbm.AtasciiEncoding
|
||||
import prog8.code.target.cbm.IsoEncoding
|
||||
import prog8.code.target.cbm.PetsciiEncoding
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
@ -12,7 +12,7 @@ import prog8.ast.expressions.IdentifierReference
|
||||
import prog8.ast.expressions.NumericLiteral
|
||||
import prog8.ast.statements.*
|
||||
import prog8.code.core.DataType
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
@ -4,7 +4,7 @@ import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.printProgram
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.compileText
|
||||
|
@ -13,11 +13,10 @@ import io.kotest.matchers.comparables.shouldBeGreaterThan
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.Cx16Target
|
||||
import prog8.codegen.target.c64.C64Zeropage
|
||||
import prog8.codegen.target.cx16.CX16Zeropage
|
||||
import prog8.compilerinterface.*
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8.code.target.c64.C64Zeropage
|
||||
import prog8.code.target.cx16.CX16Zeropage
|
||||
import prog8tests.helpers.DummyCompilationTarget
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
|
||||
|
@ -5,7 +5,7 @@ import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.ints.shouldBeGreaterThan
|
||||
import io.kotest.matchers.shouldBe
|
||||
import prog8.code.ast.PtVariable
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.compiler.IntermediateAstMaker
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
@ -21,8 +21,8 @@ import prog8.code.core.DataType
|
||||
import prog8.code.core.Encoding
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.core.ZeropageWish
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.cbm.PetsciiEncoding
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.cbm.PetsciiEncoding
|
||||
import prog8.parser.ParseError
|
||||
import prog8.parser.Prog8Parser.parseModule
|
||||
import prog8.parser.SourceCode
|
||||
|
@ -5,7 +5,7 @@ import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import prog8.ast.statements.InlineAssembly
|
||||
import prog8.code.core.Position
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
class TestVarious: FunSpec({
|
||||
|
@ -9,9 +9,9 @@ import prog8.ast.expressions.IdentifierReference
|
||||
import prog8.ast.expressions.NumericLiteral
|
||||
import prog8.ast.statements.*
|
||||
import prog8.code.core.*
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.c64.C64Zeropage
|
||||
import prog8.codegen.cpu6502.AsmGen
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.c64.C64Zeropage
|
||||
import prog8.compiler.astprocessing.SymbolTableMaker
|
||||
import prog8.parser.SourceCode
|
||||
import prog8tests.helpers.DummyFunctions
|
||||
|
@ -2,7 +2,7 @@ package prog8tests.codegeneration
|
||||
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8tests.helpers.compileText
|
||||
|
||||
|
||||
|
@ -4,9 +4,7 @@ import prog8.ast.IBuiltinFunctions
|
||||
import prog8.ast.expressions.Expression
|
||||
import prog8.ast.expressions.InferredTypes
|
||||
import prog8.ast.expressions.NumericLiteral
|
||||
import prog8.ast.statements.Subroutine
|
||||
import prog8.code.core.*
|
||||
import prog8.code.core.IMachineDefinition
|
||||
|
||||
|
||||
internal object DummyFunctions : IBuiltinFunctions {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package prog8tests.helpers
|
||||
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.Position
|
||||
|
||||
internal class ErrorReporterForTests(private val throwExceptionAtReportIfErrors: Boolean=true, private val keepMessagesAfterReporting: Boolean=false):
|
||||
IErrorReporter {
|
||||
|
@ -2,14 +2,13 @@ package prog8tests.helpers
|
||||
|
||||
import prog8.ast.Program
|
||||
import prog8.code.core.*
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.c64.C64Zeropage
|
||||
import prog8.codegen.cpu6502.AsmGen
|
||||
import prog8.codegen.target.C64Target
|
||||
import prog8.codegen.target.c64.C64Zeropage
|
||||
import prog8.compiler.CompilationResult
|
||||
import prog8.compiler.CompilerArguments
|
||||
import prog8.compiler.astprocessing.SymbolTableMaker
|
||||
import prog8.compiler.compileProgram
|
||||
import prog8.compilerinterface.*
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.name
|
||||
|
||||
|
@ -424,6 +424,7 @@ data class AssignTarget(var identifier: IdentifierReference?,
|
||||
|
||||
fun accept(visitor: IAstVisitor) = visitor.visit(this)
|
||||
fun accept(visitor: AstWalker, parent: Node) = visitor.visit(this, parent)
|
||||
override fun copy() = AssignTarget(identifier?.copy(), arrayindexed?.copy(), memoryAddress?.copy(), position)
|
||||
|
||||
fun inferType(program: Program): InferredTypes.InferredType {
|
||||
if (identifier != null) {
|
||||
@ -491,7 +492,49 @@ data class AssignTarget(var identifier: IdentifierReference?,
|
||||
return false
|
||||
}
|
||||
|
||||
override fun copy() = AssignTarget(identifier?.copy(), arrayindexed?.copy(), memoryAddress?.copy(), position)
|
||||
fun isIOAddress(machine: IMachineDefinition): Boolean {
|
||||
val memAddr = memoryAddress
|
||||
val arrayIdx = arrayindexed
|
||||
val ident = identifier
|
||||
when {
|
||||
memAddr != null -> {
|
||||
val addr = memAddr.addressExpression.constValue(definingModule.program)
|
||||
if(addr!=null)
|
||||
return machine.isIOAddress(addr.number.toUInt())
|
||||
return when (memAddr.addressExpression) {
|
||||
is IdentifierReference -> {
|
||||
val decl = (memAddr.addressExpression as IdentifierReference).targetVarDecl(definingModule.program)
|
||||
val result = if ((decl?.type == VarDeclType.MEMORY || decl?.type == VarDeclType.CONST) && decl.value is NumericLiteral)
|
||||
machine.isIOAddress((decl.value as NumericLiteral).number.toUInt())
|
||||
else
|
||||
false
|
||||
result
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
arrayIdx != null -> {
|
||||
val targetStmt = arrayIdx.arrayvar.targetVarDecl(definingModule.program)
|
||||
return if (targetStmt?.type == VarDeclType.MEMORY) {
|
||||
val addr = targetStmt.value as? NumericLiteral
|
||||
if (addr != null)
|
||||
machine.isIOAddress(addr.number.toUInt())
|
||||
else
|
||||
false
|
||||
} else false
|
||||
}
|
||||
ident != null -> {
|
||||
val decl = ident.targetVarDecl(definingModule.program) ?:
|
||||
throw FatalAstException("invalid identifier ${ident.nameInSource}")
|
||||
return if (decl.type == VarDeclType.MEMORY && decl.value is NumericLiteral)
|
||||
machine.isIOAddress((decl.value as NumericLiteral).number.toUInt())
|
||||
else
|
||||
false
|
||||
}
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PostIncrDecr(var target: AssignTarget, val operator: String, override val position: Position) : Statement() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package prog8.compilerinterface
|
||||
package prog8.compiler
|
||||
|
||||
import prog8.ast.Program
|
||||
import prog8.ast.base.AstException
|
@ -1,4 +1,4 @@
|
||||
package prog8.compilerinterface
|
||||
package prog8.compiler
|
||||
|
||||
import prog8.ast.Module
|
||||
import prog8.ast.Node
|
@ -1,45 +0,0 @@
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = javaVersion
|
||||
}
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = javaVersion
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':codeCore')
|
||||
implementation project(':compilerAst')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.14"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = ["${project.projectDir}/src"]
|
||||
}
|
||||
resources {
|
||||
srcDirs = ["${project.projectDir}/res"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// note: there are no unit tests in this module!
|
@ -1,17 +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" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="module" module-name="codeCore" />
|
||||
<orderEntry type="module" module-name="compilerAst" />
|
||||
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,2 +0,0 @@
|
||||
Unittests for things in this module are located in the Compiler module instead,
|
||||
for convenience sake, and to not spread the test cases around too much.
|
@ -1,51 +0,0 @@
|
||||
package prog8.compilerinterface
|
||||
|
||||
import prog8.ast.base.FatalAstException
|
||||
import prog8.ast.expressions.IdentifierReference
|
||||
import prog8.ast.expressions.NumericLiteral
|
||||
import prog8.ast.statements.AssignTarget
|
||||
import prog8.ast.statements.VarDeclType
|
||||
import prog8.code.core.IMachineDefinition
|
||||
|
||||
fun AssignTarget.isIOAddress(machine: IMachineDefinition): Boolean {
|
||||
val memAddr = memoryAddress
|
||||
val arrayIdx = arrayindexed
|
||||
val ident = identifier
|
||||
when {
|
||||
memAddr != null -> {
|
||||
val addr = memAddr.addressExpression.constValue(definingModule.program)
|
||||
if(addr!=null)
|
||||
return machine.isIOAddress(addr.number.toUInt())
|
||||
return when (memAddr.addressExpression) {
|
||||
is IdentifierReference -> {
|
||||
val decl = (memAddr.addressExpression as IdentifierReference).targetVarDecl(definingModule.program)
|
||||
val result = if ((decl?.type == VarDeclType.MEMORY || decl?.type == VarDeclType.CONST) && decl.value is NumericLiteral)
|
||||
machine.isIOAddress((decl.value as NumericLiteral).number.toUInt())
|
||||
else
|
||||
false
|
||||
result
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
arrayIdx != null -> {
|
||||
val targetStmt = arrayIdx.arrayvar.targetVarDecl(definingModule.program)
|
||||
return if (targetStmt?.type == VarDeclType.MEMORY) {
|
||||
val addr = targetStmt.value as? NumericLiteral
|
||||
if (addr != null)
|
||||
machine.isIOAddress(addr.number.toUInt())
|
||||
else
|
||||
false
|
||||
} else false
|
||||
}
|
||||
ident != null -> {
|
||||
val decl = ident.targetVarDecl(definingModule.program) ?:
|
||||
throw FatalAstException("invalid identifier ${ident.nameInSource}")
|
||||
return if (decl.type == VarDeclType.MEMORY && decl.value is NumericLiteral)
|
||||
machine.isIOAddress((decl.value as NumericLiteral).number.toUInt())
|
||||
else
|
||||
false
|
||||
}
|
||||
else -> return false
|
||||
}
|
||||
}
|
@ -26,7 +26,6 @@ compileTestKotlin {
|
||||
|
||||
dependencies {
|
||||
implementation project(':codeCore')
|
||||
implementation project(':compilerInterfaces')
|
||||
implementation project(':compiler')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
|
@ -14,7 +14,6 @@
|
||||
<orderEntry type="library" name="takes" level="project" />
|
||||
<orderEntry type="library" name="slf4j.simple" level="project" />
|
||||
<orderEntry type="module" module-name="codeCore" />
|
||||
<orderEntry type="module" module-name="compilerInterfaces" />
|
||||
<orderEntry type="module" module-name="compiler" />
|
||||
</component>
|
||||
</module>
|
@ -2,5 +2,5 @@
|
||||
|
||||
rm -f *.bin *.xex *.jar *.asm *.prg *.vm.txt *.vice-mon-list *.list a.out imgui.ini
|
||||
rm -rf build out
|
||||
rm -rf compiler/build codeGenTargets/build codeGenCpu6502/build codeGenExperimental6502/build codeOptimizers/build compilerInterfaces/build compilerAst/build dbusCompilerService/build httpCompilerService/build parser/build
|
||||
rm -rf compiler/build codeGenCpu6502/build codeGenExperimental6502/build codeOptimizers/build compilerAst/build dbusCompilerService/build httpCompilerService/build parser/build
|
||||
|
||||
|
@ -3,9 +3,7 @@ include(
|
||||
':codeCore',
|
||||
':codeAst',
|
||||
':compilerAst',
|
||||
':compilerInterfaces',
|
||||
':codeOptimizers',
|
||||
':codeGenTargets',
|
||||
':codeGenCpu6502',
|
||||
':codeGenExperimental6502',
|
||||
':compiler',
|
||||
|
Loading…
x
Reference in New Issue
Block a user