diff --git a/compiler/src/prog8/compiler/Compiler.kt b/compiler/src/prog8/compiler/Compiler.kt index 7bffcecad..2665f08ea 100644 --- a/compiler/src/prog8/compiler/Compiler.kt +++ b/compiler/src/prog8/compiler/Compiler.kt @@ -248,8 +248,8 @@ private fun processAst(program: Program, errors: IErrorReporter, compilerOptions program.checkIdentifiers(errors, compilerOptions) errors.report() // TODO: turning char literals into UBYTEs via an encoding should really happen in code gen - but for that we'd need DataType.CHAR - // NOTE: we will then lose the opportunity to do constant-folding on any expression containing a char literal, but how often will those occur? - // Also they might be optimized away eventually in codegen or by the assembler even + // ...but what do we gain from this? We can leave it as it is now: where a char literal is no more than syntactic sugar for an UBYTE value. + // By introduction a CHAR dt, we will also lose the opportunity to do constant-folding on any expression containing a char literal. program.charLiteralsToUByteLiterals(compilerOptions.compTarget) program.constantFold(errors, compilerOptions.compTarget) errors.report() diff --git a/compilerAst/src/prog8/parser/SourceCode.kt b/compilerAst/src/prog8/parser/SourceCode.kt index 40dc5afdf..db452fe2d 100644 --- a/compilerAst/src/prog8/parser/SourceCode.kt +++ b/compilerAst/src/prog8/parser/SourceCode.kt @@ -151,14 +151,4 @@ sealed class SourceCode { override val origin: String = name override fun readText() = throw IOException("generated code nodes don't have a text representation") } - - // TODO: possibly more, like fromURL(..) -/* // For `jar:..` URLs - // see https://stackoverflow.com/questions/22605666/java-access-files-in-jar-causes-java-nio-file-filesystemnotfoundexception - var url = URL("jar:file:/E:/x16/prog8(meisl)/compiler/build/libs/prog8compiler-7.0-BETA3-all.jar!/prog8lib/c64/textio.p8") - val uri = url.toURI() - val parts = uri.toString().split("!") - val fs = FileSystems.newFileSystem(URI.create(parts[0]), mutableMapOf(Pair("", "")) ) - val path = fs.getPath(parts[1]) -*/ } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 1da019f37..b35d8edd2 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -32,8 +32,7 @@ Future Perhaps replace all uses of .proc/.pend by .block/.bend will fix that? (but we lose the optimizing aspect of the assembler where it strips out unused code. There's not really a dynamic switch possible as all assembly lib code is static and uses one or the other) -- introduce byte-index operator to avoid index multiplications in loops over arrays? - see https://www.reddit.com/r/programming/comments/alhj59/creating_a_programming_language_and_cross/eg898b9?utm_source=share&utm_medium=web2x&context=3 +- introduce byte-index operator to avoid index multiplications in loops over arrays? see github issue #4 More code optimization ideas