diff --git a/compiler/src/prog8/compiler/Main.kt b/compiler/src/prog8/compiler/Main.kt index 86ca86348..75fc87ff1 100644 --- a/compiler/src/prog8/compiler/Main.kt +++ b/compiler/src/prog8/compiler/Main.kt @@ -192,7 +192,7 @@ private fun writeAssembly(programAst: Program, errors: ErrorReporter, outputDir: programAst.processAstBeforeAsmGeneration(errors) errors.handle() - // printAst(programAst) + printAst(programAst) // TODO val assembly = CompilationTarget.asmGenerator( programAst, diff --git a/examples/test.p8 b/examples/test.p8 index 5bda70f0a..c2336a8d7 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -4,19 +4,50 @@ %zeropage basicsafe %option enable_floats +; todo: add these to the Expression Simplifier so that all the below assignments become a simple in-place assignment: +; (A +/- B) +/- C ==> A +/- ( B +/- C) +; (A * / B) * / C ==> A * / ( B * / C) + main { - float[] fa = [1,2,3,4] - sub start() { - wot("asdfasdf") - wot("asdfasdf") - wot("asdfasdf1") - } - sub wot(uword text) { - c64scr.print(4.4, 1) - c64.CHROUT('\n') + ubyte wv + ubyte wv2 + + wv *= wv2 + + wv += 10 + wv += 20 + wv += 30 + + wv += 1 + wv2 + wv += 2 + wv2 + wv += 3 + wv2 + + wv += wv2 + 1 + wv += wv2 + 2 + wv += wv2 + 3 + + wv = wv + 1 + wv2 + wv = wv + 2 + wv2 + wv = wv + 3 + wv2 + + wv = 1 + wv2 + wv + wv = 2 + wv2 + wv + wv = 3 + wv2 + wv + + wv = wv + wv2 + 1 + wv = wv + wv2 + 2 + wv = wv + wv2 + 3 + + wv = wv2 + 1 + wv + wv = wv2 + 2 + wv + wv = wv2 + 3 + wv + + wv = wv2 + wv + 1 + wv = wv2 + wv + 2 + wv = wv2 + wv + 3 } }