From 5bf2c4a7989a10e804ce2bb429cb11983dec5f67 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 30 Oct 2018 20:29:03 +0100 Subject: [PATCH] got rid of matrix type --- compiler/antlr/prog8.g4 | 2 +- compiler/compiler.iml | 11 +- compiler/examples/test.p8 | 110 +- compiler/src/prog8/ast/AST.kt | 70 +- compiler/src/prog8/ast/AstChecker.kt | 62 +- compiler/src/prog8/compiler/Compiler.kt | 51 +- compiler/src/prog8/compiler/Zeropage.kt | 20 +- .../intermediate/IntermediateProgram.kt | 4 +- .../src/prog8/compiler/intermediate/Opcode.kt | 2 +- .../src/prog8/compiler/target/c64/AsmGen.kt | 8 +- .../src/prog8/functions/BuiltinFunctions.kt | 16 +- .../src/prog8/optimizing/ConstantFolding.kt | 40 +- compiler/src/prog8/parser/prog8Lexer.java | 4 +- compiler/src/prog8/parser/prog8Parser.java | 1051 ++++++++--------- compiler/src/prog8/stackvm/Program.kt | 9 +- compiler/src/prog8/stackvm/StackVm.kt | 21 +- compiler/test/StackVMOpcodeTests.kt | 4 +- compiler/test/ValueOperationsTests.kt | 2 - docs/source/programming.rst | 22 +- docs/source/syntaxreference.rst | 10 +- docs/source/todo.rst | 13 +- 21 files changed, 631 insertions(+), 901 deletions(-) diff --git a/compiler/antlr/prog8.g4 b/compiler/antlr/prog8.g4 index 0caabd76f..08740d6fd 100644 --- a/compiler/antlr/prog8.g4 +++ b/compiler/antlr/prog8.g4 @@ -105,7 +105,7 @@ memoryvardecl: 'memory' varinitializer; datatype: 'ubyte' | 'byte' | 'uword' | 'word' | 'float' | 'str' | 'str_p' | 'str_s' | 'str_ps' ; -arrayspec: '[' expression (',' expression)? ']' ; +arrayspec: '[' expression ']' ; assignment : assign_target '=' expression ; diff --git a/compiler/compiler.iml b/compiler/compiler.iml index 42f9d9160..f4ce5d996 100644 --- a/compiler/compiler.iml +++ b/compiler/compiler.iml @@ -3,17 +3,14 @@ - + - - - + - - + - \ No newline at end of file + diff --git a/compiler/examples/test.p8 b/compiler/examples/test.p8 index 6c0a81e83..d3de9e264 100644 --- a/compiler/examples/test.p8 +++ b/compiler/examples/test.p8 @@ -28,10 +28,6 @@ sub start() { uword[5] uwarr2 float[5] farr1 float[5] farr2 - byte[2,3] bmatrix1 - byte[2,3] bmatrix2 - ubyte[2,3] ubmatrix1 - ubyte[2,3] ubmatrix2 memory byte mbyte = $c000 memory byte mbyte2 = $d000 @@ -71,16 +67,6 @@ byte_assignment_to_register: A = AY[Y] A = AY[b] A = AY[ub] - A = ubmatrix1[1,2] - ;A = ubmatrix1[1,Y] ; todo via evaluation - ;A = ubmatrix1[X,2] ; todo via evaluation - ;A = ubmatrix1[X,Y] ; todo via evaluation - ;A = ubmatrix1[1,b2] ; todo via evaluation - ;A = ubmatrix1[X,b2] ; todo via evaluation - ;A = ubmatrix1[b2,2] ; todo via evaluation - ;A = ubmatrix1[b2,X] ; todo via evaluation - ;A = ubmatrix1[b,b2] ; todo via evaluation - ;A = ubmatrix1[ub,ub2] ; todo via evaluation ubyte_assignment_to_ubytevar: ub = 42 @@ -99,16 +85,6 @@ ubyte_assignment_to_ubytevar: ub = AY[Y] ub = AY[b] ub = AY[ub] - ub = ubmatrix1[1,2] - ;ub = ubmatrix1[1,Y] ; todo via evaluation - ;ub = ubmatrix1[X,2] ; todo via evaluation - ;ub = ubmatrix1[X,Y] ; todo via evaluation - ;ub = ubmatrix1[1,b2] ; todo via evaluation - ;ub = ubmatrix1[X,b2] ; todo via evaluation - ;ub = ubmatrix1[b2,2] ; todo via evaluation - ;ub = ubmatrix1[b2,X] ; todo via evaluation - ;ub = ubmatrix1[b,b2] ; todo via evaluation - ;ub = ubmatrix1[ub,ub2] ; todo via evaluation ubyte_assignment_to_ubytemem: @@ -128,16 +104,6 @@ ubyte_assignment_to_ubytemem: mubyte = AY[Y] mubyte = AY[b] mubyte = AY[ub] - mubyte = ubmatrix1[1,2] - ;mubyte = ubmatrix1[1,Y] ; todo via evaluation - ;mubyte = ubmatrix1[X,2] ; todo via evaluation - ;mubyte = ubmatrix1[X,Y] ; todo via evaluation - ;mubyte = ubmatrix1[1,b2] ; todo via evaluation - ;mubyte = ubmatrix1[X,b2] ; todo via evaluation - ;mubyte = ubmatrix1[b2,2] ; todo via evaluation - ;mubyte = ubmatrix1[b2,X] ; todo via evaluation - ;mubyte = ubmatrix1[b,b2] ; todo via evaluation - ;mubyte = ubmatrix1[ub,ub2] ; todo via evaluation byte_assignment_to_bytevar: b = -42 @@ -147,16 +113,6 @@ byte_assignment_to_bytevar: b = barr1[X] b = barr1[b] b = barr1[ub] - b = bmatrix1[1,2] - ;b = bmatrix1[1,Y] ; todo via evaluation - ;b = bmatrix1[X,2] ; todo via evaluation - ;b = bmatrix1[X,Y] ; todo via evaluation - ;b = bmatrix1[1,b2] ; todo via evaluation - ;b = bmatrix1[X,b2] ; todo via evaluation - ;b = bmatrix1[b2,2] ; todo via evaluation - ;b = bmatrix1[b2,X] ; todo via evaluation - ;b = bmatrix1[b,b2] ; todo via evaluation - ;b = bmatrix1[ub,ub2] ; todo via evaluation byte_assignment_to_bytemem: @@ -167,16 +123,6 @@ byte_assignment_to_bytemem: mbyte = barr1[X] mbyte = barr1[b] mbyte = barr1[ub] - mbyte = bmatrix1[1,2] - ;mbyte = bmatrix1[1,Y] ; todo via evaluation - ;mbyte = bmatrix1[X,2] ; todo via evaluation - ;mbyte = bmatrix1[X,Y] ; todo via evaluation - ;mbyte = bmatrix1[1,b2] ; todo via evaluation - ;mbyte = bmatrix1[X,b2] ; todo via evaluation - ;mbyte = bmatrix1[b2,2] ; todo via evaluation - ;mbyte = bmatrix1[b2,X] ; todo via evaluation - ;mbyte = bmatrix1[b,b2] ; todo via evaluation - ;mbyte = bmatrix1[ub,ub2] ; todo via evaluation ubyte_assignment_to_ubytearray: @@ -208,7 +154,6 @@ ubyte_assignment_to_ubytearray: AY[3] = ubarr1[X] AY[3] = ubarr1[b] AY[3] = ubarr1[ub] - AY[3] = ubmatrix1[1,2] string[4] = 42 string[4] = 'B' string[4] = X @@ -217,16 +162,6 @@ ubyte_assignment_to_ubytearray: string[4] = AY[4] string[4] = ubarr1[2] string[4] = string[3] - ubarr2[3] = ubmatrix1[1,2] - ;ubarr2[3] = ubmatrix1[1,Y] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[X,2] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[X,Y] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[1,b2] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[X,b2] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[b2,2] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[b2,X] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[b,b2] ; todo via evaluation - ;ubarr2[3] = ubmatrix1[ub,ub2] ; todo via evaluation ubarr2[Y] = 42 @@ -257,7 +192,6 @@ ubyte_assignment_to_ubytearray: AY[Y] = ubarr1[X] AY[Y] = ubarr1[b] AY[Y] = ubarr1[ub] - AY[Y] = ubmatrix1[1,2] string[Y] = 42 string[Y] = 'B' string[Y] = X @@ -266,18 +200,8 @@ ubyte_assignment_to_ubytearray: string[Y] = AY[4] string[Y] = ubarr1[2] string[Y] = string[Y] - ubarr2[Y] = ubmatrix1[1,2] - ;ubarr2[Y] = ubmatrix1[1,Y] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[X,2] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[X,Y] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[1,b2] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[X,b2] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[b2,2] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[b2,X] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[b,b2] ; todo via evaluation - ;ubarr2[Y] = ubmatrix1[ub,ub2] ; todo via evaluation - - + + ubarr2[ub2] = 42 ubarr2[ub2] = X ubarr2[ub2] = ub2 @@ -306,7 +230,6 @@ ubyte_assignment_to_ubytearray: AY[ub2] = ubarr1[X] AY[ub2] = ubarr1[b] AY[ub2] = ubarr1[ub] - AY[ub2] = ubmatrix1[1,2] string[ub2] = 42 string[ub2] = 'B' string[ub2] = X @@ -315,16 +238,6 @@ ubyte_assignment_to_ubytearray: string[ub2] = AY[4] string[ub2] = ubarr1[2] string[ub2] = string[ub2] - ubarr2[ub2] = ubmatrix1[1,2] - ;ubarr2[ub2] = ubmatrix1[1,Y] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[X,2] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[X,Y] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[1,b2] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[X,b2] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[b2,2] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[b2,X] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[b,b2] ; todo via evaluation - ;ubarr2[ub2] = ubmatrix1[ub,ub2] ; todo via evaluation ubarr2[mubyte2] = 42 ubarr2[mubyte2] = X @@ -354,7 +267,6 @@ ubyte_assignment_to_ubytearray: AY[mubyte2] = ubarr1[X] AY[mubyte2] = ubarr1[b] AY[mubyte2] = ubarr1[ub] - AY[mubyte2] = ubmatrix1[1,2] string[mubyte2] = 42 string[mubyte2] = 'B' string[mubyte2] = X @@ -363,21 +275,11 @@ ubyte_assignment_to_ubytearray: string[mubyte2] = AY[4] string[mubyte2] = ubarr1[2] string[mubyte2] = string[mubyte2] - ubarr2[mubyte2] = ubmatrix1[1,2] - ;ubarr2[mubyte2] = ubmatrix1[1,Y] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[X,2] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[X,Y] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[1,b2] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[X,b2] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[b2,2] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[b2,X] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[b,b2] ; todo via evaluation - ;ubarr2[mubyte2] = ubmatrix1[ub,ub2] ; todo via evaluation ubarr1[ubarr2[X]] = ubarr2[ubarr1[Y]] ; todo via evaluation - + byte_assignment_to_bytearray: ; @todo @@ -395,7 +297,6 @@ byte_assignment_to_bytearray: ; AY = ub ; AY = mubyte ; AY = ubarr1[2] -; AY = ubmatrix1[1,2] ; AY = string[4] ; AY = uw ; AY = muword @@ -417,8 +318,6 @@ byte_assignment_to_bytearray: ; w = barr1[2] ; w = ubarr1[2] ; w = warr1[2] -; w = bmatrix1[1,2] -; w = ubmatrix1[1,2] ; w = string[4] ; w = AY[4] ; @@ -433,7 +332,6 @@ byte_assignment_to_bytearray: ; uw = muword ; uw = ubarr1[2] ; uw = uwarr1[2] -; uw = ubmatrix1[1,2] ; uw = string[4] ; uw = AY[4] ; @@ -457,8 +355,6 @@ byte_assignment_to_bytearray: ; fl1 = ubarr1[2] ; fl1 = warr1[2] ; fl1 = uwarr1[2] -; fl1 = bmatrix1[1,2] -; fl1 = ubmatrix1[1,2] ; fl1 = string[4] return diff --git a/compiler/src/prog8/ast/AST.kt b/compiler/src/prog8/ast/AST.kt index 45d621fd1..d2450c3be 100644 --- a/compiler/src/prog8/ast/AST.kt +++ b/compiler/src/prog8/ast/AST.kt @@ -30,9 +30,7 @@ enum class DataType { ARRAY_B, ARRAY_UW, ARRAY_W, - ARRAY_F, - MATRIX_UB, - MATRIX_B + ARRAY_F } enum class Register { @@ -70,12 +68,12 @@ val IterableDatatypes = setOf( DataType.STR, DataType.STR_S, // note: the STR_P/STR_PS types aren't iterable because they store their length as the first byte DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, - DataType.ARRAY_F, DataType.MATRIX_UB, DataType.MATRIX_B) + DataType.ARRAY_F) val StringDatatypes = setOf(DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS) val NumericDatatypes = setOf(DataType.UBYTE, DataType.BYTE, DataType.UWORD, DataType.WORD, DataType.FLOAT) val IntegerDatatypes = setOf(DataType.UBYTE, DataType.BYTE, DataType.UWORD, DataType.WORD) -val ArrayDatatypes = setOf(DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, DataType.ARRAY_F, DataType.MATRIX_UB, DataType.MATRIX_B) +val ArrayDatatypes = setOf(DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, DataType.ARRAY_F) class FatalAstException (override var message: String) : Exception(message) @@ -553,40 +551,30 @@ class Break(override val position: Position) : IStatement { } -class ArraySpec(var x: IExpression, var y: IExpression?, override val position: Position) : Node { +class ArraySpec(var x: IExpression, override val position: Position) : Node { override lateinit var parent: Node override fun linkParents(parent: Node) { this.parent = parent x.linkParents(this) - y?.linkParents(this) } companion object { fun forArray(v: LiteralValue, heap: HeapValues): ArraySpec { val arraySize = v.arrayvalue?.size ?: heap.get(v.heapId!!).arraysize - return ArraySpec(LiteralValue.optimalNumeric(arraySize, v.position), null, v.position) + return ArraySpec(LiteralValue.optimalNumeric(arraySize, v.position), v.position) } } fun process(processor: IAstProcessor) { x = x.process(processor) - y = y?.process(processor) } override fun toString(): String { - return("ArraySpec(x: $x, y: $y, pos=$position)") + return("ArraySpec($x, pos=$position)") } - fun size() : Int? { - if(y==null) { - return (x as? LiteralValue)?.asIntegerValue - } else { - val sizeX = (x as? LiteralValue)?.asIntegerValue ?: return null - val sizeY = (y as? LiteralValue)?.asIntegerValue ?: return null - return sizeX * sizeY - } - } + fun size() = (x as? LiteralValue)?.asIntegerValue } @@ -605,29 +593,19 @@ class VarDecl(val type: VarDeclType, override lateinit var parent: Node val datatypeErrors = mutableListOf() // don't crash at init time, report them in the AstChecker - val datatype = when { - arrayspec == null -> declaredDatatype - arrayspec.y != null -> when (declaredDatatype) { - DataType.UBYTE -> DataType.MATRIX_UB - DataType.BYTE -> DataType.MATRIX_B - else -> { - datatypeErrors.add(SyntaxError("matrix can only contain bytes", position)) - DataType.UBYTE + val datatype = + if (arrayspec == null) declaredDatatype + else when (declaredDatatype) { + DataType.UBYTE -> DataType.ARRAY_UB + DataType.BYTE -> DataType.ARRAY_B + DataType.UWORD -> DataType.ARRAY_UW + DataType.WORD -> DataType.ARRAY_W + DataType.FLOAT -> DataType.ARRAY_F + else -> { + datatypeErrors.add(SyntaxError("array can only contain bytes/words/floats", position)) + DataType.UBYTE + } } - } - else -> when (declaredDatatype) { - DataType.UBYTE -> DataType.ARRAY_UB - DataType.BYTE -> DataType.ARRAY_B - DataType.UWORD -> DataType.ARRAY_UW - DataType.WORD -> DataType.ARRAY_W - DataType.FLOAT -> DataType.ARRAY_F - else -> { - datatypeErrors.add(SyntaxError("arrayspec can only contain bytes/words/floats", position)) - DataType.UBYTE - } - } - } - override fun linkParents(parent: Node) { this.parent = parent @@ -920,8 +898,8 @@ class ArrayIndexedExpression(val identifier: IdentifierReference?, return when (target.datatype) { in NumericDatatypes -> null in StringDatatypes -> DataType.UBYTE - DataType.ARRAY_UB, DataType.MATRIX_UB -> DataType.UBYTE - DataType.ARRAY_B, DataType.MATRIX_B -> DataType.BYTE + DataType.ARRAY_UB -> DataType.UBYTE + DataType.ARRAY_B -> DataType.BYTE DataType.ARRAY_UW -> DataType.UWORD DataType.ARRAY_W -> DataType.WORD DataType.ARRAY_F -> DataType.FLOAT @@ -1053,10 +1031,6 @@ class LiteralValue(val type: DataType, if(heapId!=null) "arrayspec:#$heapId" else "arrayspec:$arrayvalue" } - DataType.MATRIX_UB, DataType.MATRIX_B -> { - if(heapId!=null) "matrix:#$heapId" - else "matrix:$arrayvalue" - } } return "LiteralValue($vstr)" } @@ -1865,7 +1839,7 @@ private fun prog8Parser.DatatypeContext.toAst() = DataType.valueOf(text.toUpperC private fun prog8Parser.ArrayspecContext.toAst() : ArraySpec = - ArraySpec(expression(0).toAst(), if (expression().size > 1) expression(1).toAst() else null, toPosition()) + ArraySpec(expression().toAst(), toPosition()) private fun prog8Parser.DirectiveContext.toAst() : Directive = diff --git a/compiler/src/prog8/ast/AstChecker.kt b/compiler/src/prog8/ast/AstChecker.kt index ec2573ba9..3fa99bac9 100644 --- a/compiler/src/prog8/ast/AstChecker.kt +++ b/compiler/src/prog8/ast/AstChecker.kt @@ -121,12 +121,12 @@ class AstChecker(private val namespace: INameScope, // loop register when (forLoop.loopRegister) { Register.A, Register.X, Register.Y -> { - if (iterableDt != DataType.UBYTE && iterableDt!=DataType.ARRAY_UB && iterableDt!=DataType.MATRIX_UB && iterableDt !in StringDatatypes) + if (iterableDt != DataType.UBYTE && iterableDt!=DataType.ARRAY_UB && iterableDt !in StringDatatypes) checkResult.add(ExpressionError("register can only loop over bytes", forLoop.position)) } Register.AX, Register.AY, Register.XY -> { if (iterableDt != DataType.UWORD && iterableDt != DataType.UBYTE && iterableDt !in StringDatatypes && - iterableDt !=DataType.ARRAY_UB && iterableDt!=DataType.ARRAY_UW && iterableDt!=DataType.MATRIX_UB) + iterableDt !=DataType.ARRAY_UB && iterableDt!=DataType.ARRAY_UW) checkResult.add(ExpressionError("register pair can only loop over bytes or words", forLoop.position)) } } @@ -139,12 +139,12 @@ class AstChecker(private val namespace: INameScope, } else { when (loopvar.datatype) { DataType.UBYTE -> { - if(iterableDt!=DataType.UBYTE && iterableDt!=DataType.ARRAY_UB && iterableDt!=DataType.MATRIX_UB && iterableDt !in StringDatatypes) + if(iterableDt!=DataType.UBYTE && iterableDt!=DataType.ARRAY_UB && iterableDt !in StringDatatypes) checkResult.add(ExpressionError("byte loop variable can only loop over bytes", forLoop.position)) } DataType.UWORD -> { if(iterableDt!=DataType.UBYTE && iterableDt!=DataType.UWORD && iterableDt !in StringDatatypes && - iterableDt !=DataType.ARRAY_UB && iterableDt!=DataType.ARRAY_UW && iterableDt!=DataType.MATRIX_UB) + iterableDt !=DataType.ARRAY_UB && iterableDt!=DataType.ARRAY_UW) checkResult.add(ExpressionError("word loop variable can only loop over bytes or words", forLoop.position)) } // there's no support for a floating-point loop variable @@ -369,7 +369,7 @@ class AstChecker(private val namespace: INameScope, targetVar?.arrayspec } else null checkValueTypeAndRange(targetDatatype, - arrayspec ?: ArraySpec(LiteralValue.optimalInteger(-1, assignment.position), null, assignment.position), + arrayspec ?: ArraySpec(LiteralValue.optimalInteger(-1, assignment.position), assignment.position), constVal, heap) } else { val sourceDatatype: DataType? = assignment.value.resultingDatatype(namespace, heap) @@ -398,9 +398,7 @@ class AstChecker(private val namespace: INameScope, } // the initializer value can't refer to the variable itself (recursive definition) - if(decl.value?.referencesIdentifier(decl.name) == true|| - decl.arrayspec?.x?.referencesIdentifier(decl.name) == true || - decl.arrayspec?.y?.referencesIdentifier(decl.name) == true) { + if(decl.value?.referencesIdentifier(decl.name) == true || decl.arrayspec?.x?.referencesIdentifier(decl.name) == true) { err("recursive var declaration") } @@ -437,7 +435,7 @@ class AstChecker(private val namespace: INameScope, if((decl.value as LiteralValue).isArray) ArraySpec.forArray(decl.value as LiteralValue, heap) else - ArraySpec(LiteralValue.optimalInteger(-2, decl.position), null, decl.position) + ArraySpec(LiteralValue.optimalInteger(-2, decl.position), decl.position) ) checkValueTypeAndRange(decl.datatype, arraySpec, decl.value as LiteralValue, heap) } @@ -460,9 +458,6 @@ class AstChecker(private val namespace: INameScope, DataType.ARRAY_F -> if(arraySize > 51) err("float arrayspec length must be 1-51") - DataType.MATRIX_B, DataType.MATRIX_UB -> - if(arraySize > 32768) - err("invalid matrix size, must be 1-32768") else -> {} } } @@ -561,7 +556,7 @@ class AstChecker(private val namespace: INameScope, if(literalValue.isArray) ArraySpec.forArray(literalValue, heap) else - ArraySpec(LiteralValue.optimalInteger(-3, literalValue.position), null, literalValue.position) + ArraySpec(LiteralValue.optimalInteger(-3, literalValue.position), literalValue.position) checkValueTypeAndRange(literalValue.type, arrayspec, literalValue, heap) val lv = super.process(literalValue) @@ -572,7 +567,7 @@ class AstChecker(private val namespace: INameScope, } in ArrayDatatypes -> { if(lv.heapId==null) - throw FatalAstException("arrayspec/matrix should have been moved to heap at ${lv.position}") + throw FatalAstException("array should have been moved to heap at ${lv.position}") } else -> {} } @@ -731,14 +726,10 @@ class AstChecker(private val namespace: INameScope, if(arraysize!=null) { // check out of bounds val index = (arrayIndexedExpression.arrayspec.x as? LiteralValue)?.asIntegerValue - if(index != null && (arrayIndexedExpression.arrayspec.y as? LiteralValue)?.asIntegerValue != null) { - throw FatalAstException("constant y dimension of index should have been const-folded with x into one value ${arrayIndexedExpression.arrayspec.position}") - } if(index!=null && (index<0 || index>=arraysize)) checkResult.add(ExpressionError("arrayspec index out of bounds", arrayIndexedExpression.arrayspec.position)) } else if(target.datatype in StringDatatypes) { // check string lengths - (arrayIndexedExpression.arrayspec.y as? LiteralValue)?.asIntegerValue val heapId = (target.value as LiteralValue).heapId!! val stringLen = heap.get(heapId).str!!.length val index = (arrayIndexedExpression.arrayspec.x as? LiteralValue)?.asIntegerValue @@ -749,20 +740,15 @@ class AstChecker(private val namespace: INameScope, checkResult.add(SyntaxError("indexing requires a variable to act upon", arrayIndexedExpression.position)) } else if(reg==Register.A || reg==Register.X || reg==Register.Y) { checkResult.add(SyntaxError("indexing on registers requires register pair variable", arrayIndexedExpression.position)) - } else if(arrayIndexedExpression.arrayspec.y!=null) { - checkResult.add(SyntaxError("indexing on registers can only use one index dimension", arrayIndexedExpression.position)) } // check index value 0..255 val regx = (arrayIndexedExpression.arrayspec.x as? RegisterExpr)?.register - val regy = (arrayIndexedExpression.arrayspec.y as? RegisterExpr)?.register - if((regx in setOf(Register.AX, Register.AY, Register.XY)) || - (regy in setOf(Register.AX, Register.AY, Register.XY))) { + if((regx in setOf(Register.AX, Register.AY, Register.XY))) { checkResult.add(SyntaxError("array indexing is limited to byte size 0..255", arrayIndexedExpression.position)) } val dtx = arrayIndexedExpression.arrayspec.x.resultingDatatype(namespace, heap) - val dty = arrayIndexedExpression.arrayspec.y?.resultingDatatype(namespace, heap) - if(dtx!=DataType.UBYTE && dtx!=DataType.BYTE || (dty!=null && dty != DataType.UBYTE && dty != DataType.BYTE)) + if(dtx!=DataType.UBYTE && dtx!=DataType.BYTE) checkResult.add(SyntaxError("array indexing is limited to byte size 0..255", arrayIndexedExpression.position)) return super.process(arrayIndexedExpression) @@ -807,7 +793,7 @@ class AstChecker(private val namespace: INameScope, val expectedSize = arrayspec!!.size() val rangeSize=range.size() if(rangeSize!=null && rangeSize != expectedSize) { - checkResult.add(ExpressionError("range size doesn't match arrayspec/matrix size, expected $expectedSize found $rangeSize", range.position)) + checkResult.add(ExpressionError("range size doesn't match array size, expected $expectedSize found $rangeSize", range.position)) return false } return true @@ -939,30 +925,6 @@ class AstChecker(private val namespace: INameScope, } return err("invalid float arrayspec initialization value ${value.type}, expected $targetDt") } - DataType.MATRIX_UB, DataType.MATRIX_B -> { - // value can only be a single byte, or a byte arrayspec (which represents the matrix) - if(value.type==targetDt || - (targetDt==DataType.MATRIX_UB && value.type==DataType.ARRAY_UB) || - (targetDt==DataType.MATRIX_B && value.type==DataType.ARRAY_B)) { - val arraySpecSize = arrayspec.size() - if(arraySpecSize!=null && arraySpecSize>0) { - if(arraySpecSize<1 || arraySpecSize>32768) - return err("invalid matrix size, must be 1-32768") - val constX = arrayspec.x.constValue(namespace, heap) - val constY = arrayspec.y?.constValue(namespace, heap) - if (constX?.asIntegerValue == null || (constY!=null && constY.asIntegerValue == null)) - return err("matrix size specifiers must be constant integer values") - val matrix = heap.get(value.heapId!!).array!! - val expectedSize = - if(constY==null) constX.asIntegerValue else constX.asIntegerValue * constY.asIntegerValue!! - if (matrix.size != expectedSize) - return err("initializer matrix size mismatch (expecting $expectedSize, got ${matrix.size} elements)") - return true - } - return err("invalid matrix size, must be 1-32768") - } - return err("invalid matrix initialization value of type ${value.type} - expecting byte arrayspec") - } } return true } diff --git a/compiler/src/prog8/compiler/Compiler.kt b/compiler/src/prog8/compiler/Compiler.kt index c3e029c93..615e1448c 100644 --- a/compiler/src/prog8/compiler/Compiler.kt +++ b/compiler/src/prog8/compiler/Compiler.kt @@ -254,8 +254,8 @@ private class StatementTranslator(private val prog: IntermediateProgram, DataType.UWORD, DataType.WORD -> Opcode.PUSH_WORD DataType.FLOAT -> Opcode.PUSH_FLOAT DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, - DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, DataType.MATRIX_UB, - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B -> Opcode.PUSH_WORD + DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, + DataType.ARRAY_B, DataType.ARRAY_W -> Opcode.PUSH_WORD } } @@ -287,8 +287,8 @@ private class StatementTranslator(private val prog: IntermediateProgram, DataType.UWORD, DataType.WORD -> Opcode.PUSH_VAR_WORD DataType.FLOAT -> Opcode.PUSH_VAR_FLOAT DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, - DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, DataType.MATRIX_UB, - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B -> Opcode.PUSH_VAR_WORD + DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, + DataType.ARRAY_B, DataType.ARRAY_W -> Opcode.PUSH_VAR_WORD } } @@ -311,7 +311,6 @@ private class StatementTranslator(private val prog: IntermediateProgram, DataType.ARRAY_UB, DataType.ARRAY_B -> Opcode.READ_INDEXED_VAR_BYTE DataType.ARRAY_UW, DataType.ARRAY_W -> Opcode.READ_INDEXED_VAR_WORD DataType.ARRAY_F -> Opcode.READ_INDEXED_VAR_FLOAT - DataType.MATRIX_UB, DataType.MATRIX_B -> Opcode.READ_INDEXED_VAR_BYTE DataType.STR, DataType.STR_S -> Opcode.READ_INDEXED_VAR_BYTE DataType.STR_P, DataType.STR_PS -> throw CompilerException("cannot access pascal-string type $dt with index") else -> throw CompilerException("invalid dt for indexed access $dt") @@ -323,7 +322,6 @@ private class StatementTranslator(private val prog: IntermediateProgram, DataType.ARRAY_UB, DataType.ARRAY_B -> Opcode.WRITE_INDEXED_VAR_BYTE DataType.ARRAY_UW, DataType.ARRAY_W -> Opcode.WRITE_INDEXED_VAR_WORD DataType.ARRAY_F -> Opcode.WRITE_INDEXED_VAR_FLOAT - DataType.MATRIX_UB, DataType.MATRIX_B -> Opcode.WRITE_INDEXED_VAR_BYTE DataType.STR, DataType.STR_S -> Opcode.WRITE_INDEXED_VAR_BYTE DataType.STR_P, DataType.STR_PS -> throw CompilerException("cannot access pascal-string type $dt with index") else -> throw CompilerException("invalid dt for indexed access $dt") @@ -336,8 +334,8 @@ private class StatementTranslator(private val prog: IntermediateProgram, DataType.UWORD, DataType.WORD -> Opcode.DISCARD_WORD DataType.FLOAT -> Opcode.DISCARD_FLOAT DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, - DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, DataType.MATRIX_UB, - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B -> Opcode.DISCARD_WORD + DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, + DataType.ARRAY_B, DataType.ARRAY_W -> Opcode.DISCARD_WORD } } @@ -347,8 +345,8 @@ private class StatementTranslator(private val prog: IntermediateProgram, DataType.UWORD, DataType.WORD -> Opcode.POP_VAR_WORD DataType.FLOAT -> Opcode.POP_VAR_FLOAT DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, - DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, DataType.MATRIX_UB, - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B -> Opcode.POP_VAR_WORD + DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, + DataType.ARRAY_B, DataType.ARRAY_W -> Opcode.POP_VAR_WORD } } @@ -358,8 +356,8 @@ private class StatementTranslator(private val prog: IntermediateProgram, DataType.UWORD, DataType.WORD -> Opcode.POP_MEM_WORD DataType.FLOAT -> Opcode.POP_MEM_FLOAT DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, - DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, DataType.MATRIX_UB, - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B -> Opcode.POP_MEM_WORD + DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, + DataType.ARRAY_B, DataType.ARRAY_W -> Opcode.POP_MEM_WORD } } @@ -627,10 +625,10 @@ private class StatementTranslator(private val prog: IntermediateProgram, throw CompilerException("string should have been moved into heap ${lv.position}") prog.instr(Opcode.PUSH_WORD, Value(lv.type, lv.heapId)) } - DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, DataType.MATRIX_UB, - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B -> { + DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, + DataType.ARRAY_B, DataType.ARRAY_W -> { if(lv.heapId==null) - throw CompilerException("arrayspec/matrix should have been moved into heap ${lv.position}") + throw CompilerException("array should have been moved into heap ${lv.position}") prog.instr(Opcode.PUSH_WORD, Value(lv.type, lv.heapId)) } } @@ -1048,22 +1046,11 @@ private class StatementTranslator(private val prog: IntermediateProgram, val reg=arrayindexed.register if(reg==Register.A || reg==Register.X || reg==Register.Y) throw CompilerException("requires register pair") - if(arrayindexed.arrayspec.y!=null) - throw CompilerException("when using an address, can only use one index dimension") reg.toString() } else { variable!!.scopedname } translate(arrayindexed.arrayspec.x) - val y = arrayindexed.arrayspec.y - if(y!=null) { - // calc matrix index i=y*columns+x - // (the const-folding will have removed this for us when both x and y are constants) - translate(y) - prog.instr(Opcode.PUSH_BYTE, Value(DataType.UWORD, (variable!!.arrayspec!!.x as LiteralValue).asIntegerValue!!)) - prog.instr(Opcode.MUL_UW) - prog.instr(Opcode.ADD_UW) - } if(variable!=null) { if (write) @@ -1174,10 +1161,9 @@ private class StatementTranslator(private val prog: IntermediateProgram, else -> throw CompilerException("incompatible data types valueDt=$valueDt targetDt=$targetDt at $stmt") } } - // todo: maybe if you assign byte or word to arrayspec/matrix, clear it with that value? + // todo: maybe if you assign byte or word to arrayspec, clear it with that value? DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS -> throw CompilerException("incompatible data types valueDt=$valueDt targetDt=$targetDt at $stmt") - DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, - DataType.ARRAY_F, DataType.MATRIX_UB, DataType.MATRIX_B -> throw CompilerException("incompatible data types valueDt=$valueDt targetDt=$targetDt at $stmt") + DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, DataType.ARRAY_F -> throw CompilerException("incompatible data types valueDt=$valueDt targetDt=$targetDt at $stmt") null -> throw CompilerException("could not determine targetdt") } } @@ -1402,7 +1388,7 @@ private class StatementTranslator(private val prog: IntermediateProgram, } private fun translateForOverIterableVar(loop: ForLoop, loopvarDt: DataType, iterableValue: LiteralValue) { - if(loopvarDt==DataType.UBYTE && iterableValue.type !in setOf(DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, DataType.ARRAY_UB, DataType.MATRIX_UB)) + if(loopvarDt==DataType.UBYTE && iterableValue.type !in setOf(DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, DataType.ARRAY_UB)) throw CompilerException("loop variable type doesn't match iterableValue type") else if(loopvarDt==DataType.UWORD && iterableValue.type != DataType.ARRAY_UW) throw CompilerException("loop variable type doesn't match iterableValue type") @@ -1422,8 +1408,7 @@ private class StatementTranslator(private val prog: IntermediateProgram, indexVar = if(numElements>255) "XY" else "X" } DataType.ARRAY_UB, DataType.ARRAY_B, - DataType.ARRAY_UW, DataType.ARRAY_W, - DataType.MATRIX_UB, DataType.MATRIX_B -> { + DataType.ARRAY_UW, DataType.ARRAY_W -> { numElements = iterableValue.arrayvalue?.size ?: heap.get(iterableValue.heapId!!).arraysize indexVar = if(numElements>255) "XY" else "X" } @@ -1467,7 +1452,7 @@ private class StatementTranslator(private val prog: IntermediateProgram, AssignTarget(loop.loopRegister, null, null, loop.position) else AssignTarget(null, loop.loopVar!!.copy(), null, loop.position) - val arrayspec = ArraySpec(RegisterExpr(Register.valueOf(indexVar), loop.position), null, loop.position) + val arrayspec = ArraySpec(RegisterExpr(Register.valueOf(indexVar), loop.position), loop.position) val assignLv = Assignment(assignTarget, null, ArrayIndexedExpression((loop.iterable as IdentifierReference).copy(), null, arrayspec, loop.position), loop.position) assignLv.linkParents(loop.body) translate(assignLv) diff --git a/compiler/src/prog8/compiler/Zeropage.kt b/compiler/src/prog8/compiler/Zeropage.kt index 3c6db607f..b898b262e 100644 --- a/compiler/src/prog8/compiler/Zeropage.kt +++ b/compiler/src/prog8/compiler/Zeropage.kt @@ -17,21 +17,11 @@ abstract class Zeropage(private val options: CompilationOptions) { val size = if(vardecl.arrayspec!=null) { printWarning("allocating a large value (arrayspec) in zeropage", vardecl.position) - val y = (vardecl.arrayspec.y as? LiteralValue)?.asIntegerValue - if(y==null) { - // 1 dimensional arrayspec - when(vardecl.datatype) { - DataType.UBYTE -> (vardecl.arrayspec.x as LiteralValue).asIntegerValue!! - DataType.UWORD -> (vardecl.arrayspec.x as LiteralValue).asIntegerValue!! * 2 - DataType.FLOAT -> (vardecl.arrayspec.x as LiteralValue).asIntegerValue!! * 5 - else -> throw CompilerException("arrayspec can only be of byte, word, float") - } - } else { - // 2 dimensional matrix (only bytes for now) - when(vardecl.datatype) { - DataType.UBYTE -> (vardecl.arrayspec.x as LiteralValue).asIntegerValue!! * y - else -> throw CompilerException("matrix can only contain bytes") - } + when(vardecl.datatype) { + DataType.UBYTE -> (vardecl.arrayspec.x as LiteralValue).asIntegerValue!! + DataType.UWORD -> (vardecl.arrayspec.x as LiteralValue).asIntegerValue!! * 2 + DataType.FLOAT -> (vardecl.arrayspec.x as LiteralValue).asIntegerValue!! * 5 + else -> throw CompilerException("arrayspec can only be of byte, word, float") } } else { when (vardecl.datatype) { diff --git a/compiler/src/prog8/compiler/intermediate/IntermediateProgram.kt b/compiler/src/prog8/compiler/intermediate/IntermediateProgram.kt index db6eee886..ac295b022 100644 --- a/compiler/src/prog8/compiler/intermediate/IntermediateProgram.kt +++ b/compiler/src/prog8/compiler/intermediate/IntermediateProgram.kt @@ -278,11 +278,11 @@ class IntermediateProgram(val name: String, var loadAddress: Int, val heap: Heap throw CompilerException("string should already be in the heap") Value(decl.datatype, litval.heapId) } - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B, DataType.MATRIX_UB, + DataType.ARRAY_B, DataType.ARRAY_W, DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F -> { val litval = (decl.value as LiteralValue) if(litval.heapId==null) - throw CompilerException("arrayspec/matrix should already be in the heap") + throw CompilerException("array should already be in the heap") Value(decl.datatype, litval.heapId) } } diff --git a/compiler/src/prog8/compiler/intermediate/Opcode.kt b/compiler/src/prog8/compiler/intermediate/Opcode.kt index cc7c1bf23..f764ebc1d 100644 --- a/compiler/src/prog8/compiler/intermediate/Opcode.kt +++ b/compiler/src/prog8/compiler/intermediate/Opcode.kt @@ -4,7 +4,7 @@ enum class Opcode { // pushing values on the (evaluation) stack PUSH_BYTE, // push byte value - PUSH_WORD, // push word value (or 'address' of string / arrayspec / matrix) + PUSH_WORD, // push word value (or 'address' of string / array) PUSH_FLOAT, // push float value PUSH_MEM_B, // push byte value from memory to stack PUSH_MEM_UB, // push unsigned byte value from memory to stack diff --git a/compiler/src/prog8/compiler/target/c64/AsmGen.kt b/compiler/src/prog8/compiler/target/c64/AsmGen.kt index cebbe78d3..14cab0b2e 100644 --- a/compiler/src/prog8/compiler/target/c64/AsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/AsmGen.kt @@ -217,7 +217,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram, for (chunk in bytes.chunked(16)) out("\t.byte " + chunk.joinToString()) } - DataType.ARRAY_UB, DataType.MATRIX_UB -> { + DataType.ARRAY_UB -> { // unsigned integer byte arrayspec val data = makeArrayFillDataUnsigned(v.second) if (data.size <= 16) @@ -228,7 +228,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram, out("\t.byte " + chunk.joinToString()) } } - DataType.ARRAY_B, DataType.MATRIX_B -> { + DataType.ARRAY_B -> { // signed integer byte arrayspec val data = makeArrayFillDataSigned(v.second) if (data.size <= 16) @@ -299,7 +299,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram, private fun makeArrayFillDataUnsigned(value: Value): List { val array = heap.get(value.heapId).array!! - return if (value.type == DataType.ARRAY_UB || value.type == DataType.ARRAY_UW || value.type == DataType.MATRIX_UB) + return if (value.type == DataType.ARRAY_UB || value.type == DataType.ARRAY_UW) array.map { "$"+it.toString(16).padStart(2, '0') } else throw AssemblyError("invalid arrayspec type") @@ -307,7 +307,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram, private fun makeArrayFillDataSigned(value: Value): List { val array = heap.get(value.heapId).array!! - return if (value.type == DataType.ARRAY_B || value.type == DataType.ARRAY_W || value.type == DataType.MATRIX_B) { + return if (value.type == DataType.ARRAY_B || value.type == DataType.ARRAY_W) { array.map { if(it>=0) "$"+it.toString(16).padStart(2, '0') diff --git a/compiler/src/prog8/functions/BuiltinFunctions.kt b/compiler/src/prog8/functions/BuiltinFunctions.kt index 6e5ab5517..a66b2ea1d 100644 --- a/compiler/src/prog8/functions/BuiltinFunctions.kt +++ b/compiler/src/prog8/functions/BuiltinFunctions.kt @@ -97,7 +97,7 @@ fun builtinFunctionReturnType(function: String, args: List, namespa fun datatypeFromListArg(arglist: IExpression): DataType { if(arglist is LiteralValue) { - if(arglist.type==DataType.ARRAY_UB || arglist.type==DataType.ARRAY_UW || arglist.type==DataType.ARRAY_F || arglist.type==DataType.MATRIX_UB) { + if(arglist.type==DataType.ARRAY_UB || arglist.type==DataType.ARRAY_UW || arglist.type==DataType.ARRAY_F) { val dt = arglist.arrayvalue!!.map {it.resultingDatatype(namespace, heap)} if(dt.any { it!=DataType.UBYTE && it!=DataType.UWORD && it!=DataType.FLOAT}) { throw FatalAstException("fuction $function only accepts arrayspec of numeric values") @@ -117,8 +117,6 @@ fun builtinFunctionReturnType(function: String, args: List, namespa DataType.ARRAY_UW -> DataType.UWORD DataType.ARRAY_W -> DataType.WORD DataType.ARRAY_F -> DataType.FLOAT - DataType.MATRIX_UB -> DataType.UBYTE - DataType.MATRIX_B -> DataType.BYTE null -> throw FatalAstException("function requires one argument which is an arrayspec $function") } } @@ -141,8 +139,6 @@ fun builtinFunctionReturnType(function: String, args: List, namespa DataType.ARRAY_UW -> DataType.UWORD DataType.ARRAY_W -> DataType.WORD DataType.ARRAY_F -> DataType.FLOAT - DataType.MATRIX_UB -> DataType.UBYTE - DataType.MATRIX_B -> DataType.BYTE } } "sum" -> { @@ -154,8 +150,6 @@ fun builtinFunctionReturnType(function: String, args: List, namespa DataType.ARRAY_UB, DataType.ARRAY_UW -> DataType.UWORD DataType.ARRAY_B, DataType.ARRAY_W -> DataType.WORD DataType.ARRAY_F -> DataType.FLOAT - DataType.MATRIX_UB -> DataType.UWORD - DataType.MATRIX_B -> DataType.WORD DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS -> DataType.UWORD } } @@ -237,7 +231,7 @@ private fun collectionArgOutputBoolean(args: List, position: Positi throw NotConstArgumentException() function(constants.map { it!!.toDouble() }) } else { - val array = heap.get(iterable.heapId!!).array ?: throw SyntaxError("function requires arrayspec/matrix argument", position) + val array = heap.get(iterable.heapId!!).array ?: throw SyntaxError("function requires array argument", position) function(array.map { it.toDouble() }) } return LiteralValue.fromBoolean(result, position) @@ -313,7 +307,7 @@ private fun builtinAbs(args: List, position: Position, namespace:IN private fun builtinAvg(args: List, position: Position, namespace:INameScope, heap: HeapValues): LiteralValue { if(args.size!=1) - throw SyntaxError("avg requires arrayspec/matrix argument", position) + throw SyntaxError("avg requires array argument", position) val iterable = args[0].constValue(namespace, heap) ?: throw NotConstArgumentException() val result = if(iterable.arrayvalue!=null) { @@ -323,7 +317,7 @@ private fun builtinAvg(args: List, position: Position, namespace:IN (constants.map { it!!.toDouble() }).average() } else { - val array = heap.get(iterable.heapId!!).array ?: throw SyntaxError("avg requires arrayspec/matrix argument", position) + val array = heap.get(iterable.heapId!!).array ?: throw SyntaxError("avg requires array argument", position) array.average() } return numericLiteral(result, args[0].position) @@ -342,7 +336,7 @@ private fun builtinLen(args: List, position: Position, namespace:IN ?: throw NotConstArgumentException() } return when(argument.type) { - DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, DataType.MATRIX_UB, DataType.MATRIX_B -> { + DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W -> { val arraySize = argument.arrayvalue?.size ?: heap.get(argument.heapId!!).arraysize LiteralValue(DataType.UWORD, wordvalue=arraySize, position=args[0].position) } diff --git a/compiler/src/prog8/optimizing/ConstantFolding.kt b/compiler/src/prog8/optimizing/ConstantFolding.kt index b1fba1eed..60f038bb9 100644 --- a/compiler/src/prog8/optimizing/ConstantFolding.kt +++ b/compiler/src/prog8/optimizing/ConstantFolding.kt @@ -25,9 +25,7 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV override fun process(decl: VarDecl): IStatement { // the initializer value can't refer to the variable itself (recursive definition) - if(decl.value?.referencesIdentifier(decl.name) == true|| - decl.arrayspec?.x?.referencesIdentifier(decl.name) == true || - decl.arrayspec?.y?.referencesIdentifier(decl.name) == true) { + if(decl.value?.referencesIdentifier(decl.name) == true || decl.arrayspec?.x?.referencesIdentifier(decl.name) == true) { errors.add(ExpressionError("recursive var declaration", decl.position)) return decl } @@ -53,7 +51,7 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV decl.value = newValue } } - DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, DataType.MATRIX_UB, DataType.MATRIX_B -> { + DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W -> { val litval = decl.value as? LiteralValue if(litval?.type==DataType.FLOAT) errors.add(ExpressionError("arrayspec requires only integers here", litval.position)) @@ -61,10 +59,7 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV if(litval!=null && litval.isArray) { // arrayspec initializer value is an arrayspec already, keep as-is (or convert to WORDs if needed) if(litval.heapId!=null) { - if (decl.datatype == DataType.MATRIX_UB && litval.type != DataType.MATRIX_UB) { - val array = heap.get(litval.heapId).copy(type = DataType.MATRIX_UB) - heap.update(litval.heapId, array) - } else if(decl.datatype==DataType.ARRAY_UW && litval.type == DataType.ARRAY_UB) { + if(decl.datatype==DataType.ARRAY_UW && litval.type == DataType.ARRAY_UB) { val array = heap.get(litval.heapId) if(array.array!=null) { heap.update(litval.heapId, HeapValues.HeapValue(DataType.ARRAY_UW, null, array.array, null)) @@ -82,11 +77,11 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV // arrayspec initializer is empty or a single int, and we know the size; create the arrayspec. val fillvalue = if (litval == null) 0 else litval.asIntegerValue ?: 0 when(decl.datatype){ - DataType.ARRAY_UB, DataType.MATRIX_UB -> { + DataType.ARRAY_UB -> { if(fillvalue !in 0..255) errors.add(ExpressionError("ubyte value overflow", litval?.position ?: decl.position)) } - DataType.ARRAY_B, DataType.MATRIX_B -> { + DataType.ARRAY_B -> { if(fillvalue !in -128..127) errors.add(ExpressionError("byte value overflow", litval?.position ?: decl.position)) } @@ -492,7 +487,7 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV val array: Array = arraylit.arrayvalue!!.map { it.process(this) }.toTypedArray() val allElementsAreConstant = array.fold(true) { c, expr-> c and (expr is LiteralValue)} if(!allElementsAreConstant) { - addError(ExpressionError("arrayspec/matrix literal can contain only constant values", arraylit.position)) + addError(ExpressionError("array literal can contain only constant values", arraylit.position)) return arraylit } else { val valuesInArray = array.map { it.constValue(namespace, heap)!!.asNumericValue!! } @@ -529,9 +524,7 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, - DataType.ARRAY_W, - DataType.MATRIX_UB, - DataType.MATRIX_B -> heap.add(arrayDt, integerArray) + DataType.ARRAY_W -> heap.add(arrayDt, integerArray) DataType.ARRAY_F -> heap.add(arrayDt, doubleArray) else -> throw CompilerException("invalid arrayspec type") } @@ -539,25 +532,6 @@ class ConstantFolding(private val namespace: INameScope, private val heap: HeapV } } - override fun process(arrayIndexedExpression: ArrayIndexedExpression): IExpression { - if(arrayIndexedExpression.arrayspec.y!=null) { - if(arrayIndexedExpression.arrayspec.size()!=null) { - // both x and y are known - // calculate the 2-dimension index i = y*columns + x - if(arrayIndexedExpression.identifier!=null) { - val x = (arrayIndexedExpression.arrayspec.x as LiteralValue).asIntegerValue!! - val y = (arrayIndexedExpression.arrayspec.y as LiteralValue).asIntegerValue!! - val variable = arrayIndexedExpression.identifier.targetStatement(namespace) as? VarDecl - if(variable!=null) { - val index = x + y * (variable.arrayspec!!.x as LiteralValue).asIntegerValue!! - arrayIndexedExpression.arrayspec = ArraySpec(LiteralValue.optimalInteger(index, arrayIndexedExpression.arrayspec.position), null, arrayIndexedExpression.arrayspec.position) - } - } - } - } - return super.process(arrayIndexedExpression) - } - override fun process(assignment: Assignment): IStatement { super.process(assignment) val lv = assignment.value as? LiteralValue diff --git a/compiler/src/prog8/parser/prog8Lexer.java b/compiler/src/prog8/parser/prog8Lexer.java index 909c74dc9..6fc1d082f 100644 --- a/compiler/src/prog8/parser/prog8Lexer.java +++ b/compiler/src/prog8/parser/prog8Lexer.java @@ -1,4 +1,4 @@ -// Generated from ../antlr/prog8.g4 by ANTLR 4.7.1 +// Generated from /home/irmen/Projects/prog8/compiler/antlr/prog8.g4 by ANTLR 4.7 package prog8.parser; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; @@ -11,7 +11,7 @@ import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class prog8Lexer extends Lexer { - static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); } + static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = diff --git a/compiler/src/prog8/parser/prog8Parser.java b/compiler/src/prog8/parser/prog8Parser.java index 366973d27..233c38a96 100644 --- a/compiler/src/prog8/parser/prog8Parser.java +++ b/compiler/src/prog8/parser/prog8Parser.java @@ -1,4 +1,4 @@ -// Generated from ../antlr/prog8.g4 by ANTLR 4.7.1 +// Generated from /home/irmen/Projects/prog8/compiler/antlr/prog8.g4 by ANTLR 4.7 package prog8.parser; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; @@ -11,7 +11,7 @@ import java.util.ArrayList; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class prog8Parser extends Parser { - static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); } + static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = @@ -1033,11 +1033,8 @@ public class prog8Parser extends Parser { } public static class ArrayspecContext extends ParserRuleContext { - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); } public ArrayspecContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); @@ -1048,7 +1045,6 @@ public class prog8Parser extends Parser { public final ArrayspecContext arrayspec() throws RecognitionException { ArrayspecContext _localctx = new ArrayspecContext(_ctx, getState()); enterRule(_localctx, 26, RULE_arrayspec); - int _la; try { enterOuterAlt(_localctx, 1); { @@ -1056,19 +1052,7 @@ public class prog8Parser extends Parser { match(T__26); setState(214); expression(0); - setState(217); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==T__13) { - { - setState(215); - match(T__13); - setState(216); - expression(0); - } - } - - setState(219); + setState(215); match(T__27); } } @@ -1102,11 +1086,11 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(221); + setState(217); assign_target(); - setState(222); + setState(218); match(T__14); - setState(223); + setState(219); expression(0); } } @@ -1142,9 +1126,9 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(225); + setState(221); assign_target(); - setState(226); + setState(222); ((AugassignmentContext)_localctx).operator = _input.LT(1); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << T__31) | (1L << T__32) | (1L << T__33) | (1L << T__34) | (1L << T__35) | (1L << T__36))) != 0)) ) { @@ -1155,7 +1139,7 @@ public class prog8Parser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(227); + setState(223); expression(0); } } @@ -1193,34 +1177,34 @@ public class prog8Parser extends Parser { Assign_targetContext _localctx = new Assign_targetContext(_ctx, getState()); enterRule(_localctx, 32, RULE_assign_target); try { - setState(233); + setState(229); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,12,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); { - setState(229); + setState(225); register(); } break; case 2: enterOuterAlt(_localctx, 2); { - setState(230); + setState(226); identifier(); } break; case 3: enterOuterAlt(_localctx, 3); { - setState(231); + setState(227); scoped_identifier(); } break; case 4: enterOuterAlt(_localctx, 4); { - setState(232); + setState(228); arrayindexed(); } break; @@ -1255,9 +1239,9 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(235); + setState(231); assign_target(); - setState(236); + setState(232); ((PostincrdecrContext)_localctx).operator = _input.LT(1); _la = _input.LA(1); if ( !(_la==T__37 || _la==T__38) ) { @@ -1335,28 +1319,28 @@ public class prog8Parser extends Parser { int _alt; enterOuterAlt(_localctx, 1); { - setState(253); + setState(249); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) { case 1: { - setState(239); + setState(235); match(T__39); - setState(240); + setState(236); expression(0); - setState(241); + setState(237); match(T__40); } break; case 2: { - setState(243); + setState(239); functioncall(); } break; case 3: { - setState(244); + setState(240); ((ExpressionContext)_localctx).prefix = _input.LT(1); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__41) | (1L << T__42))) != 0)) ) { @@ -1367,72 +1351,72 @@ public class prog8Parser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(245); + setState(241); expression(19); } break; case 4: { - setState(246); + setState(242); ((ExpressionContext)_localctx).prefix = match(T__62); - setState(247); + setState(243); expression(6); } break; case 5: { - setState(248); + setState(244); literalvalue(); } break; case 6: { - setState(249); + setState(245); register(); } break; case 7: { - setState(250); + setState(246); identifier(); } break; case 8: { - setState(251); + setState(247); scoped_identifier(); } break; case 9: { - setState(252); + setState(248); arrayindexed(); } break; } _ctx.stop = _input.LT(-1); - setState(297); + setState(293); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,17,_ctx); + _alt = getInterpreter().adaptivePredict(_input,16,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(295); + setState(291); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) { case 1: { _localctx = new ExpressionContext(_parentctx, _parentState); _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(255); + setState(251); if (!(precpred(_ctx, 18))) throw new FailedPredicateException(this, "precpred(_ctx, 18)"); - setState(256); + setState(252); ((ExpressionContext)_localctx).bop = match(T__43); - setState(257); + setState(253); ((ExpressionContext)_localctx).right = expression(19); } break; @@ -1442,9 +1426,9 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(258); + setState(254); if (!(precpred(_ctx, 17))) throw new FailedPredicateException(this, "precpred(_ctx, 17)"); - setState(259); + setState(255); ((ExpressionContext)_localctx).bop = _input.LT(1); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__44) | (1L << T__45) | (1L << T__46) | (1L << T__47))) != 0)) ) { @@ -1455,7 +1439,7 @@ public class prog8Parser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(260); + setState(256); ((ExpressionContext)_localctx).right = expression(18); } break; @@ -1465,9 +1449,9 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(261); + setState(257); if (!(precpred(_ctx, 16))) throw new FailedPredicateException(this, "precpred(_ctx, 16)"); - setState(262); + setState(258); ((ExpressionContext)_localctx).bop = _input.LT(1); _la = _input.LA(1); if ( !(_la==T__41 || _la==T__42) ) { @@ -1478,7 +1462,7 @@ public class prog8Parser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(263); + setState(259); ((ExpressionContext)_localctx).right = expression(17); } break; @@ -1488,9 +1472,9 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(264); + setState(260); if (!(precpred(_ctx, 15))) throw new FailedPredicateException(this, "precpred(_ctx, 15)"); - setState(265); + setState(261); ((ExpressionContext)_localctx).bop = _input.LT(1); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__48) | (1L << T__49) | (1L << T__50) | (1L << T__51))) != 0)) ) { @@ -1501,7 +1485,7 @@ public class prog8Parser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(266); + setState(262); ((ExpressionContext)_localctx).right = expression(16); } break; @@ -1511,9 +1495,9 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(267); + setState(263); if (!(precpred(_ctx, 14))) throw new FailedPredicateException(this, "precpred(_ctx, 14)"); - setState(268); + setState(264); ((ExpressionContext)_localctx).bop = _input.LT(1); _la = _input.LA(1); if ( !(_la==T__52 || _la==T__53) ) { @@ -1524,7 +1508,7 @@ public class prog8Parser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(269); + setState(265); ((ExpressionContext)_localctx).right = expression(15); } break; @@ -1534,11 +1518,11 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(270); + setState(266); if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)"); - setState(271); + setState(267); ((ExpressionContext)_localctx).bop = match(T__54); - setState(272); + setState(268); ((ExpressionContext)_localctx).right = expression(14); } break; @@ -1548,11 +1532,11 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(273); + setState(269); if (!(precpred(_ctx, 12))) throw new FailedPredicateException(this, "precpred(_ctx, 12)"); - setState(274); + setState(270); ((ExpressionContext)_localctx).bop = match(T__55); - setState(275); + setState(271); ((ExpressionContext)_localctx).right = expression(13); } break; @@ -1562,11 +1546,11 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(276); + setState(272); if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)"); - setState(277); + setState(273); ((ExpressionContext)_localctx).bop = match(T__56); - setState(278); + setState(274); ((ExpressionContext)_localctx).right = expression(12); } break; @@ -1576,11 +1560,11 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(279); + setState(275); if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)"); - setState(280); + setState(276); ((ExpressionContext)_localctx).bop = match(T__59); - setState(281); + setState(277); ((ExpressionContext)_localctx).right = expression(10); } break; @@ -1590,11 +1574,11 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(282); + setState(278); if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); - setState(283); + setState(279); ((ExpressionContext)_localctx).bop = match(T__60); - setState(284); + setState(280); ((ExpressionContext)_localctx).right = expression(9); } break; @@ -1604,11 +1588,11 @@ public class prog8Parser extends Parser { _localctx.left = _prevctx; _localctx.left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(285); + setState(281); if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); - setState(286); + setState(282); ((ExpressionContext)_localctx).bop = match(T__61); - setState(287); + setState(283); ((ExpressionContext)_localctx).right = expression(8); } break; @@ -1618,20 +1602,20 @@ public class prog8Parser extends Parser { _localctx.rangefrom = _prevctx; _localctx.rangefrom = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(288); + setState(284); if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)"); - setState(289); + setState(285); match(T__57); - setState(290); + setState(286); ((ExpressionContext)_localctx).rangeto = expression(0); - setState(293); + setState(289); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) { case 1: { - setState(291); + setState(287); match(T__58); - setState(292); + setState(288); ((ExpressionContext)_localctx).rangestep = expression(0); } break; @@ -1641,9 +1625,9 @@ public class prog8Parser extends Parser { } } } - setState(299); + setState(295); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,17,_ctx); + _alt = getInterpreter().adaptivePredict(_input,16,_ctx); } } } @@ -1683,29 +1667,29 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(303); + setState(299); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,18,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,17,_ctx) ) { case 1: { - setState(300); + setState(296); identifier(); } break; case 2: { - setState(301); + setState(297); scoped_identifier(); } break; case 3: { - setState(302); + setState(298); register(); } break; } - setState(305); + setState(301); arrayspec(); } } @@ -1743,35 +1727,35 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(309); + setState(305); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,19,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,18,_ctx) ) { case 1: { - setState(307); + setState(303); identifier(); } break; case 2: { - setState(308); + setState(304); scoped_identifier(); } break; } - setState(311); + setState(307); match(T__39); - setState(313); + setState(309); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__26) | (1L << T__39) | (1L << T__41) | (1L << T__42) | (1L << T__62))) != 0) || ((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & ((1L << (T__67 - 68)) | (1L << (T__68 - 68)) | (1L << (T__69 - 68)) | (1L << (T__70 - 68)) | (1L << (T__71 - 68)) | (1L << (T__72 - 68)) | (1L << (T__78 - 68)) | (1L << (T__79 - 68)) | (1L << (NAME - 68)) | (1L << (DEC_INTEGER - 68)) | (1L << (HEX_INTEGER - 68)) | (1L << (BIN_INTEGER - 68)) | (1L << (FLOAT_NUMBER - 68)) | (1L << (STRING - 68)) | (1L << (SINGLECHAR - 68)))) != 0)) { { - setState(312); + setState(308); expression_list(); } } - setState(315); + setState(311); match(T__40); } } @@ -1809,35 +1793,35 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(319); + setState(315); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,21,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,20,_ctx) ) { case 1: { - setState(317); + setState(313); identifier(); } break; case 2: { - setState(318); + setState(314); scoped_identifier(); } break; } - setState(321); + setState(317); match(T__39); - setState(323); + setState(319); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__26) | (1L << T__39) | (1L << T__41) | (1L << T__42) | (1L << T__62))) != 0) || ((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & ((1L << (T__67 - 68)) | (1L << (T__68 - 68)) | (1L << (T__69 - 68)) | (1L << (T__70 - 68)) | (1L << (T__71 - 68)) | (1L << (T__72 - 68)) | (1L << (T__78 - 68)) | (1L << (T__79 - 68)) | (1L << (NAME - 68)) | (1L << (DEC_INTEGER - 68)) | (1L << (HEX_INTEGER - 68)) | (1L << (BIN_INTEGER - 68)) | (1L << (FLOAT_NUMBER - 68)) | (1L << (STRING - 68)) | (1L << (SINGLECHAR - 68)))) != 0)) { { - setState(322); + setState(318); expression_list(); } } - setState(325); + setState(321); match(T__40); } } @@ -1876,31 +1860,31 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(327); + setState(323); expression(0); - setState(335); + setState(331); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__13) { { { - setState(328); + setState(324); match(T__13); - setState(330); + setState(326); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(329); + setState(325); match(EOL); } } - setState(332); + setState(328); expression(0); } } - setState(337); + setState(333); _errHandler.sync(this); _la = _input.LA(1); } @@ -1933,14 +1917,14 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(338); + setState(334); match(T__63); - setState(340); + setState(336); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,25,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,24,_ctx) ) { case 1: { - setState(339); + setState(335); expression_list(); } break; @@ -1971,7 +1955,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(342); + setState(338); match(T__64); } } @@ -1999,7 +1983,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(344); + setState(340); match(T__65); } } @@ -2028,7 +2012,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(346); + setState(342); match(NAME); } } @@ -2061,9 +2045,9 @@ public class prog8Parser extends Parser { int _alt; enterOuterAlt(_localctx, 1); { - setState(348); + setState(344); match(NAME); - setState(351); + setState(347); _errHandler.sync(this); _alt = 1; do { @@ -2071,9 +2055,9 @@ public class prog8Parser extends Parser { case 1: { { - setState(349); + setState(345); match(T__66); - setState(350); + setState(346); match(NAME); } } @@ -2081,9 +2065,9 @@ public class prog8Parser extends Parser { default: throw new NoViableAltException(this); } - setState(353); + setState(349); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,26,_ctx); + _alt = getInterpreter().adaptivePredict(_input,25,_ctx); } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ); } } @@ -2112,7 +2096,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(355); + setState(351); _la = _input.LA(1); if ( !(((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & ((1L << (T__67 - 68)) | (1L << (T__68 - 68)) | (1L << (T__69 - 68)) | (1L << (T__70 - 68)) | (1L << (T__71 - 68)) | (1L << (T__72 - 68)))) != 0)) ) { _errHandler.recoverInline(this); @@ -2149,7 +2133,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(357); + setState(353); _la = _input.LA(1); if ( !(((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & ((1L << (T__73 - 74)) | (1L << (T__74 - 74)) | (1L << (T__75 - 74)) | (1L << (T__76 - 74)))) != 0)) ) { _errHandler.recoverInline(this); @@ -2193,7 +2177,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(359); + setState(355); ((IntegerliteralContext)_localctx).intpart = _input.LT(1); _la = _input.LA(1); if ( !(((((_la - 113)) & ~0x3f) == 0 && ((1L << (_la - 113)) & ((1L << (DEC_INTEGER - 113)) | (1L << (HEX_INTEGER - 113)) | (1L << (BIN_INTEGER - 113)))) != 0)) ) { @@ -2204,12 +2188,12 @@ public class prog8Parser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(361); + setState(357); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,27,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,26,_ctx) ) { case 1: { - setState(360); + setState(356); wordsuffix(); } break; @@ -2240,7 +2224,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(363); + setState(359); match(T__77); } } @@ -2269,7 +2253,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(365); + setState(361); _la = _input.LA(1); if ( !(_la==T__78 || _la==T__79) ) { _errHandler.recoverInline(this); @@ -2316,57 +2300,57 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(367); + setState(363); match(T__26); - setState(369); + setState(365); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(368); + setState(364); match(EOL); } } - setState(371); + setState(367); expression(0); - setState(379); + setState(375); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__13) { { { - setState(372); + setState(368); match(T__13); - setState(374); + setState(370); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(373); + setState(369); match(EOL); } } - setState(376); + setState(372); expression(0); } } - setState(381); + setState(377); _errHandler.sync(this); _la = _input.LA(1); } - setState(383); + setState(379); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(382); + setState(378); match(EOL); } } - setState(385); + setState(381); match(T__27); } } @@ -2395,7 +2379,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(387); + setState(383); match(STRING); } } @@ -2424,7 +2408,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(389); + setState(385); match(SINGLECHAR); } } @@ -2453,7 +2437,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(391); + setState(387); match(FLOAT_NUMBER); } } @@ -2497,7 +2481,7 @@ public class prog8Parser extends Parser { LiteralvalueContext _localctx = new LiteralvalueContext(_ctx, getState()); enterRule(_localctx, 74, RULE_literalvalue); try { - setState(399); + setState(395); _errHandler.sync(this); switch (_input.LA(1)) { case DEC_INTEGER: @@ -2505,7 +2489,7 @@ public class prog8Parser extends Parser { case BIN_INTEGER: enterOuterAlt(_localctx, 1); { - setState(393); + setState(389); integerliteral(); } break; @@ -2513,35 +2497,35 @@ public class prog8Parser extends Parser { case T__79: enterOuterAlt(_localctx, 2); { - setState(394); + setState(390); booleanliteral(); } break; case T__26: enterOuterAlt(_localctx, 3); { - setState(395); + setState(391); arrayliteral(); } break; case STRING: enterOuterAlt(_localctx, 4); { - setState(396); + setState(392); stringliteral(); } break; case SINGLECHAR: enterOuterAlt(_localctx, 5); { - setState(397); + setState(393); charliteral(); } break; case FLOAT_NUMBER: enterOuterAlt(_localctx, 6); { - setState(398); + setState(394); floatliteral(); } break; @@ -2574,9 +2558,9 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(401); + setState(397); match(T__80); - setState(402); + setState(398); match(INLINEASMBLOCK); } } @@ -2618,38 +2602,38 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(404); + setState(400); match(T__81); - setState(405); + setState(401); identifier(); - setState(406); + setState(402); match(T__39); - setState(408); + setState(404); _errHandler.sync(this); _la = _input.LA(1); if (_la==NAME) { { - setState(407); + setState(403); sub_params(); } } - setState(410); + setState(406); match(T__40); - setState(412); + setState(408); _errHandler.sync(this); _la = _input.LA(1); if (_la==T__82) { { - setState(411); + setState(407); sub_return_part(); } } { - setState(414); + setState(410); statement_block(); - setState(415); + setState(411); match(EOL); } } @@ -2681,9 +2665,9 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(417); + setState(413); match(T__82); - setState(418); + setState(414); sub_returns(); } } @@ -2722,16 +2706,16 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(420); + setState(416); match(T__83); - setState(421); + setState(417); match(EOL); - setState(426); + setState(422); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__3) | (1L << T__4) | (1L << T__5) | (1L << T__6) | (1L << T__7) | (1L << T__8) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__15) | (1L << T__16) | (1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (T__63 - 64)) | (1L << (T__64 - 64)) | (1L << (T__65 - 64)) | (1L << (T__67 - 64)) | (1L << (T__68 - 64)) | (1L << (T__69 - 64)) | (1L << (T__70 - 64)) | (1L << (T__71 - 64)) | (1L << (T__72 - 64)) | (1L << (T__80 - 64)) | (1L << (T__81 - 64)) | (1L << (T__85 - 64)) | (1L << (T__88 - 64)) | (1L << (T__90 - 64)) | (1L << (T__91 - 64)) | (1L << (T__92 - 64)) | (1L << (T__93 - 64)) | (1L << (T__94 - 64)) | (1L << (T__95 - 64)) | (1L << (T__96 - 64)) | (1L << (T__97 - 64)) | (1L << (T__98 - 64)) | (1L << (T__99 - 64)) | (1L << (T__100 - 64)) | (1L << (T__101 - 64)) | (1L << (T__102 - 64)) | (1L << (T__104 - 64)) | (1L << (T__105 - 64)) | (1L << (EOL - 64)) | (1L << (NAME - 64)))) != 0)) { { - setState(424); + setState(420); _errHandler.sync(this); switch (_input.LA(1)) { case T__2: @@ -2786,13 +2770,13 @@ public class prog8Parser extends Parser { case T__105: case NAME: { - setState(422); + setState(418); statement(); } break; case EOL: { - setState(423); + setState(419); match(EOL); } break; @@ -2800,11 +2784,11 @@ public class prog8Parser extends Parser { throw new NoViableAltException(this); } } - setState(428); + setState(424); _errHandler.sync(this); _la = _input.LA(1); } - setState(429); + setState(425); match(T__84); } } @@ -2843,31 +2827,31 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(431); + setState(427); sub_param(); - setState(439); + setState(435); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__13) { { { - setState(432); + setState(428); match(T__13); - setState(434); + setState(430); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(433); + setState(429); match(EOL); } } - setState(436); + setState(432); sub_param(); } } - setState(441); + setState(437); _errHandler.sync(this); _la = _input.LA(1); } @@ -2903,11 +2887,11 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(442); + setState(438); identifier(); - setState(443); + setState(439); match(T__1); - setState(444); + setState(440); datatype(); } } @@ -2946,31 +2930,31 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(446); + setState(442); datatype(); - setState(454); + setState(450); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__13) { { { - setState(447); + setState(443); match(T__13); - setState(449); + setState(445); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(448); + setState(444); match(EOL); } } - setState(451); + setState(447); datatype(); } } - setState(456); + setState(452); _errHandler.sync(this); _la = _input.LA(1); } @@ -3019,70 +3003,70 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(457); + setState(453); match(T__85); - setState(458); + setState(454); identifier(); - setState(459); + setState(455); match(T__39); - setState(461); + setState(457); _errHandler.sync(this); _la = _input.LA(1); if (_la==NAME) { { - setState(460); + setState(456); asmsub_params(); } } - setState(463); + setState(459); match(T__40); - setState(464); + setState(460); match(T__82); - setState(465); + setState(461); match(T__86); - setState(466); + setState(462); match(T__39); - setState(468); + setState(464); _errHandler.sync(this); _la = _input.LA(1); if (((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & ((1L << (T__67 - 68)) | (1L << (T__68 - 68)) | (1L << (T__69 - 68)) | (1L << (T__70 - 68)) | (1L << (T__71 - 68)) | (1L << (T__72 - 68)))) != 0)) { { - setState(467); + setState(463); clobber(); } } - setState(470); + setState(466); match(T__40); - setState(471); + setState(467); match(T__82); - setState(472); + setState(468); match(T__39); - setState(474); + setState(470); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25))) != 0)) { { - setState(473); + setState(469); asmsub_returns(); } } - setState(476); + setState(472); match(T__40); - setState(479); + setState(475); _errHandler.sync(this); switch (_input.LA(1)) { case T__14: { - setState(477); + setState(473); asmsub_address(); } break; case T__83: { - setState(478); + setState(474); statement_block(); } break; @@ -3119,9 +3103,9 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(481); + setState(477); match(T__14); - setState(482); + setState(478); ((Asmsub_addressContext)_localctx).address = integerliteral(); } } @@ -3160,31 +3144,31 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(484); + setState(480); asmsub_param(); - setState(492); + setState(488); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__13) { { { - setState(485); + setState(481); match(T__13); - setState(487); + setState(483); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(486); + setState(482); match(EOL); } } - setState(489); + setState(485); asmsub_param(); } } - setState(494); + setState(490); _errHandler.sync(this); _la = _input.LA(1); } @@ -3226,15 +3210,15 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(495); + setState(491); identifier(); - setState(496); + setState(492); match(T__1); - setState(497); + setState(493); datatype(); - setState(498); + setState(494); match(T__87); - setState(501); + setState(497); _errHandler.sync(this); switch (_input.LA(1)) { case T__67: @@ -3244,7 +3228,7 @@ public class prog8Parser extends Parser { case T__71: case T__72: { - setState(499); + setState(495); register(); } break; @@ -3253,7 +3237,7 @@ public class prog8Parser extends Parser { case T__75: case T__76: { - setState(500); + setState(496); statusregister(); } break; @@ -3293,21 +3277,21 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(503); + setState(499); register(); - setState(508); + setState(504); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__13) { { { - setState(504); + setState(500); match(T__13); - setState(505); + setState(501); register(); } } - setState(510); + setState(506); _errHandler.sync(this); _la = _input.LA(1); } @@ -3348,31 +3332,31 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(511); + setState(507); asmsub_return(); - setState(519); + setState(515); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__13) { { { - setState(512); + setState(508); match(T__13); - setState(514); + setState(510); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(513); + setState(509); match(EOL); } } - setState(516); + setState(512); asmsub_return(); } } - setState(521); + setState(517); _errHandler.sync(this); _la = _input.LA(1); } @@ -3411,11 +3395,11 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(522); + setState(518); datatype(); - setState(523); + setState(519); match(T__87); - setState(526); + setState(522); _errHandler.sync(this); switch (_input.LA(1)) { case T__67: @@ -3425,7 +3409,7 @@ public class prog8Parser extends Parser { case T__71: case T__72: { - setState(524); + setState(520); register(); } break; @@ -3434,7 +3418,7 @@ public class prog8Parser extends Parser { case T__75: case T__76: { - setState(525); + setState(521); statusregister(); } break; @@ -3484,21 +3468,21 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(528); + setState(524); match(T__88); - setState(529); + setState(525); expression(0); - setState(531); + setState(527); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(530); + setState(526); match(EOL); } } - setState(535); + setState(531); _errHandler.sync(this); switch (_input.LA(1)) { case T__2: @@ -3553,40 +3537,40 @@ public class prog8Parser extends Parser { case T__105: case NAME: { - setState(533); + setState(529); statement(); } break; case T__83: { - setState(534); + setState(530); statement_block(); } break; default: throw new NoViableAltException(this); } - setState(538); + setState(534); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,54,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,53,_ctx) ) { case 1: { - setState(537); + setState(533); match(EOL); } break; } - setState(541); + setState(537); _errHandler.sync(this); _la = _input.LA(1); if (_la==T__89) { { - setState(540); + setState(536); else_part(); } } - setState(543); + setState(539); match(EOL); } } @@ -3622,19 +3606,19 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(545); + setState(541); match(T__89); - setState(547); + setState(543); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(546); + setState(542); match(EOL); } } - setState(551); + setState(547); _errHandler.sync(this); switch (_input.LA(1)) { case T__2: @@ -3689,13 +3673,13 @@ public class prog8Parser extends Parser { case T__105: case NAME: { - setState(549); + setState(545); statement(); } break; case T__83: { - setState(550); + setState(546); statement_block(); } break; @@ -3745,19 +3729,19 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(553); + setState(549); branchcondition(); - setState(555); + setState(551); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(554); + setState(550); match(EOL); } } - setState(559); + setState(555); _errHandler.sync(this); switch (_input.LA(1)) { case T__2: @@ -3812,40 +3796,40 @@ public class prog8Parser extends Parser { case T__105: case NAME: { - setState(557); + setState(553); statement(); } break; case T__83: { - setState(558); + setState(554); statement_block(); } break; default: throw new NoViableAltException(this); } - setState(562); + setState(558); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,60,_ctx) ) { + switch ( getInterpreter().adaptivePredict(_input,59,_ctx) ) { case 1: { - setState(561); + setState(557); match(EOL); } break; } - setState(565); + setState(561); _errHandler.sync(this); _la = _input.LA(1); if (_la==T__89) { { - setState(564); + setState(560); else_part(); } } - setState(567); + setState(563); match(EOL); } } @@ -3874,7 +3858,7 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(569); + setState(565); _la = _input.LA(1); if ( !(((((_la - 91)) & ~0x3f) == 0 && ((1L << (_la - 91)) & ((1L << (T__90 - 91)) | (1L << (T__91 - 91)) | (1L << (T__92 - 91)) | (1L << (T__93 - 91)) | (1L << (T__94 - 91)) | (1L << (T__95 - 91)) | (1L << (T__96 - 91)) | (1L << (T__97 - 91)) | (1L << (T__98 - 91)) | (1L << (T__99 - 91)) | (1L << (T__100 - 91)) | (1L << (T__101 - 91)))) != 0)) ) { _errHandler.recoverInline(this); @@ -3927,19 +3911,19 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(571); + setState(567); match(T__102); - setState(573); + setState(569); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25))) != 0)) { { - setState(572); + setState(568); datatype(); } } - setState(577); + setState(573); _errHandler.sync(this); switch (_input.LA(1)) { case T__67: @@ -3949,34 +3933,34 @@ public class prog8Parser extends Parser { case T__71: case T__72: { - setState(575); + setState(571); register(); } break; case NAME: { - setState(576); + setState(572); identifier(); } break; default: throw new NoViableAltException(this); } - setState(579); + setState(575); match(T__103); - setState(580); + setState(576); expression(0); - setState(582); + setState(578); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(581); + setState(577); match(EOL); } } - setState(584); + setState(580); statement_block(); } } @@ -4015,21 +3999,21 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(586); + setState(582); match(T__104); - setState(587); + setState(583); expression(0); - setState(589); + setState(585); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(588); + setState(584); match(EOL); } } - setState(593); + setState(589); _errHandler.sync(this); switch (_input.LA(1)) { case T__2: @@ -4084,13 +4068,13 @@ public class prog8Parser extends Parser { case T__105: case NAME: { - setState(591); + setState(587); statement(); } break; case T__83: { - setState(592); + setState(588); statement_block(); } break; @@ -4134,9 +4118,9 @@ public class prog8Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(595); + setState(591); match(T__105); - setState(598); + setState(594); _errHandler.sync(this); switch (_input.LA(1)) { case T__2: @@ -4191,32 +4175,32 @@ public class prog8Parser extends Parser { case T__105: case NAME: { - setState(596); + setState(592); statement(); } break; case T__83: { - setState(597); + setState(593); statement_block(); } break; default: throw new NoViableAltException(this); } - setState(601); + setState(597); _errHandler.sync(this); _la = _input.LA(1); if (_la==EOL) { { - setState(600); + setState(596); match(EOL); } } - setState(603); + setState(599); match(T__106); - setState(604); + setState(600); expression(0); } } @@ -4269,7 +4253,7 @@ public class prog8Parser extends Parser { } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3y\u0261\4\2\t\2\4"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3y\u025d\4\2\t\2\4"+ "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+ "\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ @@ -4283,222 +4267,221 @@ public class prog8Parser extends Parser { "\7\3\7\3\7\3\7\5\7\u00ad\n\7\3\b\3\b\5\b\u00b1\n\b\3\b\3\b\3\b\7\b\u00b6"+ "\n\b\f\b\16\b\u00b9\13\b\5\b\u00bb\n\b\3\t\3\t\3\t\5\t\u00c0\n\t\3\n\3"+ "\n\5\n\u00c4\n\n\3\n\3\n\3\13\3\13\5\13\u00ca\n\13\3\13\3\13\3\13\3\13"+ - "\3\f\3\f\3\f\3\r\3\r\3\r\3\16\3\16\3\17\3\17\3\17\3\17\5\17\u00dc\n\17"+ - "\3\17\3\17\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22"+ - "\5\22\u00ec\n\22\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24"+ - "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\5\24\u0100\n\24\3\24\3\24\3\24\3\24"+ + "\3\f\3\f\3\f\3\r\3\r\3\r\3\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20\3\20"+ + "\3\20\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\5\22\u00e8\n\22\3\23\3\23"+ + "\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24"+ + "\3\24\3\24\5\24\u00fc\n\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24"+ "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24"+ "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24"+ - "\3\24\3\24\3\24\3\24\3\24\3\24\5\24\u0128\n\24\7\24\u012a\n\24\f\24\16"+ - "\24\u012d\13\24\3\25\3\25\3\25\5\25\u0132\n\25\3\25\3\25\3\26\3\26\5\26"+ - "\u0138\n\26\3\26\3\26\5\26\u013c\n\26\3\26\3\26\3\27\3\27\5\27\u0142\n"+ - "\27\3\27\3\27\5\27\u0146\n\27\3\27\3\27\3\30\3\30\3\30\5\30\u014d\n\30"+ - "\3\30\7\30\u0150\n\30\f\30\16\30\u0153\13\30\3\31\3\31\5\31\u0157\n\31"+ - "\3\32\3\32\3\33\3\33\3\34\3\34\3\35\3\35\3\35\6\35\u0162\n\35\r\35\16"+ - "\35\u0163\3\36\3\36\3\37\3\37\3 \3 \5 \u016c\n \3!\3!\3\"\3\"\3#\3#\5"+ - "#\u0174\n#\3#\3#\3#\5#\u0179\n#\3#\7#\u017c\n#\f#\16#\u017f\13#\3#\5#"+ - "\u0182\n#\3#\3#\3$\3$\3%\3%\3&\3&\3\'\3\'\3\'\3\'\3\'\3\'\5\'\u0192\n"+ - "\'\3(\3(\3(\3)\3)\3)\3)\5)\u019b\n)\3)\3)\5)\u019f\n)\3)\3)\3)\3*\3*\3"+ - "*\3+\3+\3+\3+\7+\u01ab\n+\f+\16+\u01ae\13+\3+\3+\3,\3,\3,\5,\u01b5\n,"+ - "\3,\7,\u01b8\n,\f,\16,\u01bb\13,\3-\3-\3-\3-\3.\3.\3.\5.\u01c4\n.\3.\7"+ - ".\u01c7\n.\f.\16.\u01ca\13.\3/\3/\3/\3/\5/\u01d0\n/\3/\3/\3/\3/\3/\5/"+ - "\u01d7\n/\3/\3/\3/\3/\5/\u01dd\n/\3/\3/\3/\5/\u01e2\n/\3\60\3\60\3\60"+ - "\3\61\3\61\3\61\5\61\u01ea\n\61\3\61\7\61\u01ed\n\61\f\61\16\61\u01f0"+ - "\13\61\3\62\3\62\3\62\3\62\3\62\3\62\5\62\u01f8\n\62\3\63\3\63\3\63\7"+ - "\63\u01fd\n\63\f\63\16\63\u0200\13\63\3\64\3\64\3\64\5\64\u0205\n\64\3"+ - "\64\7\64\u0208\n\64\f\64\16\64\u020b\13\64\3\65\3\65\3\65\3\65\5\65\u0211"+ - "\n\65\3\66\3\66\3\66\5\66\u0216\n\66\3\66\3\66\5\66\u021a\n\66\3\66\5"+ - "\66\u021d\n\66\3\66\5\66\u0220\n\66\3\66\3\66\3\67\3\67\5\67\u0226\n\67"+ - "\3\67\3\67\5\67\u022a\n\67\38\38\58\u022e\n8\38\38\58\u0232\n8\38\58\u0235"+ - "\n8\38\58\u0238\n8\38\38\39\39\3:\3:\5:\u0240\n:\3:\3:\5:\u0244\n:\3:"+ - "\3:\3:\5:\u0249\n:\3:\3:\3;\3;\3;\5;\u0250\n;\3;\3;\5;\u0254\n;\3<\3<"+ - "\3<\5<\u0259\n<\3<\5<\u025c\n<\3<\3<\3<\3<\2\3&=\2\4\6\b\n\f\16\20\22"+ - "\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJLNPRTVXZ\\^`bdfhjlnp"+ - "rtv\2\20\3\2\6\17\3\2\24\34\3\2\37\'\3\2()\4\2\3\3,-\3\2/\62\3\2,-\3\2"+ - "\63\66\3\2\678\3\2FK\3\2LO\3\2su\3\2QR\3\2]h\2\u0298\2|\3\2\2\2\4\u0083"+ - "\3\2\2\2\6\u0085\3\2\2\2\b\u00a3\3\2\2\2\n\u00a5\3\2\2\2\f\u00a8\3\2\2"+ - "\2\16\u00ae\3\2\2\2\20\u00bf\3\2\2\2\22\u00c1\3\2\2\2\24\u00c7\3\2\2\2"+ - "\26\u00cf\3\2\2\2\30\u00d2\3\2\2\2\32\u00d5\3\2\2\2\34\u00d7\3\2\2\2\36"+ - "\u00df\3\2\2\2 \u00e3\3\2\2\2\"\u00eb\3\2\2\2$\u00ed\3\2\2\2&\u00ff\3"+ - "\2\2\2(\u0131\3\2\2\2*\u0137\3\2\2\2,\u0141\3\2\2\2.\u0149\3\2\2\2\60"+ - "\u0154\3\2\2\2\62\u0158\3\2\2\2\64\u015a\3\2\2\2\66\u015c\3\2\2\28\u015e"+ - "\3\2\2\2:\u0165\3\2\2\2<\u0167\3\2\2\2>\u0169\3\2\2\2@\u016d\3\2\2\2B"+ - "\u016f\3\2\2\2D\u0171\3\2\2\2F\u0185\3\2\2\2H\u0187\3\2\2\2J\u0189\3\2"+ - "\2\2L\u0191\3\2\2\2N\u0193\3\2\2\2P\u0196\3\2\2\2R\u01a3\3\2\2\2T\u01a6"+ - "\3\2\2\2V\u01b1\3\2\2\2X\u01bc\3\2\2\2Z\u01c0\3\2\2\2\\\u01cb\3\2\2\2"+ - "^\u01e3\3\2\2\2`\u01e6\3\2\2\2b\u01f1\3\2\2\2d\u01f9\3\2\2\2f\u0201\3"+ - "\2\2\2h\u020c\3\2\2\2j\u0212\3\2\2\2l\u0223\3\2\2\2n\u022b\3\2\2\2p\u023b"+ - "\3\2\2\2r\u023d\3\2\2\2t\u024c\3\2\2\2v\u0255\3\2\2\2x{\5\4\3\2y{\7q\2"+ - "\2zx\3\2\2\2zy\3\2\2\2{~\3\2\2\2|z\3\2\2\2|}\3\2\2\2}\177\3\2\2\2~|\3"+ - "\2\2\2\177\u0080\7\2\2\3\u0080\3\3\2\2\2\u0081\u0084\5\16\b\2\u0082\u0084"+ - "\5\6\4\2\u0083\u0081\3\2\2\2\u0083\u0082\3\2\2\2\u0084\5\3\2\2\2\u0085"+ - "\u0086\7\3\2\2\u0086\u0088\5\66\34\2\u0087\u0089\5> \2\u0088\u0087\3\2"+ - "\2\2\u0088\u0089\3\2\2\2\u0089\u008a\3\2\2\2\u008a\u008b\5T+\2\u008b\u008c"+ - "\7q\2\2\u008c\7\3\2\2\2\u008d\u00a4\5\16\b\2\u008e\u00a4\5\24\13\2\u008f"+ - "\u00a4\5\22\n\2\u0090\u00a4\5\26\f\2\u0091\u00a4\5\30\r\2\u0092\u00a4"+ - "\5\36\20\2\u0093\u00a4\5 \21\2\u0094\u00a4\5\f\7\2\u0095\u00a4\5$\23\2"+ - "\u0096\u00a4\5,\27\2\u0097\u00a4\5j\66\2\u0098\u00a4\5n8\2\u0099\u00a4"+ - "\5P)\2\u009a\u00a4\5\\/\2\u009b\u00a4\5N(\2\u009c\u00a4\5\60\31\2\u009d"+ - "\u00a4\5r:\2\u009e\u00a4\5t;\2\u009f\u00a4\5v<\2\u00a0\u00a4\5\62\32\2"+ - "\u00a1\u00a4\5\64\33\2\u00a2\u00a4\5\n\6\2\u00a3\u008d\3\2\2\2\u00a3\u008e"+ - "\3\2\2\2\u00a3\u008f\3\2\2\2\u00a3\u0090\3\2\2\2\u00a3\u0091\3\2\2\2\u00a3"+ - "\u0092\3\2\2\2\u00a3\u0093\3\2\2\2\u00a3\u0094\3\2\2\2\u00a3\u0095\3\2"+ - "\2\2\u00a3\u0096\3\2\2\2\u00a3\u0097\3\2\2\2\u00a3\u0098\3\2\2\2\u00a3"+ - "\u0099\3\2\2\2\u00a3\u009a\3\2\2\2\u00a3\u009b\3\2\2\2\u00a3\u009c\3\2"+ - "\2\2\u00a3\u009d\3\2\2\2\u00a3\u009e\3\2\2\2\u00a3\u009f\3\2\2\2\u00a3"+ - "\u00a0\3\2\2\2\u00a3\u00a1\3\2\2\2\u00a3\u00a2\3\2\2\2\u00a4\t\3\2\2\2"+ - "\u00a5\u00a6\5\66\34\2\u00a6\u00a7\7\4\2\2\u00a7\13\3\2\2\2\u00a8\u00ac"+ - "\7\5\2\2\u00a9\u00ad\5> \2\u00aa\u00ad\5\66\34\2\u00ab\u00ad\58\35\2\u00ac"+ - "\u00a9\3\2\2\2\u00ac\u00aa\3\2\2\2\u00ac\u00ab\3\2\2\2\u00ad\r\3\2\2\2"+ - "\u00ae\u00ba\t\2\2\2\u00af\u00b1\5\20\t\2\u00b0\u00af\3\2\2\2\u00b0\u00b1"+ - "\3\2\2\2\u00b1\u00bb\3\2\2\2\u00b2\u00b7\5\20\t\2\u00b3\u00b4\7\20\2\2"+ - "\u00b4\u00b6\5\20\t\2\u00b5\u00b3\3\2\2\2\u00b6\u00b9\3\2\2\2\u00b7\u00b5"+ - "\3\2\2\2\u00b7\u00b8\3\2\2\2\u00b8\u00bb\3\2\2\2\u00b9\u00b7\3\2\2\2\u00ba"+ - "\u00b0\3\2\2\2\u00ba\u00b2\3\2\2\2\u00bb\17\3\2\2\2\u00bc\u00c0\5F$\2"+ - "\u00bd\u00c0\5\66\34\2\u00be\u00c0\5> \2\u00bf\u00bc\3\2\2\2\u00bf\u00bd"+ - "\3\2\2\2\u00bf\u00be\3\2\2\2\u00c0\21\3\2\2\2\u00c1\u00c3\5\32\16\2\u00c2"+ - "\u00c4\5\34\17\2\u00c3\u00c2\3\2\2\2\u00c3\u00c4\3\2\2\2\u00c4\u00c5\3"+ - "\2\2\2\u00c5\u00c6\5\66\34\2\u00c6\23\3\2\2\2\u00c7\u00c9\5\32\16\2\u00c8"+ - "\u00ca\5\34\17\2\u00c9\u00c8\3\2\2\2\u00c9\u00ca\3\2\2\2\u00ca\u00cb\3"+ - "\2\2\2\u00cb\u00cc\5\66\34\2\u00cc\u00cd\7\21\2\2\u00cd\u00ce\5&\24\2"+ - "\u00ce\25\3\2\2\2\u00cf\u00d0\7\22\2\2\u00d0\u00d1\5\24\13\2\u00d1\27"+ - "\3\2\2\2\u00d2\u00d3\7\23\2\2\u00d3\u00d4\5\24\13\2\u00d4\31\3\2\2\2\u00d5"+ - "\u00d6\t\3\2\2\u00d6\33\3\2\2\2\u00d7\u00d8\7\35\2\2\u00d8\u00db\5&\24"+ - "\2\u00d9\u00da\7\20\2\2\u00da\u00dc\5&\24\2\u00db\u00d9\3\2\2\2\u00db"+ - "\u00dc\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd\u00de\7\36\2\2\u00de\35\3\2\2"+ - "\2\u00df\u00e0\5\"\22\2\u00e0\u00e1\7\21\2\2\u00e1\u00e2\5&\24\2\u00e2"+ - "\37\3\2\2\2\u00e3\u00e4\5\"\22\2\u00e4\u00e5\t\4\2\2\u00e5\u00e6\5&\24"+ - "\2\u00e6!\3\2\2\2\u00e7\u00ec\5:\36\2\u00e8\u00ec\5\66\34\2\u00e9\u00ec"+ - "\58\35\2\u00ea\u00ec\5(\25\2\u00eb\u00e7\3\2\2\2\u00eb\u00e8\3\2\2\2\u00eb"+ - "\u00e9\3\2\2\2\u00eb\u00ea\3\2\2\2\u00ec#\3\2\2\2\u00ed\u00ee\5\"\22\2"+ - "\u00ee\u00ef\t\5\2\2\u00ef%\3\2\2\2\u00f0\u00f1\b\24\1\2\u00f1\u00f2\7"+ - "*\2\2\u00f2\u00f3\5&\24\2\u00f3\u00f4\7+\2\2\u00f4\u0100\3\2\2\2\u00f5"+ - "\u0100\5*\26\2\u00f6\u00f7\t\6\2\2\u00f7\u0100\5&\24\25\u00f8\u00f9\7"+ - "A\2\2\u00f9\u0100\5&\24\b\u00fa\u0100\5L\'\2\u00fb\u0100\5:\36\2\u00fc"+ - "\u0100\5\66\34\2\u00fd\u0100\58\35\2\u00fe\u0100\5(\25\2\u00ff\u00f0\3"+ - "\2\2\2\u00ff\u00f5\3\2\2\2\u00ff\u00f6\3\2\2\2\u00ff\u00f8\3\2\2\2\u00ff"+ - "\u00fa\3\2\2\2\u00ff\u00fb\3\2\2\2\u00ff\u00fc\3\2\2\2\u00ff\u00fd\3\2"+ - "\2\2\u00ff\u00fe\3\2\2\2\u0100\u012b\3\2\2\2\u0101\u0102\f\24\2\2\u0102"+ - "\u0103\7.\2\2\u0103\u012a\5&\24\25\u0104\u0105\f\23\2\2\u0105\u0106\t"+ - "\7\2\2\u0106\u012a\5&\24\24\u0107\u0108\f\22\2\2\u0108\u0109\t\b\2\2\u0109"+ - "\u012a\5&\24\23\u010a\u010b\f\21\2\2\u010b\u010c\t\t\2\2\u010c\u012a\5"+ - "&\24\22\u010d\u010e\f\20\2\2\u010e\u010f\t\n\2\2\u010f\u012a\5&\24\21"+ - "\u0110\u0111\f\17\2\2\u0111\u0112\79\2\2\u0112\u012a\5&\24\20\u0113\u0114"+ - "\f\16\2\2\u0114\u0115\7:\2\2\u0115\u012a\5&\24\17\u0116\u0117\f\r\2\2"+ - "\u0117\u0118\7;\2\2\u0118\u012a\5&\24\16\u0119\u011a\f\13\2\2\u011a\u011b"+ - "\7>\2\2\u011b\u012a\5&\24\f\u011c\u011d\f\n\2\2\u011d\u011e\7?\2\2\u011e"+ - "\u012a\5&\24\13\u011f\u0120\f\t\2\2\u0120\u0121\7@\2\2\u0121\u012a\5&"+ - "\24\n\u0122\u0123\f\f\2\2\u0123\u0124\7<\2\2\u0124\u0127\5&\24\2\u0125"+ - "\u0126\7=\2\2\u0126\u0128\5&\24\2\u0127\u0125\3\2\2\2\u0127\u0128\3\2"+ - "\2\2\u0128\u012a\3\2\2\2\u0129\u0101\3\2\2\2\u0129\u0104\3\2\2\2\u0129"+ - "\u0107\3\2\2\2\u0129\u010a\3\2\2\2\u0129\u010d\3\2\2\2\u0129\u0110\3\2"+ - "\2\2\u0129\u0113\3\2\2\2\u0129\u0116\3\2\2\2\u0129\u0119\3\2\2\2\u0129"+ - "\u011c\3\2\2\2\u0129\u011f\3\2\2\2\u0129\u0122\3\2\2\2\u012a\u012d\3\2"+ - "\2\2\u012b\u0129\3\2\2\2\u012b\u012c\3\2\2\2\u012c\'\3\2\2\2\u012d\u012b"+ - "\3\2\2\2\u012e\u0132\5\66\34\2\u012f\u0132\58\35\2\u0130\u0132\5:\36\2"+ - "\u0131\u012e\3\2\2\2\u0131\u012f\3\2\2\2\u0131\u0130\3\2\2\2\u0132\u0133"+ - "\3\2\2\2\u0133\u0134\5\34\17\2\u0134)\3\2\2\2\u0135\u0138\5\66\34\2\u0136"+ - "\u0138\58\35\2\u0137\u0135\3\2\2\2\u0137\u0136\3\2\2\2\u0138\u0139\3\2"+ - "\2\2\u0139\u013b\7*\2\2\u013a\u013c\5.\30\2\u013b\u013a\3\2\2\2\u013b"+ - "\u013c\3\2\2\2\u013c\u013d\3\2\2\2\u013d\u013e\7+\2\2\u013e+\3\2\2\2\u013f"+ - "\u0142\5\66\34\2\u0140\u0142\58\35\2\u0141\u013f\3\2\2\2\u0141\u0140\3"+ - "\2\2\2\u0142\u0143\3\2\2\2\u0143\u0145\7*\2\2\u0144\u0146\5.\30\2\u0145"+ - "\u0144\3\2\2\2\u0145\u0146\3\2\2\2\u0146\u0147\3\2\2\2\u0147\u0148\7+"+ - "\2\2\u0148-\3\2\2\2\u0149\u0151\5&\24\2\u014a\u014c\7\20\2\2\u014b\u014d"+ - "\7q\2\2\u014c\u014b\3\2\2\2\u014c\u014d\3\2\2\2\u014d\u014e\3\2\2\2\u014e"+ - "\u0150\5&\24\2\u014f\u014a\3\2\2\2\u0150\u0153\3\2\2\2\u0151\u014f\3\2"+ - "\2\2\u0151\u0152\3\2\2\2\u0152/\3\2\2\2\u0153\u0151\3\2\2\2\u0154\u0156"+ - "\7B\2\2\u0155\u0157\5.\30\2\u0156\u0155\3\2\2\2\u0156\u0157\3\2\2\2\u0157"+ - "\61\3\2\2\2\u0158\u0159\7C\2\2\u0159\63\3\2\2\2\u015a\u015b\7D\2\2\u015b"+ - "\65\3\2\2\2\u015c\u015d\7r\2\2\u015d\67\3\2\2\2\u015e\u0161\7r\2\2\u015f"+ - "\u0160\7E\2\2\u0160\u0162\7r\2\2\u0161\u015f\3\2\2\2\u0162\u0163\3\2\2"+ - "\2\u0163\u0161\3\2\2\2\u0163\u0164\3\2\2\2\u01649\3\2\2\2\u0165\u0166"+ - "\t\13\2\2\u0166;\3\2\2\2\u0167\u0168\t\f\2\2\u0168=\3\2\2\2\u0169\u016b"+ - "\t\r\2\2\u016a\u016c\5@!\2\u016b\u016a\3\2\2\2\u016b\u016c\3\2\2\2\u016c"+ - "?\3\2\2\2\u016d\u016e\7P\2\2\u016eA\3\2\2\2\u016f\u0170\t\16\2\2\u0170"+ - "C\3\2\2\2\u0171\u0173\7\35\2\2\u0172\u0174\7q\2\2\u0173\u0172\3\2\2\2"+ - "\u0173\u0174\3\2\2\2\u0174\u0175\3\2\2\2\u0175\u017d\5&\24\2\u0176\u0178"+ - "\7\20\2\2\u0177\u0179\7q\2\2\u0178\u0177\3\2\2\2\u0178\u0179\3\2\2\2\u0179"+ - "\u017a\3\2\2\2\u017a\u017c\5&\24\2\u017b\u0176\3\2\2\2\u017c\u017f\3\2"+ - "\2\2\u017d\u017b\3\2\2\2\u017d\u017e\3\2\2\2\u017e\u0181\3\2\2\2\u017f"+ - "\u017d\3\2\2\2\u0180\u0182\7q\2\2\u0181\u0180\3\2\2\2\u0181\u0182\3\2"+ - "\2\2\u0182\u0183\3\2\2\2\u0183\u0184\7\36\2\2\u0184E\3\2\2\2\u0185\u0186"+ - "\7w\2\2\u0186G\3\2\2\2\u0187\u0188\7y\2\2\u0188I\3\2\2\2\u0189\u018a\7"+ - "v\2\2\u018aK\3\2\2\2\u018b\u0192\5> \2\u018c\u0192\5B\"\2\u018d\u0192"+ - "\5D#\2\u018e\u0192\5F$\2\u018f\u0192\5H%\2\u0190\u0192\5J&\2\u0191\u018b"+ - "\3\2\2\2\u0191\u018c\3\2\2\2\u0191\u018d\3\2\2\2\u0191\u018e\3\2\2\2\u0191"+ - "\u018f\3\2\2\2\u0191\u0190\3\2\2\2\u0192M\3\2\2\2\u0193\u0194\7S\2\2\u0194"+ - "\u0195\7x\2\2\u0195O\3\2\2\2\u0196\u0197\7T\2\2\u0197\u0198\5\66\34\2"+ - "\u0198\u019a\7*\2\2\u0199\u019b\5V,\2\u019a\u0199\3\2\2\2\u019a\u019b"+ - "\3\2\2\2\u019b\u019c\3\2\2\2\u019c\u019e\7+\2\2\u019d\u019f\5R*\2\u019e"+ - "\u019d\3\2\2\2\u019e\u019f\3\2\2\2\u019f\u01a0\3\2\2\2\u01a0\u01a1\5T"+ - "+\2\u01a1\u01a2\7q\2\2\u01a2Q\3\2\2\2\u01a3\u01a4\7U\2\2\u01a4\u01a5\5"+ - "Z.\2\u01a5S\3\2\2\2\u01a6\u01a7\7V\2\2\u01a7\u01ac\7q\2\2\u01a8\u01ab"+ - "\5\b\5\2\u01a9\u01ab\7q\2\2\u01aa\u01a8\3\2\2\2\u01aa\u01a9\3\2\2\2\u01ab"+ - "\u01ae\3\2\2\2\u01ac\u01aa\3\2\2\2\u01ac\u01ad\3\2\2\2\u01ad\u01af\3\2"+ - "\2\2\u01ae\u01ac\3\2\2\2\u01af\u01b0\7W\2\2\u01b0U\3\2\2\2\u01b1\u01b9"+ - "\5X-\2\u01b2\u01b4\7\20\2\2\u01b3\u01b5\7q\2\2\u01b4\u01b3\3\2\2\2\u01b4"+ - "\u01b5\3\2\2\2\u01b5\u01b6\3\2\2\2\u01b6\u01b8\5X-\2\u01b7\u01b2\3\2\2"+ - "\2\u01b8\u01bb\3\2\2\2\u01b9\u01b7\3\2\2\2\u01b9\u01ba\3\2\2\2\u01baW"+ - "\3\2\2\2\u01bb\u01b9\3\2\2\2\u01bc\u01bd\5\66\34\2\u01bd\u01be\7\4\2\2"+ - "\u01be\u01bf\5\32\16\2\u01bfY\3\2\2\2\u01c0\u01c8\5\32\16\2\u01c1\u01c3"+ - "\7\20\2\2\u01c2\u01c4\7q\2\2\u01c3\u01c2\3\2\2\2\u01c3\u01c4\3\2\2\2\u01c4"+ - "\u01c5\3\2\2\2\u01c5\u01c7\5\32\16\2\u01c6\u01c1\3\2\2\2\u01c7\u01ca\3"+ - "\2\2\2\u01c8\u01c6\3\2\2\2\u01c8\u01c9\3\2\2\2\u01c9[\3\2\2\2\u01ca\u01c8"+ - "\3\2\2\2\u01cb\u01cc\7X\2\2\u01cc\u01cd\5\66\34\2\u01cd\u01cf\7*\2\2\u01ce"+ - "\u01d0\5`\61\2\u01cf\u01ce\3\2\2\2\u01cf\u01d0\3\2\2\2\u01d0\u01d1\3\2"+ - "\2\2\u01d1\u01d2\7+\2\2\u01d2\u01d3\7U\2\2\u01d3\u01d4\7Y\2\2\u01d4\u01d6"+ - "\7*\2\2\u01d5\u01d7\5d\63\2\u01d6\u01d5\3\2\2\2\u01d6\u01d7\3\2\2\2\u01d7"+ - "\u01d8\3\2\2\2\u01d8\u01d9\7+\2\2\u01d9\u01da\7U\2\2\u01da\u01dc\7*\2"+ - "\2\u01db\u01dd\5f\64\2\u01dc\u01db\3\2\2\2\u01dc\u01dd\3\2\2\2\u01dd\u01de"+ - "\3\2\2\2\u01de\u01e1\7+\2\2\u01df\u01e2\5^\60\2\u01e0\u01e2\5T+\2\u01e1"+ - "\u01df\3\2\2\2\u01e1\u01e0\3\2\2\2\u01e2]\3\2\2\2\u01e3\u01e4\7\21\2\2"+ - "\u01e4\u01e5\5> \2\u01e5_\3\2\2\2\u01e6\u01ee\5b\62\2\u01e7\u01e9\7\20"+ - "\2\2\u01e8\u01ea\7q\2\2\u01e9\u01e8\3\2\2\2\u01e9\u01ea\3\2\2\2\u01ea"+ - "\u01eb\3\2\2\2\u01eb\u01ed\5b\62\2\u01ec\u01e7\3\2\2\2\u01ed\u01f0\3\2"+ - "\2\2\u01ee\u01ec\3\2\2\2\u01ee\u01ef\3\2\2\2\u01efa\3\2\2\2\u01f0\u01ee"+ - "\3\2\2\2\u01f1\u01f2\5\66\34\2\u01f2\u01f3\7\4\2\2\u01f3\u01f4\5\32\16"+ - "\2\u01f4\u01f7\7Z\2\2\u01f5\u01f8\5:\36\2\u01f6\u01f8\5<\37\2\u01f7\u01f5"+ - "\3\2\2\2\u01f7\u01f6\3\2\2\2\u01f8c\3\2\2\2\u01f9\u01fe\5:\36\2\u01fa"+ - "\u01fb\7\20\2\2\u01fb\u01fd\5:\36\2\u01fc\u01fa\3\2\2\2\u01fd\u0200\3"+ - "\2\2\2\u01fe\u01fc\3\2\2\2\u01fe\u01ff\3\2\2\2\u01ffe\3\2\2\2\u0200\u01fe"+ - "\3\2\2\2\u0201\u0209\5h\65\2\u0202\u0204\7\20\2\2\u0203\u0205\7q\2\2\u0204"+ - "\u0203\3\2\2\2\u0204\u0205\3\2\2\2\u0205\u0206\3\2\2\2\u0206\u0208\5h"+ - "\65\2\u0207\u0202\3\2\2\2\u0208\u020b\3\2\2\2\u0209\u0207\3\2\2\2\u0209"+ - "\u020a\3\2\2\2\u020ag\3\2\2\2\u020b\u0209\3\2\2\2\u020c\u020d\5\32\16"+ - "\2\u020d\u0210\7Z\2\2\u020e\u0211\5:\36\2\u020f\u0211\5<\37\2\u0210\u020e"+ - "\3\2\2\2\u0210\u020f\3\2\2\2\u0211i\3\2\2\2\u0212\u0213\7[\2\2\u0213\u0215"+ - "\5&\24\2\u0214\u0216\7q\2\2\u0215\u0214\3\2\2\2\u0215\u0216\3\2\2\2\u0216"+ - "\u0219\3\2\2\2\u0217\u021a\5\b\5\2\u0218\u021a\5T+\2\u0219\u0217\3\2\2"+ - "\2\u0219\u0218\3\2\2\2\u021a\u021c\3\2\2\2\u021b\u021d\7q\2\2\u021c\u021b"+ - "\3\2\2\2\u021c\u021d\3\2\2\2\u021d\u021f\3\2\2\2\u021e\u0220\5l\67\2\u021f"+ - "\u021e\3\2\2\2\u021f\u0220\3\2\2\2\u0220\u0221\3\2\2\2\u0221\u0222\7q"+ - "\2\2\u0222k\3\2\2\2\u0223\u0225\7\\\2\2\u0224\u0226\7q\2\2\u0225\u0224"+ - "\3\2\2\2\u0225\u0226\3\2\2\2\u0226\u0229\3\2\2\2\u0227\u022a\5\b\5\2\u0228"+ - "\u022a\5T+\2\u0229\u0227\3\2\2\2\u0229\u0228\3\2\2\2\u022am\3\2\2\2\u022b"+ - "\u022d\5p9\2\u022c\u022e\7q\2\2\u022d\u022c\3\2\2\2\u022d\u022e\3\2\2"+ - "\2\u022e\u0231\3\2\2\2\u022f\u0232\5\b\5\2\u0230\u0232\5T+\2\u0231\u022f"+ - "\3\2\2\2\u0231\u0230\3\2\2\2\u0232\u0234\3\2\2\2\u0233\u0235\7q\2\2\u0234"+ - "\u0233\3\2\2\2\u0234\u0235\3\2\2\2\u0235\u0237\3\2\2\2\u0236\u0238\5l"+ - "\67\2\u0237\u0236\3\2\2\2\u0237\u0238\3\2\2\2\u0238\u0239\3\2\2\2\u0239"+ - "\u023a\7q\2\2\u023ao\3\2\2\2\u023b\u023c\t\17\2\2\u023cq\3\2\2\2\u023d"+ - "\u023f\7i\2\2\u023e\u0240\5\32\16\2\u023f\u023e\3\2\2\2\u023f\u0240\3"+ - "\2\2\2\u0240\u0243\3\2\2\2\u0241\u0244\5:\36\2\u0242\u0244\5\66\34\2\u0243"+ - "\u0241\3\2\2\2\u0243\u0242\3\2\2\2\u0244\u0245\3\2\2\2\u0245\u0246\7j"+ - "\2\2\u0246\u0248\5&\24\2\u0247\u0249\7q\2\2\u0248\u0247\3\2\2\2\u0248"+ - "\u0249\3\2\2\2\u0249\u024a\3\2\2\2\u024a\u024b\5T+\2\u024bs\3\2\2\2\u024c"+ - "\u024d\7k\2\2\u024d\u024f\5&\24\2\u024e\u0250\7q\2\2\u024f\u024e\3\2\2"+ - "\2\u024f\u0250\3\2\2\2\u0250\u0253\3\2\2\2\u0251\u0254\5\b\5\2\u0252\u0254"+ - "\5T+\2\u0253\u0251\3\2\2\2\u0253\u0252\3\2\2\2\u0254u\3\2\2\2\u0255\u0258"+ - "\7l\2\2\u0256\u0259\5\b\5\2\u0257\u0259\5T+\2\u0258\u0256\3\2\2\2\u0258"+ - "\u0257\3\2\2\2\u0259\u025b\3\2\2\2\u025a\u025c\7q\2\2\u025b\u025a\3\2"+ - "\2\2\u025b\u025c\3\2\2\2\u025c\u025d\3\2\2\2\u025d\u025e\7m\2\2\u025e"+ - "\u025f\5&\24\2\u025fw\3\2\2\2Gz|\u0083\u0088\u00a3\u00ac\u00b0\u00b7\u00ba"+ - "\u00bf\u00c3\u00c9\u00db\u00eb\u00ff\u0127\u0129\u012b\u0131\u0137\u013b"+ - "\u0141\u0145\u014c\u0151\u0156\u0163\u016b\u0173\u0178\u017d\u0181\u0191"+ - "\u019a\u019e\u01aa\u01ac\u01b4\u01b9\u01c3\u01c8\u01cf\u01d6\u01dc\u01e1"+ - "\u01e9\u01ee\u01f7\u01fe\u0204\u0209\u0210\u0215\u0219\u021c\u021f\u0225"+ - "\u0229\u022d\u0231\u0234\u0237\u023f\u0243\u0248\u024f\u0253\u0258\u025b"; + "\3\24\5\24\u0124\n\24\7\24\u0126\n\24\f\24\16\24\u0129\13\24\3\25\3\25"+ + "\3\25\5\25\u012e\n\25\3\25\3\25\3\26\3\26\5\26\u0134\n\26\3\26\3\26\5"+ + "\26\u0138\n\26\3\26\3\26\3\27\3\27\5\27\u013e\n\27\3\27\3\27\5\27\u0142"+ + "\n\27\3\27\3\27\3\30\3\30\3\30\5\30\u0149\n\30\3\30\7\30\u014c\n\30\f"+ + "\30\16\30\u014f\13\30\3\31\3\31\5\31\u0153\n\31\3\32\3\32\3\33\3\33\3"+ + "\34\3\34\3\35\3\35\3\35\6\35\u015e\n\35\r\35\16\35\u015f\3\36\3\36\3\37"+ + "\3\37\3 \3 \5 \u0168\n \3!\3!\3\"\3\"\3#\3#\5#\u0170\n#\3#\3#\3#\5#\u0175"+ + "\n#\3#\7#\u0178\n#\f#\16#\u017b\13#\3#\5#\u017e\n#\3#\3#\3$\3$\3%\3%\3"+ + "&\3&\3\'\3\'\3\'\3\'\3\'\3\'\5\'\u018e\n\'\3(\3(\3(\3)\3)\3)\3)\5)\u0197"+ + "\n)\3)\3)\5)\u019b\n)\3)\3)\3)\3*\3*\3*\3+\3+\3+\3+\7+\u01a7\n+\f+\16"+ + "+\u01aa\13+\3+\3+\3,\3,\3,\5,\u01b1\n,\3,\7,\u01b4\n,\f,\16,\u01b7\13"+ + ",\3-\3-\3-\3-\3.\3.\3.\5.\u01c0\n.\3.\7.\u01c3\n.\f.\16.\u01c6\13.\3/"+ + "\3/\3/\3/\5/\u01cc\n/\3/\3/\3/\3/\3/\5/\u01d3\n/\3/\3/\3/\3/\5/\u01d9"+ + "\n/\3/\3/\3/\5/\u01de\n/\3\60\3\60\3\60\3\61\3\61\3\61\5\61\u01e6\n\61"+ + "\3\61\7\61\u01e9\n\61\f\61\16\61\u01ec\13\61\3\62\3\62\3\62\3\62\3\62"+ + "\3\62\5\62\u01f4\n\62\3\63\3\63\3\63\7\63\u01f9\n\63\f\63\16\63\u01fc"+ + "\13\63\3\64\3\64\3\64\5\64\u0201\n\64\3\64\7\64\u0204\n\64\f\64\16\64"+ + "\u0207\13\64\3\65\3\65\3\65\3\65\5\65\u020d\n\65\3\66\3\66\3\66\5\66\u0212"+ + "\n\66\3\66\3\66\5\66\u0216\n\66\3\66\5\66\u0219\n\66\3\66\5\66\u021c\n"+ + "\66\3\66\3\66\3\67\3\67\5\67\u0222\n\67\3\67\3\67\5\67\u0226\n\67\38\3"+ + "8\58\u022a\n8\38\38\58\u022e\n8\38\58\u0231\n8\38\58\u0234\n8\38\38\3"+ + "9\39\3:\3:\5:\u023c\n:\3:\3:\5:\u0240\n:\3:\3:\3:\5:\u0245\n:\3:\3:\3"+ + ";\3;\3;\5;\u024c\n;\3;\3;\5;\u0250\n;\3<\3<\3<\5<\u0255\n<\3<\5<\u0258"+ + "\n<\3<\3<\3<\3<\2\3&=\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,."+ + "\60\62\64\668:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtv\2\20\3\2\6\17\3\2\24\34"+ + "\3\2\37\'\3\2()\4\2\3\3,-\3\2/\62\3\2,-\3\2\63\66\3\2\678\3\2FK\3\2LO"+ + "\3\2su\3\2QR\3\2]h\2\u0293\2|\3\2\2\2\4\u0083\3\2\2\2\6\u0085\3\2\2\2"+ + "\b\u00a3\3\2\2\2\n\u00a5\3\2\2\2\f\u00a8\3\2\2\2\16\u00ae\3\2\2\2\20\u00bf"+ + "\3\2\2\2\22\u00c1\3\2\2\2\24\u00c7\3\2\2\2\26\u00cf\3\2\2\2\30\u00d2\3"+ + "\2\2\2\32\u00d5\3\2\2\2\34\u00d7\3\2\2\2\36\u00db\3\2\2\2 \u00df\3\2\2"+ + "\2\"\u00e7\3\2\2\2$\u00e9\3\2\2\2&\u00fb\3\2\2\2(\u012d\3\2\2\2*\u0133"+ + "\3\2\2\2,\u013d\3\2\2\2.\u0145\3\2\2\2\60\u0150\3\2\2\2\62\u0154\3\2\2"+ + "\2\64\u0156\3\2\2\2\66\u0158\3\2\2\28\u015a\3\2\2\2:\u0161\3\2\2\2<\u0163"+ + "\3\2\2\2>\u0165\3\2\2\2@\u0169\3\2\2\2B\u016b\3\2\2\2D\u016d\3\2\2\2F"+ + "\u0181\3\2\2\2H\u0183\3\2\2\2J\u0185\3\2\2\2L\u018d\3\2\2\2N\u018f\3\2"+ + "\2\2P\u0192\3\2\2\2R\u019f\3\2\2\2T\u01a2\3\2\2\2V\u01ad\3\2\2\2X\u01b8"+ + "\3\2\2\2Z\u01bc\3\2\2\2\\\u01c7\3\2\2\2^\u01df\3\2\2\2`\u01e2\3\2\2\2"+ + "b\u01ed\3\2\2\2d\u01f5\3\2\2\2f\u01fd\3\2\2\2h\u0208\3\2\2\2j\u020e\3"+ + "\2\2\2l\u021f\3\2\2\2n\u0227\3\2\2\2p\u0237\3\2\2\2r\u0239\3\2\2\2t\u0248"+ + "\3\2\2\2v\u0251\3\2\2\2x{\5\4\3\2y{\7q\2\2zx\3\2\2\2zy\3\2\2\2{~\3\2\2"+ + "\2|z\3\2\2\2|}\3\2\2\2}\177\3\2\2\2~|\3\2\2\2\177\u0080\7\2\2\3\u0080"+ + "\3\3\2\2\2\u0081\u0084\5\16\b\2\u0082\u0084\5\6\4\2\u0083\u0081\3\2\2"+ + "\2\u0083\u0082\3\2\2\2\u0084\5\3\2\2\2\u0085\u0086\7\3\2\2\u0086\u0088"+ + "\5\66\34\2\u0087\u0089\5> \2\u0088\u0087\3\2\2\2\u0088\u0089\3\2\2\2\u0089"+ + "\u008a\3\2\2\2\u008a\u008b\5T+\2\u008b\u008c\7q\2\2\u008c\7\3\2\2\2\u008d"+ + "\u00a4\5\16\b\2\u008e\u00a4\5\24\13\2\u008f\u00a4\5\22\n\2\u0090\u00a4"+ + "\5\26\f\2\u0091\u00a4\5\30\r\2\u0092\u00a4\5\36\20\2\u0093\u00a4\5 \21"+ + "\2\u0094\u00a4\5\f\7\2\u0095\u00a4\5$\23\2\u0096\u00a4\5,\27\2\u0097\u00a4"+ + "\5j\66\2\u0098\u00a4\5n8\2\u0099\u00a4\5P)\2\u009a\u00a4\5\\/\2\u009b"+ + "\u00a4\5N(\2\u009c\u00a4\5\60\31\2\u009d\u00a4\5r:\2\u009e\u00a4\5t;\2"+ + "\u009f\u00a4\5v<\2\u00a0\u00a4\5\62\32\2\u00a1\u00a4\5\64\33\2\u00a2\u00a4"+ + "\5\n\6\2\u00a3\u008d\3\2\2\2\u00a3\u008e\3\2\2\2\u00a3\u008f\3\2\2\2\u00a3"+ + "\u0090\3\2\2\2\u00a3\u0091\3\2\2\2\u00a3\u0092\3\2\2\2\u00a3\u0093\3\2"+ + "\2\2\u00a3\u0094\3\2\2\2\u00a3\u0095\3\2\2\2\u00a3\u0096\3\2\2\2\u00a3"+ + "\u0097\3\2\2\2\u00a3\u0098\3\2\2\2\u00a3\u0099\3\2\2\2\u00a3\u009a\3\2"+ + "\2\2\u00a3\u009b\3\2\2\2\u00a3\u009c\3\2\2\2\u00a3\u009d\3\2\2\2\u00a3"+ + "\u009e\3\2\2\2\u00a3\u009f\3\2\2\2\u00a3\u00a0\3\2\2\2\u00a3\u00a1\3\2"+ + "\2\2\u00a3\u00a2\3\2\2\2\u00a4\t\3\2\2\2\u00a5\u00a6\5\66\34\2\u00a6\u00a7"+ + "\7\4\2\2\u00a7\13\3\2\2\2\u00a8\u00ac\7\5\2\2\u00a9\u00ad\5> \2\u00aa"+ + "\u00ad\5\66\34\2\u00ab\u00ad\58\35\2\u00ac\u00a9\3\2\2\2\u00ac\u00aa\3"+ + "\2\2\2\u00ac\u00ab\3\2\2\2\u00ad\r\3\2\2\2\u00ae\u00ba\t\2\2\2\u00af\u00b1"+ + "\5\20\t\2\u00b0\u00af\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1\u00bb\3\2\2\2"+ + "\u00b2\u00b7\5\20\t\2\u00b3\u00b4\7\20\2\2\u00b4\u00b6\5\20\t\2\u00b5"+ + "\u00b3\3\2\2\2\u00b6\u00b9\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b7\u00b8\3\2"+ + "\2\2\u00b8\u00bb\3\2\2\2\u00b9\u00b7\3\2\2\2\u00ba\u00b0\3\2\2\2\u00ba"+ + "\u00b2\3\2\2\2\u00bb\17\3\2\2\2\u00bc\u00c0\5F$\2\u00bd\u00c0\5\66\34"+ + "\2\u00be\u00c0\5> \2\u00bf\u00bc\3\2\2\2\u00bf\u00bd\3\2\2\2\u00bf\u00be"+ + "\3\2\2\2\u00c0\21\3\2\2\2\u00c1\u00c3\5\32\16\2\u00c2\u00c4\5\34\17\2"+ + "\u00c3\u00c2\3\2\2\2\u00c3\u00c4\3\2\2\2\u00c4\u00c5\3\2\2\2\u00c5\u00c6"+ + "\5\66\34\2\u00c6\23\3\2\2\2\u00c7\u00c9\5\32\16\2\u00c8\u00ca\5\34\17"+ + "\2\u00c9\u00c8\3\2\2\2\u00c9\u00ca\3\2\2\2\u00ca\u00cb\3\2\2\2\u00cb\u00cc"+ + "\5\66\34\2\u00cc\u00cd\7\21\2\2\u00cd\u00ce\5&\24\2\u00ce\25\3\2\2\2\u00cf"+ + "\u00d0\7\22\2\2\u00d0\u00d1\5\24\13\2\u00d1\27\3\2\2\2\u00d2\u00d3\7\23"+ + "\2\2\u00d3\u00d4\5\24\13\2\u00d4\31\3\2\2\2\u00d5\u00d6\t\3\2\2\u00d6"+ + "\33\3\2\2\2\u00d7\u00d8\7\35\2\2\u00d8\u00d9\5&\24\2\u00d9\u00da\7\36"+ + "\2\2\u00da\35\3\2\2\2\u00db\u00dc\5\"\22\2\u00dc\u00dd\7\21\2\2\u00dd"+ + "\u00de\5&\24\2\u00de\37\3\2\2\2\u00df\u00e0\5\"\22\2\u00e0\u00e1\t\4\2"+ + "\2\u00e1\u00e2\5&\24\2\u00e2!\3\2\2\2\u00e3\u00e8\5:\36\2\u00e4\u00e8"+ + "\5\66\34\2\u00e5\u00e8\58\35\2\u00e6\u00e8\5(\25\2\u00e7\u00e3\3\2\2\2"+ + "\u00e7\u00e4\3\2\2\2\u00e7\u00e5\3\2\2\2\u00e7\u00e6\3\2\2\2\u00e8#\3"+ + "\2\2\2\u00e9\u00ea\5\"\22\2\u00ea\u00eb\t\5\2\2\u00eb%\3\2\2\2\u00ec\u00ed"+ + "\b\24\1\2\u00ed\u00ee\7*\2\2\u00ee\u00ef\5&\24\2\u00ef\u00f0\7+\2\2\u00f0"+ + "\u00fc\3\2\2\2\u00f1\u00fc\5*\26\2\u00f2\u00f3\t\6\2\2\u00f3\u00fc\5&"+ + "\24\25\u00f4\u00f5\7A\2\2\u00f5\u00fc\5&\24\b\u00f6\u00fc\5L\'\2\u00f7"+ + "\u00fc\5:\36\2\u00f8\u00fc\5\66\34\2\u00f9\u00fc\58\35\2\u00fa\u00fc\5"+ + "(\25\2\u00fb\u00ec\3\2\2\2\u00fb\u00f1\3\2\2\2\u00fb\u00f2\3\2\2\2\u00fb"+ + "\u00f4\3\2\2\2\u00fb\u00f6\3\2\2\2\u00fb\u00f7\3\2\2\2\u00fb\u00f8\3\2"+ + "\2\2\u00fb\u00f9\3\2\2\2\u00fb\u00fa\3\2\2\2\u00fc\u0127\3\2\2\2\u00fd"+ + "\u00fe\f\24\2\2\u00fe\u00ff\7.\2\2\u00ff\u0126\5&\24\25\u0100\u0101\f"+ + "\23\2\2\u0101\u0102\t\7\2\2\u0102\u0126\5&\24\24\u0103\u0104\f\22\2\2"+ + "\u0104\u0105\t\b\2\2\u0105\u0126\5&\24\23\u0106\u0107\f\21\2\2\u0107\u0108"+ + "\t\t\2\2\u0108\u0126\5&\24\22\u0109\u010a\f\20\2\2\u010a\u010b\t\n\2\2"+ + "\u010b\u0126\5&\24\21\u010c\u010d\f\17\2\2\u010d\u010e\79\2\2\u010e\u0126"+ + "\5&\24\20\u010f\u0110\f\16\2\2\u0110\u0111\7:\2\2\u0111\u0126\5&\24\17"+ + "\u0112\u0113\f\r\2\2\u0113\u0114\7;\2\2\u0114\u0126\5&\24\16\u0115\u0116"+ + "\f\13\2\2\u0116\u0117\7>\2\2\u0117\u0126\5&\24\f\u0118\u0119\f\n\2\2\u0119"+ + "\u011a\7?\2\2\u011a\u0126\5&\24\13\u011b\u011c\f\t\2\2\u011c\u011d\7@"+ + "\2\2\u011d\u0126\5&\24\n\u011e\u011f\f\f\2\2\u011f\u0120\7<\2\2\u0120"+ + "\u0123\5&\24\2\u0121\u0122\7=\2\2\u0122\u0124\5&\24\2\u0123\u0121\3\2"+ + "\2\2\u0123\u0124\3\2\2\2\u0124\u0126\3\2\2\2\u0125\u00fd\3\2\2\2\u0125"+ + "\u0100\3\2\2\2\u0125\u0103\3\2\2\2\u0125\u0106\3\2\2\2\u0125\u0109\3\2"+ + "\2\2\u0125\u010c\3\2\2\2\u0125\u010f\3\2\2\2\u0125\u0112\3\2\2\2\u0125"+ + "\u0115\3\2\2\2\u0125\u0118\3\2\2\2\u0125\u011b\3\2\2\2\u0125\u011e\3\2"+ + "\2\2\u0126\u0129\3\2\2\2\u0127\u0125\3\2\2\2\u0127\u0128\3\2\2\2\u0128"+ + "\'\3\2\2\2\u0129\u0127\3\2\2\2\u012a\u012e\5\66\34\2\u012b\u012e\58\35"+ + "\2\u012c\u012e\5:\36\2\u012d\u012a\3\2\2\2\u012d\u012b\3\2\2\2\u012d\u012c"+ + "\3\2\2\2\u012e\u012f\3\2\2\2\u012f\u0130\5\34\17\2\u0130)\3\2\2\2\u0131"+ + "\u0134\5\66\34\2\u0132\u0134\58\35\2\u0133\u0131\3\2\2\2\u0133\u0132\3"+ + "\2\2\2\u0134\u0135\3\2\2\2\u0135\u0137\7*\2\2\u0136\u0138\5.\30\2\u0137"+ + "\u0136\3\2\2\2\u0137\u0138\3\2\2\2\u0138\u0139\3\2\2\2\u0139\u013a\7+"+ + "\2\2\u013a+\3\2\2\2\u013b\u013e\5\66\34\2\u013c\u013e\58\35\2\u013d\u013b"+ + "\3\2\2\2\u013d\u013c\3\2\2\2\u013e\u013f\3\2\2\2\u013f\u0141\7*\2\2\u0140"+ + "\u0142\5.\30\2\u0141\u0140\3\2\2\2\u0141\u0142\3\2\2\2\u0142\u0143\3\2"+ + "\2\2\u0143\u0144\7+\2\2\u0144-\3\2\2\2\u0145\u014d\5&\24\2\u0146\u0148"+ + "\7\20\2\2\u0147\u0149\7q\2\2\u0148\u0147\3\2\2\2\u0148\u0149\3\2\2\2\u0149"+ + "\u014a\3\2\2\2\u014a\u014c\5&\24\2\u014b\u0146\3\2\2\2\u014c\u014f\3\2"+ + "\2\2\u014d\u014b\3\2\2\2\u014d\u014e\3\2\2\2\u014e/\3\2\2\2\u014f\u014d"+ + "\3\2\2\2\u0150\u0152\7B\2\2\u0151\u0153\5.\30\2\u0152\u0151\3\2\2\2\u0152"+ + "\u0153\3\2\2\2\u0153\61\3\2\2\2\u0154\u0155\7C\2\2\u0155\63\3\2\2\2\u0156"+ + "\u0157\7D\2\2\u0157\65\3\2\2\2\u0158\u0159\7r\2\2\u0159\67\3\2\2\2\u015a"+ + "\u015d\7r\2\2\u015b\u015c\7E\2\2\u015c\u015e\7r\2\2\u015d\u015b\3\2\2"+ + "\2\u015e\u015f\3\2\2\2\u015f\u015d\3\2\2\2\u015f\u0160\3\2\2\2\u01609"+ + "\3\2\2\2\u0161\u0162\t\13\2\2\u0162;\3\2\2\2\u0163\u0164\t\f\2\2\u0164"+ + "=\3\2\2\2\u0165\u0167\t\r\2\2\u0166\u0168\5@!\2\u0167\u0166\3\2\2\2\u0167"+ + "\u0168\3\2\2\2\u0168?\3\2\2\2\u0169\u016a\7P\2\2\u016aA\3\2\2\2\u016b"+ + "\u016c\t\16\2\2\u016cC\3\2\2\2\u016d\u016f\7\35\2\2\u016e\u0170\7q\2\2"+ + "\u016f\u016e\3\2\2\2\u016f\u0170\3\2\2\2\u0170\u0171\3\2\2\2\u0171\u0179"+ + "\5&\24\2\u0172\u0174\7\20\2\2\u0173\u0175\7q\2\2\u0174\u0173\3\2\2\2\u0174"+ + "\u0175\3\2\2\2\u0175\u0176\3\2\2\2\u0176\u0178\5&\24\2\u0177\u0172\3\2"+ + "\2\2\u0178\u017b\3\2\2\2\u0179\u0177\3\2\2\2\u0179\u017a\3\2\2\2\u017a"+ + "\u017d\3\2\2\2\u017b\u0179\3\2\2\2\u017c\u017e\7q\2\2\u017d\u017c\3\2"+ + "\2\2\u017d\u017e\3\2\2\2\u017e\u017f\3\2\2\2\u017f\u0180\7\36\2\2\u0180"+ + "E\3\2\2\2\u0181\u0182\7w\2\2\u0182G\3\2\2\2\u0183\u0184\7y\2\2\u0184I"+ + "\3\2\2\2\u0185\u0186\7v\2\2\u0186K\3\2\2\2\u0187\u018e\5> \2\u0188\u018e"+ + "\5B\"\2\u0189\u018e\5D#\2\u018a\u018e\5F$\2\u018b\u018e\5H%\2\u018c\u018e"+ + "\5J&\2\u018d\u0187\3\2\2\2\u018d\u0188\3\2\2\2\u018d\u0189\3\2\2\2\u018d"+ + "\u018a\3\2\2\2\u018d\u018b\3\2\2\2\u018d\u018c\3\2\2\2\u018eM\3\2\2\2"+ + "\u018f\u0190\7S\2\2\u0190\u0191\7x\2\2\u0191O\3\2\2\2\u0192\u0193\7T\2"+ + "\2\u0193\u0194\5\66\34\2\u0194\u0196\7*\2\2\u0195\u0197\5V,\2\u0196\u0195"+ + "\3\2\2\2\u0196\u0197\3\2\2\2\u0197\u0198\3\2\2\2\u0198\u019a\7+\2\2\u0199"+ + "\u019b\5R*\2\u019a\u0199\3\2\2\2\u019a\u019b\3\2\2\2\u019b\u019c\3\2\2"+ + "\2\u019c\u019d\5T+\2\u019d\u019e\7q\2\2\u019eQ\3\2\2\2\u019f\u01a0\7U"+ + "\2\2\u01a0\u01a1\5Z.\2\u01a1S\3\2\2\2\u01a2\u01a3\7V\2\2\u01a3\u01a8\7"+ + "q\2\2\u01a4\u01a7\5\b\5\2\u01a5\u01a7\7q\2\2\u01a6\u01a4\3\2\2\2\u01a6"+ + "\u01a5\3\2\2\2\u01a7\u01aa\3\2\2\2\u01a8\u01a6\3\2\2\2\u01a8\u01a9\3\2"+ + "\2\2\u01a9\u01ab\3\2\2\2\u01aa\u01a8\3\2\2\2\u01ab\u01ac\7W\2\2\u01ac"+ + "U\3\2\2\2\u01ad\u01b5\5X-\2\u01ae\u01b0\7\20\2\2\u01af\u01b1\7q\2\2\u01b0"+ + "\u01af\3\2\2\2\u01b0\u01b1\3\2\2\2\u01b1\u01b2\3\2\2\2\u01b2\u01b4\5X"+ + "-\2\u01b3\u01ae\3\2\2\2\u01b4\u01b7\3\2\2\2\u01b5\u01b3\3\2\2\2\u01b5"+ + "\u01b6\3\2\2\2\u01b6W\3\2\2\2\u01b7\u01b5\3\2\2\2\u01b8\u01b9\5\66\34"+ + "\2\u01b9\u01ba\7\4\2\2\u01ba\u01bb\5\32\16\2\u01bbY\3\2\2\2\u01bc\u01c4"+ + "\5\32\16\2\u01bd\u01bf\7\20\2\2\u01be\u01c0\7q\2\2\u01bf\u01be\3\2\2\2"+ + "\u01bf\u01c0\3\2\2\2\u01c0\u01c1\3\2\2\2\u01c1\u01c3\5\32\16\2\u01c2\u01bd"+ + "\3\2\2\2\u01c3\u01c6\3\2\2\2\u01c4\u01c2\3\2\2\2\u01c4\u01c5\3\2\2\2\u01c5"+ + "[\3\2\2\2\u01c6\u01c4\3\2\2\2\u01c7\u01c8\7X\2\2\u01c8\u01c9\5\66\34\2"+ + "\u01c9\u01cb\7*\2\2\u01ca\u01cc\5`\61\2\u01cb\u01ca\3\2\2\2\u01cb\u01cc"+ + "\3\2\2\2\u01cc\u01cd\3\2\2\2\u01cd\u01ce\7+\2\2\u01ce\u01cf\7U\2\2\u01cf"+ + "\u01d0\7Y\2\2\u01d0\u01d2\7*\2\2\u01d1\u01d3\5d\63\2\u01d2\u01d1\3\2\2"+ + "\2\u01d2\u01d3\3\2\2\2\u01d3\u01d4\3\2\2\2\u01d4\u01d5\7+\2\2\u01d5\u01d6"+ + "\7U\2\2\u01d6\u01d8\7*\2\2\u01d7\u01d9\5f\64\2\u01d8\u01d7\3\2\2\2\u01d8"+ + "\u01d9\3\2\2\2\u01d9\u01da\3\2\2\2\u01da\u01dd\7+\2\2\u01db\u01de\5^\60"+ + "\2\u01dc\u01de\5T+\2\u01dd\u01db\3\2\2\2\u01dd\u01dc\3\2\2\2\u01de]\3"+ + "\2\2\2\u01df\u01e0\7\21\2\2\u01e0\u01e1\5> \2\u01e1_\3\2\2\2\u01e2\u01ea"+ + "\5b\62\2\u01e3\u01e5\7\20\2\2\u01e4\u01e6\7q\2\2\u01e5\u01e4\3\2\2\2\u01e5"+ + "\u01e6\3\2\2\2\u01e6\u01e7\3\2\2\2\u01e7\u01e9\5b\62\2\u01e8\u01e3\3\2"+ + "\2\2\u01e9\u01ec\3\2\2\2\u01ea\u01e8\3\2\2\2\u01ea\u01eb\3\2\2\2\u01eb"+ + "a\3\2\2\2\u01ec\u01ea\3\2\2\2\u01ed\u01ee\5\66\34\2\u01ee\u01ef\7\4\2"+ + "\2\u01ef\u01f0\5\32\16\2\u01f0\u01f3\7Z\2\2\u01f1\u01f4\5:\36\2\u01f2"+ + "\u01f4\5<\37\2\u01f3\u01f1\3\2\2\2\u01f3\u01f2\3\2\2\2\u01f4c\3\2\2\2"+ + "\u01f5\u01fa\5:\36\2\u01f6\u01f7\7\20\2\2\u01f7\u01f9\5:\36\2\u01f8\u01f6"+ + "\3\2\2\2\u01f9\u01fc\3\2\2\2\u01fa\u01f8\3\2\2\2\u01fa\u01fb\3\2\2\2\u01fb"+ + "e\3\2\2\2\u01fc\u01fa\3\2\2\2\u01fd\u0205\5h\65\2\u01fe\u0200\7\20\2\2"+ + "\u01ff\u0201\7q\2\2\u0200\u01ff\3\2\2\2\u0200\u0201\3\2\2\2\u0201\u0202"+ + "\3\2\2\2\u0202\u0204\5h\65\2\u0203\u01fe\3\2\2\2\u0204\u0207\3\2\2\2\u0205"+ + "\u0203\3\2\2\2\u0205\u0206\3\2\2\2\u0206g\3\2\2\2\u0207\u0205\3\2\2\2"+ + "\u0208\u0209\5\32\16\2\u0209\u020c\7Z\2\2\u020a\u020d\5:\36\2\u020b\u020d"+ + "\5<\37\2\u020c\u020a\3\2\2\2\u020c\u020b\3\2\2\2\u020di\3\2\2\2\u020e"+ + "\u020f\7[\2\2\u020f\u0211\5&\24\2\u0210\u0212\7q\2\2\u0211\u0210\3\2\2"+ + "\2\u0211\u0212\3\2\2\2\u0212\u0215\3\2\2\2\u0213\u0216\5\b\5\2\u0214\u0216"+ + "\5T+\2\u0215\u0213\3\2\2\2\u0215\u0214\3\2\2\2\u0216\u0218\3\2\2\2\u0217"+ + "\u0219\7q\2\2\u0218\u0217\3\2\2\2\u0218\u0219\3\2\2\2\u0219\u021b\3\2"+ + "\2\2\u021a\u021c\5l\67\2\u021b\u021a\3\2\2\2\u021b\u021c\3\2\2\2\u021c"+ + "\u021d\3\2\2\2\u021d\u021e\7q\2\2\u021ek\3\2\2\2\u021f\u0221\7\\\2\2\u0220"+ + "\u0222\7q\2\2\u0221\u0220\3\2\2\2\u0221\u0222\3\2\2\2\u0222\u0225\3\2"+ + "\2\2\u0223\u0226\5\b\5\2\u0224\u0226\5T+\2\u0225\u0223\3\2\2\2\u0225\u0224"+ + "\3\2\2\2\u0226m\3\2\2\2\u0227\u0229\5p9\2\u0228\u022a\7q\2\2\u0229\u0228"+ + "\3\2\2\2\u0229\u022a\3\2\2\2\u022a\u022d\3\2\2\2\u022b\u022e\5\b\5\2\u022c"+ + "\u022e\5T+\2\u022d\u022b\3\2\2\2\u022d\u022c\3\2\2\2\u022e\u0230\3\2\2"+ + "\2\u022f\u0231\7q\2\2\u0230\u022f\3\2\2\2\u0230\u0231\3\2\2\2\u0231\u0233"+ + "\3\2\2\2\u0232\u0234\5l\67\2\u0233\u0232\3\2\2\2\u0233\u0234\3\2\2\2\u0234"+ + "\u0235\3\2\2\2\u0235\u0236\7q\2\2\u0236o\3\2\2\2\u0237\u0238\t\17\2\2"+ + "\u0238q\3\2\2\2\u0239\u023b\7i\2\2\u023a\u023c\5\32\16\2\u023b\u023a\3"+ + "\2\2\2\u023b\u023c\3\2\2\2\u023c\u023f\3\2\2\2\u023d\u0240\5:\36\2\u023e"+ + "\u0240\5\66\34\2\u023f\u023d\3\2\2\2\u023f\u023e\3\2\2\2\u0240\u0241\3"+ + "\2\2\2\u0241\u0242\7j\2\2\u0242\u0244\5&\24\2\u0243\u0245\7q\2\2\u0244"+ + "\u0243\3\2\2\2\u0244\u0245\3\2\2\2\u0245\u0246\3\2\2\2\u0246\u0247\5T"+ + "+\2\u0247s\3\2\2\2\u0248\u0249\7k\2\2\u0249\u024b\5&\24\2\u024a\u024c"+ + "\7q\2\2\u024b\u024a\3\2\2\2\u024b\u024c\3\2\2\2\u024c\u024f\3\2\2\2\u024d"+ + "\u0250\5\b\5\2\u024e\u0250\5T+\2\u024f\u024d\3\2\2\2\u024f\u024e\3\2\2"+ + "\2\u0250u\3\2\2\2\u0251\u0254\7l\2\2\u0252\u0255\5\b\5\2\u0253\u0255\5"+ + "T+\2\u0254\u0252\3\2\2\2\u0254\u0253\3\2\2\2\u0255\u0257\3\2\2\2\u0256"+ + "\u0258\7q\2\2\u0257\u0256\3\2\2\2\u0257\u0258\3\2\2\2\u0258\u0259\3\2"+ + "\2\2\u0259\u025a\7m\2\2\u025a\u025b\5&\24\2\u025bw\3\2\2\2Fz|\u0083\u0088"+ + "\u00a3\u00ac\u00b0\u00b7\u00ba\u00bf\u00c3\u00c9\u00e7\u00fb\u0123\u0125"+ + "\u0127\u012d\u0133\u0137\u013d\u0141\u0148\u014d\u0152\u015f\u0167\u016f"+ + "\u0174\u0179\u017d\u018d\u0196\u019a\u01a6\u01a8\u01b0\u01b5\u01bf\u01c4"+ + "\u01cb\u01d2\u01d8\u01dd\u01e5\u01ea\u01f3\u01fa\u0200\u0205\u020c\u0211"+ + "\u0215\u0218\u021b\u0221\u0225\u0229\u022d\u0230\u0233\u023b\u023f\u0244"+ + "\u024b\u024f\u0254\u0257"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/compiler/src/prog8/stackvm/Program.kt b/compiler/src/prog8/stackvm/Program.kt index 615cc9b44..8d164d43e 100644 --- a/compiler/src/prog8/stackvm/Program.kt +++ b/compiler/src/prog8/stackvm/Program.kt @@ -87,8 +87,7 @@ class Program (val name: String, DataType.STR_S, DataType.STR_PS -> heap.add(it.second, it.third.substring(1, it.third.length-1).unescape()) DataType.ARRAY_UB, DataType.ARRAY_B, - DataType.ARRAY_UW, DataType.ARRAY_W, - DataType.MATRIX_UB, DataType.MATRIX_B -> { + DataType.ARRAY_UW, DataType.ARRAY_W -> { val numbers = it.third.substring(1, it.third.length-1).split(',') val intarray = numbers.map{number->number.trim().toInt()}.toIntArray() heap.add(it.second, intarray) @@ -208,11 +207,9 @@ class Program (val name: String, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W, - DataType.ARRAY_F, - DataType.MATRIX_UB, - DataType.MATRIX_B -> { + DataType.ARRAY_F -> { if(!valueStr.startsWith("heap:")) - throw VmExecutionException("invalid arrayspec/matrix value, should be a heap reference") + throw VmExecutionException("invalid array value, should be a heap reference") else { val heapId = valueStr.substring(5).toInt() Value(type, heapId) diff --git a/compiler/src/prog8/stackvm/StackVm.kt b/compiler/src/prog8/stackvm/StackVm.kt index ceb0f8c2d..b7b73bbfa 100644 --- a/compiler/src/prog8/stackvm/StackVm.kt +++ b/compiler/src/prog8/stackvm/StackVm.kt @@ -1180,10 +1180,10 @@ class StackVm(private var traceOutputFile: String?) { // get indexed byte element from the arrayspec val array = heap.get(variable.heapId) when(array.type) { - DataType.ARRAY_UB, DataType.MATRIX_UB -> evalstack.push(Value(DataType.UBYTE, array.array!![index])) - DataType.ARRAY_B, DataType.MATRIX_B -> evalstack.push(Value(DataType.BYTE, array.array!![index])) + DataType.ARRAY_UB-> evalstack.push(Value(DataType.UBYTE, array.array!![index])) + DataType.ARRAY_B -> evalstack.push(Value(DataType.BYTE, array.array!![index])) DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS -> evalstack.push(Value(DataType.UBYTE, Petscii.encodePetscii(array.str!![index].toString(), true)[0])) - else -> throw VmExecutionException("not a proper arrayspec/matrix/string variable with byte elements") + else -> throw VmExecutionException("not a proper array/string variable with byte elements") } } } @@ -1232,8 +1232,8 @@ class StackVm(private var traceOutputFile: String?) { // set indexed byte element in the arrayspec val array = heap.get(variable.heapId) when(array.type) { - DataType.ARRAY_UB, DataType.MATRIX_UB -> array.array!![index] = value.integerValue() - DataType.ARRAY_B, DataType.MATRIX_B -> array.array!![index] = value.integerValue() + DataType.ARRAY_UB -> array.array!![index] = value.integerValue() + DataType.ARRAY_B -> array.array!![index] = value.integerValue() DataType.STR, DataType.STR_P, DataType.STR_S, @@ -1242,7 +1242,7 @@ class StackVm(private var traceOutputFile: String?) { chars[index] = Petscii.decodePetscii(listOf(value.integerValue().toShort()), true)[0] heap.update(variable.heapId, chars.joinToString("")) } - else -> throw VmExecutionException("not a proper arrayspec/matrix/string var with byte elements") + else -> throw VmExecutionException("not a proper array/string var with byte elements") } } } @@ -1337,7 +1337,6 @@ class StackVm(private var traceOutputFile: String?) { DataType.UBYTE, DataType.BYTE, DataType.UWORD, DataType.WORD, DataType.FLOAT -> print(value.numericValue()) DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS -> print(heap.get(value.heapId).str) DataType.ARRAY_UB, DataType.ARRAY_B, DataType.ARRAY_UW, DataType.ARRAY_W -> print(heap.get(value.heapId).array!!.toList()) - DataType.MATRIX_UB, DataType.MATRIX_B -> print(heap.get(value.heapId).array!!.toList()) DataType.ARRAY_F -> print(heap.get(value.heapId).doubleArray!!.toList()) } } @@ -1417,8 +1416,8 @@ class StackVm(private var traceOutputFile: String?) { val value = heap.get(iterable.heapId) val resultDt = when(iterable.type) { DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS -> DataType.UBYTE - DataType.ARRAY_UB, DataType.MATRIX_UB -> DataType.UBYTE - DataType.ARRAY_B, DataType.MATRIX_B -> DataType.BYTE + DataType.ARRAY_UB -> DataType.UBYTE + DataType.ARRAY_B -> DataType.BYTE DataType.ARRAY_UW -> DataType.UWORD DataType.ARRAY_W -> DataType.WORD DataType.ARRAY_F -> DataType.FLOAT @@ -1437,8 +1436,8 @@ class StackVm(private var traceOutputFile: String?) { val value = heap.get(iterable.heapId) val resultDt = when(iterable.type) { DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS -> DataType.UBYTE - DataType.ARRAY_UB, DataType.MATRIX_UB -> DataType.UBYTE - DataType.ARRAY_B, DataType.MATRIX_B -> DataType.BYTE + DataType.ARRAY_UB -> DataType.UBYTE + DataType.ARRAY_B -> DataType.BYTE DataType.ARRAY_UW -> DataType.UWORD DataType.ARRAY_W -> DataType.WORD DataType.ARRAY_F -> DataType.FLOAT diff --git a/compiler/test/StackVMOpcodeTests.kt b/compiler/test/StackVMOpcodeTests.kt index c9e5c4bb3..07b7bc8db 100644 --- a/compiler/test/StackVMOpcodeTests.kt +++ b/compiler/test/StackVMOpcodeTests.kt @@ -1288,8 +1288,8 @@ class TestStackVmOpcodes { DataType.UWORD, DataType.WORD -> Opcode.PUSH_WORD DataType.FLOAT -> Opcode.PUSH_FLOAT DataType.STR, DataType.STR_P, DataType.STR_S, DataType.STR_PS, - DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, DataType.MATRIX_UB, - DataType.ARRAY_B, DataType.ARRAY_W, DataType.MATRIX_B -> Opcode.PUSH_WORD + DataType.ARRAY_UB, DataType.ARRAY_UW, DataType.ARRAY_F, + DataType.ARRAY_B, DataType.ARRAY_W -> Opcode.PUSH_WORD } } diff --git a/compiler/test/ValueOperationsTests.kt b/compiler/test/ValueOperationsTests.kt index ea2d0a73e..cb97ea263 100644 --- a/compiler/test/ValueOperationsTests.kt +++ b/compiler/test/ValueOperationsTests.kt @@ -87,11 +87,9 @@ class TestStackVmValue { assertFalse(sameValueAndType(Value(DataType.STR, 999), Value(DataType.STR, 222))) assertTrue(sameValueAndType(Value(DataType.ARRAY_UB, 99), Value(DataType.ARRAY_UB, 99))) - assertFalse(sameValueAndType(Value(DataType.ARRAY_UB, 99), Value(DataType.MATRIX_UB, 99))) assertFalse(sameValueAndType(Value(DataType.ARRAY_UB, 99), Value(DataType.ARRAY_UB, 22))) assertTrue(sameValueAndType(Value(DataType.ARRAY_UW, 999), Value(DataType.ARRAY_UW, 999))) - assertFalse(sameValueAndType(Value(DataType.ARRAY_UW, 999), Value(DataType.MATRIX_UB, 999))) assertFalse(sameValueAndType(Value(DataType.ARRAY_UW, 999), Value(DataType.ARRAY_UW, 222))) assertTrue(sameValueAndType(Value(DataType.ARRAY_F, 999), Value(DataType.ARRAY_F, 999))) diff --git a/docs/source/programming.rst b/docs/source/programming.rst index 6e69a3b12..1cc0217a6 100644 --- a/docs/source/programming.rst +++ b/docs/source/programming.rst @@ -194,17 +194,13 @@ Values will usually be part of an expression or assignment statement:: byte counter = 42 ; variable of size 8 bits, with initial value 42 -Array and Matrix (2-dimensional array) types are also supported. -Arrays can be made of bytes, words and floats. Matrixes can oly be made of bytes:: +Array types are also supported. They can be made of bytes, words and floats:: byte[4] array = [1, 2, 3, 4] ; initialize the array byte[99] array = 255 ; initialize array with all 255's [255, 255, 255, 255, ...] byte[100] array = 100 to 199 ; initialize array with [100, 101, ..., 198, 199] - byte[2,3] matrix = [1,2,3,4,5,6] ; a 2*3 matrix with value |(1,2) (3,4) (5,6)| - ubyte[2,3] matrix = 255 ; a matrix of 2*3=6 unsigned bytes all with value 255 value = array[3] ; the fourth value in the array (index is 0-based) - value = matrix[4,2] ; the byte at the 5th column and 3rd row in the matrix char = string[4] ; the fifth character (=byte) in the string .. note:: @@ -285,7 +281,7 @@ with has the PETSCII value of that single character. It's probably best that you don't change strings after they're created. This is because if your program exits and is restarted (without loading it again), it will then operate on the changed strings instead of the original ones. - The same is true for arrays and matrixes by the way. + The same is true for arrays by the way. Floating point numbers @@ -547,19 +543,19 @@ deg(x) Radians to degrees. max(x) - Maximum of the values in the non-scalar (array or matrix) value x + Maximum of the values in the array value x min(x) - Minimum of the values in the non-scalar (array or matrix) value x + Minimum of the values in the array value x avg(x) - Average of the values in the non-scalar (array or matrix) value x + Average of the values in the array value x sum(x) - Sum of the values in the non-scalar (array or matrix) value x + Sum of the values in the array value x len(x) - Number of values in the array or matrix value x, or the number of characters in a string (excluding the size or 0-byte). + Number of values in the array value x, or the number of characters in a string (excluding the size or 0-byte). Note: this can be different from the number of *bytes* in memory if the datatype isn't a byte. lsb(x) @@ -587,10 +583,10 @@ ub2b(x) Convert an unsigned byte to a signed byte. Uses 2's complement to deal with negative numbers. any(x) - 1 ('true') if any of the values in the non-scalar (array or matrix) value x is 'true' (not zero), else 0 ('false') + 1 ('true') if any of the values in the array value x is 'true' (not zero), else 0 ('false') all(x) - 1 ('true') if all of the values in the non-scalar (array or matrix) value x are 'true' (not zero), else 0 ('false') + 1 ('true') if all of the values in the array value x are 'true' (not zero), else 0 ('false') rnd() returns a pseudo-random byte from 0..255 diff --git a/docs/source/syntaxreference.rst b/docs/source/syntaxreference.rst index e72afa422..779b18648 100644 --- a/docs/source/syntaxreference.rst +++ b/docs/source/syntaxreference.rst @@ -219,8 +219,6 @@ Various examples:: word address = #counter byte[5] values = [11, 22, 33, 44, 55] byte[5] values = 255 ; initialize with five 255 bytes - byte[5][6] empty_matrix = 0 ; initialize with 30 zero bytes - byte[2][3] other_matrix = [1,2,3,4,5,6] ; 2*3 matrix with value | (1,2) (3,4) (5,6) | @@ -246,8 +244,6 @@ type identifier type storage size example var declara ``word[x]`` signed word array 2*x bytes ``word[4] myvar = [1, 2, 3, 4]`` ``uword[x]`` unsigned word array 2*x bytes ``uword[4] myvar = [1, 2, 3, 4]`` ``float[x]`` floating-point array 5*x bytes ``float[4] myvar = [1.1, 2.2, 3.3, 4.4]`` -``byte[x,y]`` signed byte matrix x*y bytes ``byte[40,25] myvar = 100`` -``ubyte[x,y]`` unsigned byte matrix x*y bytes ``ubyte[40,25] myvar = 255`` ``str`` string (petscii) varies ``str myvar = "hello."`` implicitly terminated by a 0-byte ``str_p`` pascal-string (petscii) varies ``str_p myvar = "hello."`` @@ -325,12 +321,10 @@ If used in the place of a literal value, it expands into the actual array of val Array indexing ^^^^^^^^^^^^^^ -Strings, arrays and matrixes form a sequence of values. You can access the individual values by -indexing into the array. -Syntax is familiar with brackets: ``arrayvar[x]`` or ``matrixvar[x, y]`` :: +Strings and arrays are a sequence of values. You can access the individual values by indexing. +Syntax is familiar with brackets: ``arrayvar[x]`` :: array[2] ; the third byte in the array (index is 0-based) - matrix[4,2] ; the byte at the 5th column and 3rd row in the matrix string[4] ; the fifth character (=byte) in the string diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 6ec2664f8..02ba17587 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -14,25 +14,16 @@ Allows us to create pre calculated sine tables and such. Memory Block Operations ^^^^^^^^^^^^^^^^^^^^^^^ -@todo matrix,list,string memory block operations: - -- matrix type operations (whole matrix, per row, per column, individual row/column) - operations: set, get, copy (from another matrix with the same dimensions, or list with same length), - shift-N (up, down, left, right, and diagonals, meant for scrolling) - rotate-N (up, down, left, right, and diagonals, meant for scrolling) - clear (set whole matrix to the given value, default 0) +@todo list,string memory block operations: - list operations (whole list, individual element) operations: set, get, copy (from another list with the same length), shift-N(left,right), rotate-N(left,right) clear (set whole list to the given value, default 0) -- list and matrix operations ofcourse work identical on vars and on memory mapped vars of these types. +- list operations ofcourse work identical on vars and on memory mapped vars of these types. - strings: identical operations as on lists. -- matrix with row-interleave can only be a memory mapped variable and can be used to directly - access a rectangular area within another piece of memory - such as a rectangle on the (character) screen - these should call (or emit inline) optimized pieces of assembly code, so they run as fast as possible