This commit is contained in:
Irmen de Jong 2025-03-18 23:38:08 +01:00
parent 3770a4fe0c
commit 1dc412eb90
4 changed files with 11 additions and 8 deletions

View File

@ -881,6 +881,9 @@ main {
DataType.UWORD.isWord shouldBe true
DataType.BYTE.isByte shouldBe true
DataType.UBYTE.isByte shouldBe true
DataType.BOOL.isBool shouldBe true
DataType.STR.isString shouldBe true
DataType.FLOAT.isFloat shouldBe true
DataType.forDt(BaseDataType.UNDEFINED).isUndefined shouldBe true
DataType.forDt(BaseDataType.LONG).isLong shouldBe true
@ -888,6 +891,9 @@ main {
DataType.forDt(BaseDataType.UWORD).isWord shouldBe true
DataType.forDt(BaseDataType.BYTE).isByte shouldBe true
DataType.forDt(BaseDataType.UBYTE).isByte shouldBe true
DataType.forDt(BaseDataType.BOOL).isBool shouldBe true
DataType.forDt(BaseDataType.STR).isString shouldBe true
DataType.forDt(BaseDataType.FLOAT).isFloat shouldBe true
DataType.arrayFor(BaseDataType.UBYTE, true).isUnsignedByteArray shouldBe true
DataType.arrayFor(BaseDataType.FLOAT).isFloatArray shouldBe true

View File

@ -24,7 +24,7 @@ Future Things and Ideas
in certain situations (need examples!), the "wrong" order of evaluation of function call arguments is done which results
in overwriting registers that already got their value, which requires a lot of stack juggling (especially on plain 6502 cpu!)
Maybe this routine can be made more intelligent. See usesOtherRegistersWhileEvaluating() and argumentsViaRegisters().
- Does it make codegen easier if everything is an expression? Start with the PtProgram ast , get rid of the statements there -> expressions that have Void data type
- Does it make codegen easier if everything is an expression? Start with the PtProgram ast classes, change statements to expressions that have (new) VOID data type
- Can we support signed % (remainder) somehow?
- Multidimensional arrays and chained indexing, purely as syntactic sugar over regular arrays. Probaby only useful if we have typed pointers.
- make a form of "manual generics" possible like: varsub routine(T arg)->T where T is expanded to a specific type

View File

@ -31,10 +31,7 @@ sealed class PtNode(val position: Position) {
}
sealed interface IPtStatementContainer
class PtNodeGroup : PtNode(Position.DUMMY), IPtStatementContainer
class PtNodeGroup : PtNode(Position.DUMMY)
sealed class PtNamedNode(var name: String, position: Position): PtNode(position) {
@ -79,7 +76,7 @@ class PtBlock(name: String,
val source: SourceCode, // taken from the module the block is defined in.
val options: Options,
position: Position
) : PtNamedNode(name, position), IPtStatementContainer {
) : PtNamedNode(name, position) {
class Options(val address: UInt? = null,
val forceOutput: Boolean = false,
val noSymbolPrefixing: Boolean = false,

View File

@ -62,7 +62,7 @@ class PtSub(
val parameters: List<PtSubroutineParameter>,
val returns: List<DataType>,
position: Position
) : PtNamedNode(name, position), IPtSubroutine, IPtStatementContainer {
) : PtNamedNode(name, position), IPtSubroutine {
init {
// params and return values should not be str
if(parameters.any{ !it.type.isNumericOrBool })
@ -227,7 +227,7 @@ class PtWhenChoice(val isElse: Boolean, position: Position) : PtNode(position) {
}
class PtDefer(position: Position): PtNode(position), IPtStatementContainer
class PtDefer(position: Position): PtNode(position)
class PtJmpTable(position: Position) : PtNode(position) // contains only PtIdentifier nodes