This commit is contained in:
Irmen de Jong 2024-03-03 19:49:50 +01:00
parent e55cde2a81
commit 607275ec66
4 changed files with 62 additions and 69 deletions

View File

@ -44,7 +44,7 @@ private fun compileMain(args: Array<String>): Boolean {
val experimentalCodegen by cli.option(ArgType.Boolean, fullName = "expericodegen", description = "use experimental/alternative codegen")
val dumpVariables by cli.option(ArgType.Boolean, fullName = "dumpvars", description = "print a dump of the variables in the program")
val dontWriteAssembly by cli.option(ArgType.Boolean, fullName = "noasm", description="don't create assembly code")
val noStrictBool by cli.option(ArgType.Boolean, fullName = "nostrictbool", description = "allow implicit conversions between bool and bytes").default(false)
val noStrictBool by cli.option(ArgType.Boolean, fullName = "nostrictbool", description = "allow implicit conversions between bool and bytes")
val dontOptimize by cli.option(ArgType.Boolean, fullName = "noopt", description = "don't perform code optimizations")
val outputDir by cli.option(ArgType.String, fullName = "out", description = "directory for output files instead of current directory").default(".")
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
@ -164,7 +164,7 @@ private fun compileMain(args: Array<String>): Boolean {
breakpointCpuInstruction,
printAst1 == true,
printAst2 == true,
noStrictBool == false,
noStrictBool != true,
processedSymbols,
srcdirs,
outputPath
@ -244,7 +244,7 @@ private fun compileMain(args: Array<String>): Boolean {
breakpointCpuInstruction,
printAst1 == true,
printAst2 == true,
noStrictBool == false,
noStrictBool != true,
processedSymbols,
srcdirs,
outputPath

View File

@ -6,10 +6,10 @@ package prog8.buildversion
const val MAVEN_GROUP = "prog8"
const val MAVEN_NAME = "compiler"
const val VERSION = "10.2-BOOLEANS"
const val GIT_REVISION = 4530
const val GIT_SHA = "26102becb7ed4f9875d83fbd3e1c0b59420f81d1"
const val GIT_DATE = "2024-03-03T17:58:39Z"
const val GIT_BRANCH = "booleans-nostrictbool"
const val BUILD_DATE = "2024-03-03T18:28:38Z"
const val BUILD_UNIX_TIME = 1709490518135L
const val GIT_REVISION = 4531
const val GIT_SHA = "8071e4b16f1ab7295d7009629199aa7adf39a2c1"
const val GIT_DATE = "2024-03-03T18:51:54Z"
const val GIT_BRANCH = "booleans"
const val BUILD_DATE = "2024-03-03T18:52:34Z"
const val BUILD_UNIX_TIME = 1709491954538L
const val DIRTY = 1

View File

@ -1,13 +1,6 @@
TODO
====
behind a -nostrictbool command line option:
re-allow conversion of const true/false back to ubytes 1 and 0?
re-allow conversion of const ubyte 0/1 to false/true boolean?
re-allow implicit typecast of boolean type to ubyte, and vice versa?
===== ====== =======
VM 6502 what
===== ====== =======
@ -47,6 +40,6 @@ ok ok efficient code for if_cc conditional expressions
ok ok while boolean should produce identical code as while integer!=0 and code should be efficient
ok ok while not boolvar -> can we get rid of the cmp? (6502 only?)
ok ok testmonogfx works
ok . check program sizes vs. master branch
ok o check program sizes vs. master branch
===== ====== =======

View File

@ -5,59 +5,59 @@
main {
sub start() {
cx16.r0L = true
cx16.r1L = false
bool @shared bzz = 1
ubyte @shared ubb = true
bool @shared bb1, bb2
bb1 = 0
bb2 = 44
bb1 = cx16.r0L
bb2 = bb1 and cx16.r0L
cx16.r0L = bb1 ^ cx16.r0L
; bool[3] barr1 = 42
byte[3] @shared sbarr1 = true
ubyte[3] @shared ubarr1 = true
ubyte[3] @shared ubarr2 = bb2
bool[] @shared boolarray = [1,0]
bool[] @shared boolarray2 = [42,0,false]
byte[] @shared sba = [true, false]
byte[] @shared sba2 = [true, false, 42]
ubyte[] @shared uba = [true, false]
ubyte[] @shared uba2 = [true, false, 42]
if cx16.r0L >= 44 and not cx16.r0L
cx16.r0L++
txt.print_ubhex(bb1, 1)
txt.print_ubhex(bb2, 42)
txt.print_ubhex(bb2, cx16.r0L)
if cx16.r0L {
cx16.r0L++
}
if cx16.r0 {
cx16.r0L++
}
kapoof()
kapoof2()
; cx16.r0L = true
; cx16.r1L = false
;
; bool @shared bzz = 1
; ubyte @shared ubb = true
;
; bool @shared bb1, bb2
; bb1 = 0
; bb2 = 44
; bb1 = cx16.r0L
;
; bb2 = bb1 and cx16.r0L
; cx16.r0L = bb1 ^ cx16.r0L
;
; ; bool[3] barr1 = 42
; byte[3] @shared sbarr1 = true
; ubyte[3] @shared ubarr1 = true
; ubyte[3] @shared ubarr2 = bb2
;
; bool[] @shared boolarray = [1,0]
; bool[] @shared boolarray2 = [42,0,false]
; byte[] @shared sba = [true, false]
; byte[] @shared sba2 = [true, false, 42]
; ubyte[] @shared uba = [true, false]
; ubyte[] @shared uba2 = [true, false, 42]
;
; if cx16.r0L >= 44 and not cx16.r0L
; cx16.r0L++
;
; txt.print_ubhex(bb1, 1)
; txt.print_ubhex(bb2, 42)
; txt.print_ubhex(bb2, cx16.r0L)
;
; if cx16.r0L {
; cx16.r0L++
; }
;
; if cx16.r0 {
; cx16.r0L++
; }
;
; kapoof()
; kapoof2()
}
sub kapoof() -> bool {
cx16.r0L++
return cx16.r0L
}
sub kapoof2() -> ubyte {
cx16.r0L++
return cx16.r0L==0
}
; sub kapoof() -> bool {
; cx16.r0L++
; return cx16.r0L
; }
;
; sub kapoof2() -> ubyte {
; cx16.r0L++
; return cx16.r0L==0
; }
}