From c569ce8de9ac9e5baab9cc4031c12ad1f6c3e89d Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Fri, 20 Oct 2017 17:25:04 +0200 Subject: [PATCH] Improved fragment manager enabling synthesis of more fragments. Added boolean operators (and, or, xor, not) --- .../java/dk/camelot64/kickc/CompileLog.java | 2 +- src/main/java/dk/camelot64/kickc/TODO.txt | 4 +- .../camelot64/kickc/fragment/AsmFragment.java | 12 + .../kickc/fragment/AsmFragmentManager.java | 133 +++++-- .../kickc/fragment/asm/aby=aby_band_coby1.asm | 1 + .../kickc/fragment/asm/aby=aby_band_zpby1.asm | 1 + .../kickc/fragment/asm/aby=aby_bor_coby1.asm | 1 + .../kickc/fragment/asm/aby=aby_bor_zpby1.asm | 1 + .../kickc/fragment/asm/aby=aby_bxor_coby1.asm | 1 + .../kickc/fragment/asm/aby=aby_bxor_zpby1.asm | 1 + .../kickc/fragment/asm/aby=aby_ror_2.asm | 2 + .../kickc/fragment/asm/aby=xby_band_aby.asm | 2 + .../kickc/fragment/asm/aby=xby_bor_aby.asm | 2 + .../kickc/fragment/asm/aby=xby_bxor_aby.asm | 2 + .../kickc/fragment/asm/aby=yby_band_aby.asm | 2 + .../kickc/fragment/asm/aby=yby_bor_aby.asm | 2 + .../kickc/fragment/asm/aby=yby_bxor_aby.asm | 2 + .../kickc/fragment/asm/aby=yby_ror_2.asm | 3 + .../kickc/fragment/asm/aby=zpby1_ror_2.asm | 3 + .../asm/zpptrby1_neq_cowo1_then_la1.asm | 6 + .../dk/camelot64/kickc/model/Operator.java | 24 ++ .../kickc/model/SymbolTypeArray.java | 5 + .../kickc/model/SymbolTypeBasic.java | 6 + .../kickc/model/SymbolTypeInference.java | 9 + .../kickc/model/SymbolTypePointer.java | 6 + .../kickc/model/SymbolTypeProcedure.java | 6 + .../kickc/model/SymbolTypeProgram.java | 6 + .../java/dk/camelot64/kickc/parser/KickC.g4 | 7 +- .../dk/camelot64/kickc/parser/KickC.tokens | 74 ++-- .../dk/camelot64/kickc/parser/KickCLexer.java | 338 +++++++++-------- .../camelot64/kickc/parser/KickCLexer.tokens | 74 ++-- .../camelot64/kickc/parser/KickCParser.java | 353 ++++++++++-------- .../kickc/test/TestCompilationOutput.java | 4 + .../java/dk/camelot64/kickc/test/halfscii.kc | 27 ++ .../java/dk/camelot64/kickc/test/literals.kc | 8 +- .../dk/camelot64/kickc/test/ref/fibmem.log | 38 -- .../dk/camelot64/kickc/test/ref/literals.asm | 8 +- .../dk/camelot64/kickc/test/ref/literals.cfg | 4 +- .../dk/camelot64/kickc/test/ref/literals.log | 282 ++++++++------ .../dk/camelot64/kickc/test/ref/literals.sym | 4 +- 40 files changed, 876 insertions(+), 590 deletions(-) create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_coby1.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_zpby1.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_coby1.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_zpby1.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_coby1.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_zpby1.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_ror_2.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_band_aby.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bor_aby.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bxor_aby.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_band_aby.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bor_aby.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bxor_aby.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_ror_2.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/aby=zpby1_ror_2.asm create mode 100644 src/main/java/dk/camelot64/kickc/fragment/asm/zpptrby1_neq_cowo1_then_la1.asm create mode 100644 src/main/java/dk/camelot64/kickc/test/halfscii.kc diff --git a/src/main/java/dk/camelot64/kickc/CompileLog.java b/src/main/java/dk/camelot64/kickc/CompileLog.java index 1cff9a4a9..451a3fc80 100644 --- a/src/main/java/dk/camelot64/kickc/CompileLog.java +++ b/src/main/java/dk/camelot64/kickc/CompileLog.java @@ -18,7 +18,7 @@ public class CompileLog { public void append(String msg) { log.append(msg); log.append("\n"); - System.out.printf(msg+"\n"); + System.out.append(msg+"\n"); } public StringBuilder getLog() { diff --git a/src/main/java/dk/camelot64/kickc/TODO.txt b/src/main/java/dk/camelot64/kickc/TODO.txt index b56fe26e3..b823504e3 100644 --- a/src/main/java/dk/camelot64/kickc/TODO.txt +++ b/src/main/java/dk/camelot64/kickc/TODO.txt @@ -1,13 +1,11 @@ Known Problems Features -- Add string constants - Add support for expressions in data initializers. - Add support for empty / filled byte data arrays. - Move the main code into a main() function, and disallow code outside functions. The main function per default has no parameters and exits with RTS. - Improve locality of block sequence for if(cond) { stmt1; } else { stmt2; } to if(!cond) goto @else stmt1; jmp @end; @else: stmt2; @end: - Optimize if/else by swapping if & else if cond is easier to evaluate than !cond. -- Add literal char syntax ( 'c' == (byte) 3 ) - Add signed bytes - Add signed words - Add Fixed Point number types fixed[8.8], fixed[16.8] - maybe even fixed[24.4] @@ -120,3 +118,5 @@ Done + Optimize getAliveEffective() to improve speed + Add possibility of declaring in-program data - just like .byte/.fill in KickAss. + In immemarray.kc the if(++j==8) is broken because the optimizer culls the empty block main::@3 (because the value is constant). In the end the phi()-function in main::@2 has two handlers for min::@1 phi( main::@1/(byte) main::j#1 main::@1/(const byte) main::j#2 ) ++ Add literal char syntax ( 'c' == (byte) 3 ) ++ Add string constants diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragment.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragment.java index 5ea5fe83b..9017dbd3e 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragment.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragment.java @@ -89,6 +89,8 @@ public class AsmFragment { return getAsmNumber(((ConstantInteger) value).getNumber()); } else if (value instanceof ConstantChar) { return "'"+((ConstantChar) value).getValue()+"'"; + } else if (value instanceof ConstantString) { + return "\""+((ConstantString) value).getValue()+"\""; } else if (value instanceof ConstantUnary) { ConstantUnary unary = (ConstantUnary) value; Operator operator = unary.getOperator(); @@ -251,6 +253,16 @@ public class AsmFragment { return "_ror_"; case "<<": return "_rol_"; + case "&": + return "_band_"; + case "|": + return "_bor_"; + case "^": + return "_bxor_"; + case "!": + return "_not_"; + case "~": + return "_bnot_"; default: return op; } diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java index cf83e9604..0172068d8 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java @@ -29,7 +29,7 @@ public class AsmFragmentManager { public static Asm6502Parser.FileContext getFragment(String signature) { Asm6502Parser.FileContext fragment = fragmentFileCache.get(signature); - if(fragment==UNKNOWN) { + if (fragment == UNKNOWN) { throw new AsmFragment.UnknownFragmentException(signature); } if (fragment == null) { @@ -59,41 +59,14 @@ public class AsmFragmentManager { * @return The synthesized fragment file contents. Null if the fragment could not be synthesized. */ private static CharStream synthesizeFragment(String signature) { - if(signature.startsWith("xby=")) { - String subSignature = "aby="+signature.substring(4); - CharStream subCharStream = loadOrSynthesizeFragment(subSignature); - if(subCharStream!=null) { - CharStream result = CharStreams.fromString(subCharStream.toString()+"\ntax\n"); - return result; - } - } - if(signature.startsWith("yby=")) { - String subSignature = "aby="+signature.substring(4); - CharStream subCharStream = loadOrSynthesizeFragment(subSignature); - if(subCharStream!=null) { - CharStream result = CharStreams.fromString(subCharStream.toString()+"\ntay\n"); - return result; - } - } - if(signature.startsWith("zpby1=")) { - if(signature.contains("zpby2")) { - String subSignature = "aby="+signature.substring(6).replace("zpby2", "zpby1"); - CharStream subCharStream = loadOrSynthesizeFragment(subSignature); - if(subCharStream!=null) { - CharStream result = CharStreams.fromString(subCharStream.toString().replace("zpby1", "zpby2")+"\nsta {zpby1}\n"); - return result; - } - } else { - String subSignature = "aby="+signature.substring(6); - CharStream subCharStream = loadOrSynthesizeFragment(subSignature); - if(subCharStream!=null) { - CharStream result = CharStreams.fromString(subCharStream.toString()+"\nsta {zpby1}\n"); - return result; - } - } - } String sigNew = signature; + sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_band_aby", "$1=aby_band_$2"); + sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_band_xby", "$1=xby_band_$2"); + sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_band_yby", "$1=yby_band_$2"); + sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_bor_aby", "$1=aby_bor_$2"); + sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_bor_xby", "$1=xby_bor_$2"); + sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_bor_yby", "$1=yby_bor_$2"); sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_plus_aby", "$1=aby_plus_$2"); sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_plus_xby", "$1=xby_plus_$2"); sigNew = regexpRewriteSignature(sigNew, "(.*)=(.*)_plus_yby", "$1=yby_plus_$2"); @@ -109,8 +82,94 @@ public class AsmFragmentManager { sigNew = regexpRewriteSignature(sigNew, "(.*)_neq_aby_then_(.*)", "aby_neq_$1_then_$2"); sigNew = regexpRewriteSignature(sigNew, "(.*)_neq_xby_then_(.*)", "xby_neq_$1_then_$2"); sigNew = regexpRewriteSignature(sigNew, "(.*)_neq_yby_then_(.*)", "yby_neq_$1_then_$2"); - if(!signature.equals(sigNew)) { - return loadFragment(sigNew); + if (!signature.equals(sigNew)) { + CharStream loadFragment = loadFragment(sigNew); + if(loadFragment!=null) { + return loadFragment; + } else { + signature = sigNew; + } + } + + if (signature.startsWith("xby=")) { + String subSignature = "aby=" + signature.substring(4); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString(subCharStream.toString() + "\ntax\n"); + return result; + } + } + if (signature.startsWith("yby=")) { + String subSignature = "aby=" + signature.substring(4); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString(subCharStream.toString() + "\ntay\n"); + return result; + } + } + if (signature.startsWith("zpby1=")) { + String subSignature = "aby=" + signature.substring(6).replace("zpby2", "zpby1").replace("zpby3", "zpby2"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString(subCharStream.toString().replace("zpby2", "zpby3").replace("zpby1", "zpby2") + "\nsta {zpby1}\n"); + return result; + } + } + if (signature.contains("=zpby1_") && !signature.matches(".*=.*aby.*")) { + String subSignature = regexpRewriteSignature(signature, "(.*)=zpby1_(.*)", "$1=aby_$2").replace("zpby2", "zpby1").replace("zpby3", "zpby2"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString("lda {zpby1}\n"+subCharStream.toString().replace("zpby2", "zpby3").replace("zpby1", "zpby2")); + return result; + } + } + if (signature.contains("=xby_") && !signature.matches(".*=.*aby.*")) { + String subSignature = regexpRewriteSignature(signature, "(.*)=xby_(.*)", "$1=aby_$2"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString("txa\n"+subCharStream.toString()); + return result; + } + } + if (signature.contains("=yby_") && !signature.matches(".*=.*aby.*")) { + String subSignature = regexpRewriteSignature(signature, "(.*)=yby_(.*)", "$1=aby_$2"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString("tya\n"+subCharStream.toString()); + return result; + } + } + if (signature.endsWith("_staridx_aby") && !signature.matches(".*=.*yby.*")) { + String subSignature = regexpRewriteSignature(signature, "(.*)=(.*)_staridx_aby", "$1=$2_staridx_yby"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString("tay\n"+subCharStream.toString()); + return result; + } + } + if (signature.endsWith("_staridx_aby") && !signature.matches(".*=.*xby.*")) { + String subSignature = regexpRewriteSignature(signature, "(.*)=(.*)_staridx_aby", "$1=$2_staridx_xby"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString("tax\n"+subCharStream.toString()); + return result; + } + } + if (signature.endsWith("_staridx_zpby1") && !signature.matches(".*=.*yby.*")) { + String subSignature = regexpRewriteSignature(signature, "(.*)=(.*)_staridx_zpby1", "$1=$2_staridx_yby").replace("zpby2", "zpby1").replace("zpby3", "zpby2"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString("ldy {zpby1}\n"+subCharStream.toString().replace("zpby2", "zpby3").replace("zpby1", "zpby2")); + return result; + } + } + if (signature.endsWith("_staridx_zpby1") && !signature.matches(".*=.*xby.*")) { + String subSignature = regexpRewriteSignature(signature, "(.*)=(.*)_staridx_zpby1", "$1=$2_staridx_xby").replace("zpby2", "zpby1").replace("zpby3", "zpby2"); + CharStream subCharStream = loadOrSynthesizeFragment(subSignature); + if (subCharStream != null) { + CharStream result = CharStreams.fromString("ldx {zpby1}\n"+subCharStream.toString().replace("zpby2", "zpby3").replace("zpby1", "zpby2")); + return result; + } } return null; @@ -138,7 +197,7 @@ public class AsmFragmentManager { private static CharStream loadFragment(String signature) { ClassLoader classLoader = AsmFragmentManager.class.getClassLoader(); URL fragmentUrl = classLoader.getResource("dk/camelot64/kickc/fragment/asm/" + signature + ".asm"); - if(fragmentUrl==null) { + if (fragmentUrl == null) { return null; } try { diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_coby1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_coby1.asm new file mode 100644 index 000000000..7ffac9de7 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_coby1.asm @@ -0,0 +1 @@ +and #{coby1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_zpby1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_zpby1.asm new file mode 100644 index 000000000..dfdb39485 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_band_zpby1.asm @@ -0,0 +1 @@ +and {zpby1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_coby1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_coby1.asm new file mode 100644 index 000000000..1fc228320 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_coby1.asm @@ -0,0 +1 @@ +ora #{coby1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_zpby1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_zpby1.asm new file mode 100644 index 000000000..27e435a99 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bor_zpby1.asm @@ -0,0 +1 @@ +ora {zpby1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_coby1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_coby1.asm new file mode 100644 index 000000000..72722299d --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_coby1.asm @@ -0,0 +1 @@ +xor #{coby1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_zpby1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_zpby1.asm new file mode 100644 index 000000000..dcaf0c873 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_bxor_zpby1.asm @@ -0,0 +1 @@ +xor {zpby1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_ror_2.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_ror_2.asm new file mode 100644 index 000000000..46f94520e --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=aby_ror_2.asm @@ -0,0 +1,2 @@ +lsr +lsr \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_band_aby.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_band_aby.asm new file mode 100644 index 000000000..9a1dcef75 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_band_aby.asm @@ -0,0 +1,2 @@ +stx $ff +and $ff \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bor_aby.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bor_aby.asm new file mode 100644 index 000000000..183127d79 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bor_aby.asm @@ -0,0 +1,2 @@ +stx $ff +ora $ff \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bxor_aby.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bxor_aby.asm new file mode 100644 index 000000000..f352bb223 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=xby_bxor_aby.asm @@ -0,0 +1,2 @@ +stx $ff +xor $ff \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_band_aby.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_band_aby.asm new file mode 100644 index 000000000..9e66f5a7c --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_band_aby.asm @@ -0,0 +1,2 @@ +sty $ff +and $ff \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bor_aby.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bor_aby.asm new file mode 100644 index 000000000..7c0b29e3c --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bor_aby.asm @@ -0,0 +1,2 @@ +sty $ff +ora $ff \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bxor_aby.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bxor_aby.asm new file mode 100644 index 000000000..e626b0f3f --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_bxor_aby.asm @@ -0,0 +1,2 @@ +sty $ff +xor $ff \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_ror_2.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_ror_2.asm new file mode 100644 index 000000000..01651b901 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=yby_ror_2.asm @@ -0,0 +1,3 @@ +tya +lsr +lsr \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/aby=zpby1_ror_2.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=zpby1_ror_2.asm new file mode 100644 index 000000000..a007eb6f1 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/aby=zpby1_ror_2.asm @@ -0,0 +1,3 @@ +lda {zpby1} +lsr +lsr \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/zpptrby1_neq_cowo1_then_la1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/zpptrby1_neq_cowo1_then_la1.asm new file mode 100644 index 000000000..3d950e6a5 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/zpptrby1_neq_cowo1_then_la1.asm @@ -0,0 +1,6 @@ +lda {zpptrby1}+1 +cmp #>{cowo1} +bne {la1} +lda {zpptrby1} +cmp #<{cowo1} +bne {la1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/model/Operator.java b/src/main/java/dk/camelot64/kickc/model/Operator.java index 136f2a844..35cfd623b 100644 --- a/src/main/java/dk/camelot64/kickc/model/Operator.java +++ b/src/main/java/dk/camelot64/kickc/model/Operator.java @@ -39,6 +39,20 @@ public class Operator { return GE; case "*idx": return STAR_IDX; + case "&&": + return LOGIC_AND; + case "||": + return LOGIC_OR; + case "&": + return BOOL_AND; + case "|": + return BOOL_OR; + case "^": + return BOOL_XOR; + case "<<": + return SHIFT_LEFT; + case ">>": + return SHIFT_RIGHT; default: throw new RuntimeException("Unknown operator " + op); } @@ -56,6 +70,8 @@ public class Operator { return DECREMENT; case "!": return NOT; + case "~": + return BOOL_NOT; case "*": return STAR; default: @@ -71,6 +87,7 @@ public class Operator { public static Operator DECREMENT = new Operator("--", Type.UNARY, 1); public static Operator UNARY_PLUS = new Operator("+", Type.UNARY, 2); public static Operator UNARY_MINUS = new Operator("-", Type.UNARY, 2); + public static Operator BOOL_NOT = new Operator("~", Type.UNARY, 2); public static Operator NOT = new Operator("!", Type.UNARY, 2); public static Operator STAR = new Operator("*", Type.UNARY, 2); public static Operator STAR_IDX = new Operator("*idx", Type.BINARY, 2); @@ -78,12 +95,19 @@ public class Operator { public static Operator DIVIDE = new Operator("/", Type.BINARY, 3); public static Operator PLUS = new Operator("+", Type.BINARY, 4); public static Operator MINUS = new Operator("-", Type.BINARY, 4); + public static Operator SHIFT_LEFT = new Operator("<<", Type.BINARY, 5); + public static Operator SHIFT_RIGHT = new Operator(">>", Type.BINARY, 5); public static Operator LT = new Operator("<", Type.BINARY, 6); public static Operator LE = new Operator("<=", Type.BINARY, 6); public static Operator GT = new Operator(">", Type.BINARY, 6); public static Operator GE = new Operator(">=", Type.BINARY, 6); public static Operator EQ = new Operator("==", Type.BINARY, 7); public static Operator NEQ = new Operator("!=", Type.BINARY, 7); + public static Operator BOOL_AND = new Operator("&", Type.BINARY, 8); + public static Operator BOOL_XOR = new Operator("^", Type.BINARY, 9); + public static Operator BOOL_OR = new Operator("|", Type.BINARY, 10); + public static Operator LOGIC_AND = new Operator("&&", Type.BINARY, 11); + public static Operator LOGIC_OR = new Operator("||", Type.BINARY, 12); public String getOperator() { return operator; diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeArray.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeArray.java index d3ffab2ac..c1074eb8a 100644 --- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeArray.java +++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeArray.java @@ -52,4 +52,9 @@ public class SymbolTypeArray extends SymbolTypePointer { result = 31 * result + (size != null ? size.hashCode() : 0); return result; } + + @Override + public String toString() { + return getTypeName(); + } } diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeBasic.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeBasic.java index ad349130f..bc591ad79 100644 --- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeBasic.java +++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeBasic.java @@ -59,4 +59,10 @@ public class SymbolTypeBasic implements SymbolType { public int hashCode() { return typeName != null ? typeName.hashCode() : 0; } + + @Override + public String toString() { + return getTypeName(); + } + } diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java index d3576fcdc..6bda5c319 100644 --- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java +++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java @@ -38,7 +38,13 @@ public class SymbolTypeInference { case "or": return SymbolTypeBasic.BOOLEAN; case "+": + if (type1.equals(SymbolTypeBasic.STRING) && SymbolTypeBasic.BYTE.equals(type2)) { + return SymbolTypeBasic.STRING; + } else if (type1.equals(SymbolTypeBasic.STRING) && SymbolTypeBasic.STRING.equals(type2)) { + return SymbolTypeBasic.STRING; + } case "-": + // Also continues "+" if (type1 instanceof SymbolTypePointer && (type2.equals(SymbolTypeBasic.BYTE) || type2.equals(SymbolTypeBasic.WORD))) { return new SymbolTypePointer(((SymbolTypePointer) type1).getElementType()); } @@ -69,6 +75,9 @@ public class SymbolTypeInference { } throw new RuntimeException("Type inference case not handled " + type1 + " " + operator + " " + type2); case "/": + case "&": + case "|": + case "^": if (SymbolTypeBasic.WORD.equals(type1) || SymbolTypeBasic.WORD.equals(type2)) { return SymbolTypeBasic.WORD; } else if (SymbolTypeBasic.BYTE.equals(type1) && SymbolTypeBasic.BYTE.equals(type2)) { diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java index f0c127892..bfbf48dda 100644 --- a/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java +++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java @@ -47,4 +47,10 @@ public class SymbolTypePointer implements SymbolType { public int hashCode() { return elementType != null ? elementType.hashCode() : 0; } + + @Override + public String toString() { + return getTypeName(); + } + } diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java index 2246b2e4d..e40bdf9ca 100644 --- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java +++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java @@ -24,4 +24,10 @@ public class SymbolTypeProcedure implements SymbolType { public String getTypeName() { return returnType.getTypeName() + "()"; } + + @Override + public String toString() { + return getTypeName(); + } + } diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java index eb70a9142..7190f805d 100644 --- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java +++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java @@ -24,4 +24,10 @@ public class SymbolTypeProgram implements SymbolType { public boolean equals(Object obj) { return (obj instanceof SymbolTypeProgram); } + + @Override + public String toString() { + return getTypeName(); + } + } diff --git a/src/main/java/dk/camelot64/kickc/parser/KickC.g4 b/src/main/java/dk/camelot64/kickc/parser/KickC.g4 index 4893c4383..e9ce2fb93 100644 --- a/src/main/java/dk/camelot64/kickc/parser/KickC.g4 +++ b/src/main/java/dk/camelot64/kickc/parser/KickC.g4 @@ -62,11 +62,14 @@ expr | expr '[' expr ']' #exprArray | ('--' | '++' ) expr #exprPreMod | expr ('--' | '++' )#exprPostMod - | ('+' | '-' | 'not' | '!' | '&' | '*') expr #exprUnary + | ('+' | '-' | 'not' | '!' | '&' | '*' | '~' ) expr #exprUnary | expr ('>>' | '<<' ) expr #exprBinary - | expr ('*' | '/' ) expr #exprBinary + | expr ('*' | '/' | '%' ) expr #exprBinary | expr ( '+' | '-') expr #exprBinary | expr ( '==' | '!=' | '<>' | '<' | '<=' | '=<' | '>=' | '=>' | '>' ) expr #exprBinary + | expr ( '&' ) expr #exprBinary + | expr ( '^' ) expr #exprBinary + | expr ( '|' ) expr #exprBinary | expr ( 'and' | '&&' ) expr #exprBinary | expr ( 'or' | '||' ) expr #exprBinary | NAME #exprId diff --git a/src/main/java/dk/camelot64/kickc/parser/KickC.tokens b/src/main/java/dk/camelot64/kickc/parser/KickC.tokens index 52e9cc928..cb7395c34 100644 --- a/src/main/java/dk/camelot64/kickc/parser/KickC.tokens +++ b/src/main/java/dk/camelot64/kickc/parser/KickC.tokens @@ -40,23 +40,27 @@ T__38=39 T__39=40 T__40=41 T__41=42 -SIMPLETYPE=43 -STRING=44 -CHAR=45 -BOOLEAN=46 -NUMBER=47 -NUMFLOAT=48 -BINFLOAT=49 -DECFLOAT=50 -HEXFLOAT=51 -NUMINT=52 -BININTEGER=53 -DECINTEGER=54 -HEXINTEGER=55 -NAME=56 -WS=57 -COMMENT_LINE=58 -COMMENT_BLOCK=59 +T__42=43 +T__43=44 +T__44=45 +T__45=46 +SIMPLETYPE=47 +STRING=48 +CHAR=49 +BOOLEAN=50 +NUMBER=51 +NUMFLOAT=52 +BINFLOAT=53 +DECFLOAT=54 +HEXFLOAT=55 +NUMINT=56 +BININTEGER=57 +DECINTEGER=58 +HEXINTEGER=59 +NAME=60 +WS=61 +COMMENT_LINE=62 +COMMENT_BLOCK=63 '{'=1 '}'=2 '('=3 @@ -83,19 +87,23 @@ COMMENT_BLOCK=59 'not'=24 '!'=25 '&'=26 -'>>'=27 -'<<'=28 -'/'=29 -'=='=30 -'!='=31 -'<>'=32 -'<'=33 -'<='=34 -'=<'=35 -'>='=36 -'=>'=37 -'>'=38 -'and'=39 -'&&'=40 -'or'=41 -'||'=42 +'~'=27 +'>>'=28 +'<<'=29 +'/'=30 +'%'=31 +'=='=32 +'!='=33 +'<>'=34 +'<'=35 +'<='=36 +'=<'=37 +'>='=38 +'=>'=39 +'>'=40 +'^'=41 +'|'=42 +'and'=43 +'&&'=44 +'or'=45 +'||'=46 diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java index be8eda76a..e4280d649 100644 --- a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java +++ b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java @@ -22,10 +22,10 @@ public class KickCLexer extends Lexer { T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38, - T__38=39, T__39=40, T__40=41, T__41=42, SIMPLETYPE=43, STRING=44, CHAR=45, - BOOLEAN=46, NUMBER=47, NUMFLOAT=48, BINFLOAT=49, DECFLOAT=50, HEXFLOAT=51, - NUMINT=52, BININTEGER=53, DECINTEGER=54, HEXINTEGER=55, NAME=56, WS=57, - COMMENT_LINE=58, COMMENT_BLOCK=59; + T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45, + T__45=46, SIMPLETYPE=47, STRING=48, CHAR=49, BOOLEAN=50, NUMBER=51, NUMFLOAT=52, + BINFLOAT=53, DECFLOAT=54, HEXFLOAT=55, NUMINT=56, BININTEGER=57, DECINTEGER=58, + HEXINTEGER=59, NAME=60, WS=61, COMMENT_LINE=62, COMMENT_BLOCK=63; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -40,27 +40,27 @@ public class KickCLexer extends Lexer { "T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24", "T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32", "T__33", "T__34", "T__35", "T__36", "T__37", "T__38", "T__39", "T__40", - "T__41", "SIMPLETYPE", "STRING", "CHAR", "BOOLEAN", "NUMBER", "NUMFLOAT", - "BINFLOAT", "DECFLOAT", "HEXFLOAT", "NUMINT", "BININTEGER", "DECINTEGER", - "HEXINTEGER", "BINDIGIT", "DECDIGIT", "HEXDIGIT", "NAME", "NAME_START", - "NAME_CHAR", "WS", "COMMENT_LINE", "COMMENT_BLOCK" + "T__41", "T__42", "T__43", "T__44", "T__45", "SIMPLETYPE", "STRING", "CHAR", + "BOOLEAN", "NUMBER", "NUMFLOAT", "BINFLOAT", "DECFLOAT", "HEXFLOAT", "NUMINT", + "BININTEGER", "DECINTEGER", "HEXINTEGER", "BINDIGIT", "DECDIGIT", "HEXDIGIT", + "NAME", "NAME_START", "NAME_CHAR", "WS", "COMMENT_LINE", "COMMENT_BLOCK" }; private static final String[] _LITERAL_NAMES = { null, "'{'", "'}'", "'('", "')'", "'const'", "'='", "';'", "'if'", "'else'", "'while'", "'do'", "'for'", "'return'", "':'", "'..'", "','", "'*'", "'['", - "']'", "'--'", "'++'", "'+'", "'-'", "'not'", "'!'", "'&'", "'>>'", "'<<'", - "'/'", "'=='", "'!='", "'<>'", "'<'", "'<='", "'=<'", "'>='", "'=>'", - "'>'", "'and'", "'&&'", "'or'", "'||'" + "']'", "'--'", "'++'", "'+'", "'-'", "'not'", "'!'", "'&'", "'~'", "'>>'", + "'<<'", "'/'", "'%'", "'=='", "'!='", "'<>'", "'<'", "'<='", "'=<'", "'>='", + "'=>'", "'>'", "'^'", "'|'", "'and'", "'&&'", "'or'", "'||'" }; private static final String[] _SYMBOLIC_NAMES = { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, "SIMPLETYPE", "STRING", "CHAR", - "BOOLEAN", "NUMBER", "NUMFLOAT", "BINFLOAT", "DECFLOAT", "HEXFLOAT", "NUMINT", - "BININTEGER", "DECINTEGER", "HEXINTEGER", "NAME", "WS", "COMMENT_LINE", - "COMMENT_BLOCK" + null, null, null, null, null, null, null, null, null, null, null, "SIMPLETYPE", + "STRING", "CHAR", "BOOLEAN", "NUMBER", "NUMFLOAT", "BINFLOAT", "DECFLOAT", + "HEXFLOAT", "NUMINT", "BININTEGER", "DECINTEGER", "HEXINTEGER", "NAME", + "WS", "COMMENT_LINE", "COMMENT_BLOCK" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); @@ -120,7 +120,7 @@ public class KickCLexer extends Lexer { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2=\u01c8\b\1\4\2\t"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2A\u01d8\b\1\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"+ @@ -128,156 +128,162 @@ public class KickCLexer extends Lexer { "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+ ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+ "\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+ - "\4>\t>\4?\t?\4@\t@\4A\tA\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\6\3"+ - "\6\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3"+ - "\13\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3\16"+ - "\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\22\3\22\3\23\3\23\3\24"+ - "\3\24\3\25\3\25\3\25\3\26\3\26\3\26\3\27\3\27\3\30\3\30\3\31\3\31\3\31"+ - "\3\31\3\32\3\32\3\33\3\33\3\34\3\34\3\34\3\35\3\35\3\35\3\36\3\36\3\37"+ - "\3\37\3\37\3 \3 \3 \3!\3!\3!\3\"\3\"\3#\3#\3#\3$\3$\3$\3%\3%\3%\3&\3&"+ - "\3&\3\'\3\'\3(\3(\3(\3(\3)\3)\3)\3*\3*\3*\3+\3+\3+\3,\3,\3,\3,\3,\3,\3"+ - ",\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\3,\5,\u0118\n,\3"+ - "-\3-\3-\3-\7-\u011e\n-\f-\16-\u0121\13-\3-\3-\3.\3.\3.\3.\5.\u0129\n."+ - "\3.\3.\3/\3/\3/\3/\3/\3/\3/\3/\3/\5/\u0136\n/\3\60\3\60\5\60\u013a\n\60"+ - "\3\61\3\61\3\61\5\61\u013f\n\61\3\62\3\62\3\62\3\62\3\62\5\62\u0146\n"+ - "\62\3\62\7\62\u0149\n\62\f\62\16\62\u014c\13\62\3\62\3\62\6\62\u0150\n"+ - "\62\r\62\16\62\u0151\3\63\7\63\u0155\n\63\f\63\16\63\u0158\13\63\3\63"+ - "\3\63\6\63\u015c\n\63\r\63\16\63\u015d\3\64\3\64\3\64\3\64\3\64\5\64\u0165"+ - "\n\64\3\64\7\64\u0168\n\64\f\64\16\64\u016b\13\64\3\64\3\64\6\64\u016f"+ - "\n\64\r\64\16\64\u0170\3\65\3\65\3\65\5\65\u0176\n\65\3\66\3\66\3\66\6"+ - "\66\u017b\n\66\r\66\16\66\u017c\3\66\3\66\6\66\u0181\n\66\r\66\16\66\u0182"+ - "\5\66\u0185\n\66\3\67\6\67\u0188\n\67\r\67\16\67\u0189\38\38\38\38\38"+ - "\58\u0191\n8\38\68\u0194\n8\r8\168\u0195\39\39\3:\3:\3;\3;\3<\3<\7<\u01a0"+ - "\n<\f<\16<\u01a3\13<\3=\3=\3>\3>\3?\6?\u01aa\n?\r?\16?\u01ab\3?\3?\3@"+ - "\3@\3@\3@\7@\u01b4\n@\f@\16@\u01b7\13@\3@\3@\3A\3A\3A\3A\7A\u01bf\nA\f"+ - "A\16A\u01c2\13A\3A\3A\3A\3A\3A\3\u01c0\2B\3\3\5\4\7\5\t\6\13\7\r\b\17"+ - "\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+"+ - "\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K\'M(O)Q*S+"+ - "U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9q\2s\2u\2w:y\2{\2};\177<\u0081"+ - "=\3\2\f\3\2$$\3\2))\4\2DDdd\3\2\62\63\3\2\62;\5\2\62;CHch\5\2C\\aac|\6"+ - "\2\62;C\\aac|\5\2\13\f\17\17\"\"\4\2\f\f\17\17\2\u01e4\2\3\3\2\2\2\2\5"+ - "\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2"+ - "\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33"+ - "\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2"+ - "\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2"+ - "\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2"+ - "\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K"+ - "\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2"+ - "\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2"+ - "\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2w"+ - "\3\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\3\u0083\3\2\2\2\5\u0085"+ - "\3\2\2\2\7\u0087\3\2\2\2\t\u0089\3\2\2\2\13\u008b\3\2\2\2\r\u0091\3\2"+ - "\2\2\17\u0093\3\2\2\2\21\u0095\3\2\2\2\23\u0098\3\2\2\2\25\u009d\3\2\2"+ - "\2\27\u00a3\3\2\2\2\31\u00a6\3\2\2\2\33\u00aa\3\2\2\2\35\u00b1\3\2\2\2"+ - "\37\u00b3\3\2\2\2!\u00b6\3\2\2\2#\u00b8\3\2\2\2%\u00ba\3\2\2\2\'\u00bc"+ - "\3\2\2\2)\u00be\3\2\2\2+\u00c1\3\2\2\2-\u00c4\3\2\2\2/\u00c6\3\2\2\2\61"+ - "\u00c8\3\2\2\2\63\u00cc\3\2\2\2\65\u00ce\3\2\2\2\67\u00d0\3\2\2\29\u00d3"+ - "\3\2\2\2;\u00d6\3\2\2\2=\u00d8\3\2\2\2?\u00db\3\2\2\2A\u00de\3\2\2\2C"+ - "\u00e1\3\2\2\2E\u00e3\3\2\2\2G\u00e6\3\2\2\2I\u00e9\3\2\2\2K\u00ec\3\2"+ - "\2\2M\u00ef\3\2\2\2O\u00f1\3\2\2\2Q\u00f5\3\2\2\2S\u00f8\3\2\2\2U\u00fb"+ - "\3\2\2\2W\u0117\3\2\2\2Y\u0119\3\2\2\2[\u0124\3\2\2\2]\u0135\3\2\2\2_"+ - "\u0139\3\2\2\2a\u013e\3\2\2\2c\u0145\3\2\2\2e\u0156\3\2\2\2g\u0164\3\2"+ - "\2\2i\u0175\3\2\2\2k\u0184\3\2\2\2m\u0187\3\2\2\2o\u0190\3\2\2\2q\u0197"+ - "\3\2\2\2s\u0199\3\2\2\2u\u019b\3\2\2\2w\u019d\3\2\2\2y\u01a4\3\2\2\2{"+ - "\u01a6\3\2\2\2}\u01a9\3\2\2\2\177\u01af\3\2\2\2\u0081\u01ba\3\2\2\2\u0083"+ - "\u0084\7}\2\2\u0084\4\3\2\2\2\u0085\u0086\7\177\2\2\u0086\6\3\2\2\2\u0087"+ - "\u0088\7*\2\2\u0088\b\3\2\2\2\u0089\u008a\7+\2\2\u008a\n\3\2\2\2\u008b"+ - "\u008c\7e\2\2\u008c\u008d\7q\2\2\u008d\u008e\7p\2\2\u008e\u008f\7u\2\2"+ - "\u008f\u0090\7v\2\2\u0090\f\3\2\2\2\u0091\u0092\7?\2\2\u0092\16\3\2\2"+ - "\2\u0093\u0094\7=\2\2\u0094\20\3\2\2\2\u0095\u0096\7k\2\2\u0096\u0097"+ - "\7h\2\2\u0097\22\3\2\2\2\u0098\u0099\7g\2\2\u0099\u009a\7n\2\2\u009a\u009b"+ - "\7u\2\2\u009b\u009c\7g\2\2\u009c\24\3\2\2\2\u009d\u009e\7y\2\2\u009e\u009f"+ - "\7j\2\2\u009f\u00a0\7k\2\2\u00a0\u00a1\7n\2\2\u00a1\u00a2\7g\2\2\u00a2"+ - "\26\3\2\2\2\u00a3\u00a4\7f\2\2\u00a4\u00a5\7q\2\2\u00a5\30\3\2\2\2\u00a6"+ - "\u00a7\7h\2\2\u00a7\u00a8\7q\2\2\u00a8\u00a9\7t\2\2\u00a9\32\3\2\2\2\u00aa"+ - "\u00ab\7t\2\2\u00ab\u00ac\7g\2\2\u00ac\u00ad\7v\2\2\u00ad\u00ae\7w\2\2"+ - "\u00ae\u00af\7t\2\2\u00af\u00b0\7p\2\2\u00b0\34\3\2\2\2\u00b1\u00b2\7"+ - "<\2\2\u00b2\36\3\2\2\2\u00b3\u00b4\7\60\2\2\u00b4\u00b5\7\60\2\2\u00b5"+ - " \3\2\2\2\u00b6\u00b7\7.\2\2\u00b7\"\3\2\2\2\u00b8\u00b9\7,\2\2\u00b9"+ - "$\3\2\2\2\u00ba\u00bb\7]\2\2\u00bb&\3\2\2\2\u00bc\u00bd\7_\2\2\u00bd("+ - "\3\2\2\2\u00be\u00bf\7/\2\2\u00bf\u00c0\7/\2\2\u00c0*\3\2\2\2\u00c1\u00c2"+ - "\7-\2\2\u00c2\u00c3\7-\2\2\u00c3,\3\2\2\2\u00c4\u00c5\7-\2\2\u00c5.\3"+ - "\2\2\2\u00c6\u00c7\7/\2\2\u00c7\60\3\2\2\2\u00c8\u00c9\7p\2\2\u00c9\u00ca"+ - "\7q\2\2\u00ca\u00cb\7v\2\2\u00cb\62\3\2\2\2\u00cc\u00cd\7#\2\2\u00cd\64"+ - "\3\2\2\2\u00ce\u00cf\7(\2\2\u00cf\66\3\2\2\2\u00d0\u00d1\7@\2\2\u00d1"+ - "\u00d2\7@\2\2\u00d28\3\2\2\2\u00d3\u00d4\7>\2\2\u00d4\u00d5\7>\2\2\u00d5"+ - ":\3\2\2\2\u00d6\u00d7\7\61\2\2\u00d7<\3\2\2\2\u00d8\u00d9\7?\2\2\u00d9"+ - "\u00da\7?\2\2\u00da>\3\2\2\2\u00db\u00dc\7#\2\2\u00dc\u00dd\7?\2\2\u00dd"+ - "@\3\2\2\2\u00de\u00df\7>\2\2\u00df\u00e0\7@\2\2\u00e0B\3\2\2\2\u00e1\u00e2"+ - "\7>\2\2\u00e2D\3\2\2\2\u00e3\u00e4\7>\2\2\u00e4\u00e5\7?\2\2\u00e5F\3"+ - "\2\2\2\u00e6\u00e7\7?\2\2\u00e7\u00e8\7>\2\2\u00e8H\3\2\2\2\u00e9\u00ea"+ - "\7@\2\2\u00ea\u00eb\7?\2\2\u00ebJ\3\2\2\2\u00ec\u00ed\7?\2\2\u00ed\u00ee"+ - "\7@\2\2\u00eeL\3\2\2\2\u00ef\u00f0\7@\2\2\u00f0N\3\2\2\2\u00f1\u00f2\7"+ - "c\2\2\u00f2\u00f3\7p\2\2\u00f3\u00f4\7f\2\2\u00f4P\3\2\2\2\u00f5\u00f6"+ - "\7(\2\2\u00f6\u00f7\7(\2\2\u00f7R\3\2\2\2\u00f8\u00f9\7q\2\2\u00f9\u00fa"+ - "\7t\2\2\u00faT\3\2\2\2\u00fb\u00fc\7~\2\2\u00fc\u00fd\7~\2\2\u00fdV\3"+ - "\2\2\2\u00fe\u00ff\7d\2\2\u00ff\u0100\7{\2\2\u0100\u0101\7v\2\2\u0101"+ - "\u0118\7g\2\2\u0102\u0103\7y\2\2\u0103\u0104\7q\2\2\u0104\u0105\7t\2\2"+ - "\u0105\u0118\7f\2\2\u0106\u0107\7u\2\2\u0107\u0108\7v\2\2\u0108\u0109"+ - "\7t\2\2\u0109\u010a\7k\2\2\u010a\u010b\7p\2\2\u010b\u0118\7i\2\2\u010c"+ - "\u010d\7d\2\2\u010d\u010e\7q\2\2\u010e\u010f\7q\2\2\u010f\u0110\7n\2\2"+ - "\u0110\u0111\7g\2\2\u0111\u0112\7c\2\2\u0112\u0118\7p\2\2\u0113\u0114"+ - "\7x\2\2\u0114\u0115\7q\2\2\u0115\u0116\7k\2\2\u0116\u0118\7f\2\2\u0117"+ - "\u00fe\3\2\2\2\u0117\u0102\3\2\2\2\u0117\u0106\3\2\2\2\u0117\u010c\3\2"+ - "\2\2\u0117\u0113\3\2\2\2\u0118X\3\2\2\2\u0119\u011f\7$\2\2\u011a\u011b"+ - "\7^\2\2\u011b\u011e\7$\2\2\u011c\u011e\n\2\2\2\u011d\u011a\3\2\2\2\u011d"+ - "\u011c\3\2\2\2\u011e\u0121\3\2\2\2\u011f\u011d\3\2\2\2\u011f\u0120\3\2"+ - "\2\2\u0120\u0122\3\2\2\2\u0121\u011f\3\2\2\2\u0122\u0123\7$\2\2\u0123"+ - "Z\3\2\2\2\u0124\u0128\7)\2\2\u0125\u0126\7^\2\2\u0126\u0129\7)\2\2\u0127"+ - "\u0129\n\3\2\2\u0128\u0125\3\2\2\2\u0128\u0127\3\2\2\2\u0129\u012a\3\2"+ - "\2\2\u012a\u012b\7)\2\2\u012b\\\3\2\2\2\u012c\u012d\7v\2\2\u012d\u012e"+ - "\7t\2\2\u012e\u012f\7w\2\2\u012f\u0136\7g\2\2\u0130\u0131\7h\2\2\u0131"+ - "\u0132\7c\2\2\u0132\u0133\7n\2\2\u0133\u0134\7u\2\2\u0134\u0136\7g\2\2"+ - "\u0135\u012c\3\2\2\2\u0135\u0130\3\2\2\2\u0136^\3\2\2\2\u0137\u013a\5"+ - "a\61\2\u0138\u013a\5i\65\2\u0139\u0137\3\2\2\2\u0139\u0138\3\2\2\2\u013a"+ - "`\3\2\2\2\u013b\u013f\5c\62\2\u013c\u013f\5e\63\2\u013d\u013f\5g\64\2"+ - "\u013e\u013b\3\2\2\2\u013e\u013c\3\2\2\2\u013e\u013d\3\2\2\2\u013fb\3"+ - "\2\2\2\u0140\u0146\7\'\2\2\u0141\u0142\7\62\2\2\u0142\u0146\7d\2\2\u0143"+ - "\u0144\7\62\2\2\u0144\u0146\7D\2\2\u0145\u0140\3\2\2\2\u0145\u0141\3\2"+ - "\2\2\u0145\u0143\3\2\2\2\u0146\u014a\3\2\2\2\u0147\u0149\5q9\2\u0148\u0147"+ - "\3\2\2\2\u0149\u014c\3\2\2\2\u014a\u0148\3\2\2\2\u014a\u014b\3\2\2\2\u014b"+ - "\u014d\3\2\2\2\u014c\u014a\3\2\2\2\u014d\u014f\7\60\2\2\u014e\u0150\5"+ - "q9\2\u014f\u014e\3\2\2\2\u0150\u0151\3\2\2\2\u0151\u014f\3\2\2\2\u0151"+ - "\u0152\3\2\2\2\u0152d\3\2\2\2\u0153\u0155\5s:\2\u0154\u0153\3\2\2\2\u0155"+ - "\u0158\3\2\2\2\u0156\u0154\3\2\2\2\u0156\u0157\3\2\2\2\u0157\u0159\3\2"+ - "\2\2\u0158\u0156\3\2\2\2\u0159\u015b\7\60\2\2\u015a\u015c\5s:\2\u015b"+ - "\u015a\3\2\2\2\u015c\u015d\3\2\2\2\u015d\u015b\3\2\2\2\u015d\u015e\3\2"+ - "\2\2\u015ef\3\2\2\2\u015f\u0165\7&\2\2\u0160\u0161\7\62\2\2\u0161\u0165"+ - "\7z\2\2\u0162\u0163\7\62\2\2\u0163\u0165\7Z\2\2\u0164\u015f\3\2\2\2\u0164"+ - "\u0160\3\2\2\2\u0164\u0162\3\2\2\2\u0165\u0169\3\2\2\2\u0166\u0168\5u"+ - ";\2\u0167\u0166\3\2\2\2\u0168\u016b\3\2\2\2\u0169\u0167\3\2\2\2\u0169"+ - "\u016a\3\2\2\2\u016a\u016c\3\2\2\2\u016b\u0169\3\2\2\2\u016c\u016e\7\60"+ - "\2\2\u016d\u016f\5u;\2\u016e\u016d\3\2\2\2\u016f\u0170\3\2\2\2\u0170\u016e"+ - "\3\2\2\2\u0170\u0171\3\2\2\2\u0171h\3\2\2\2\u0172\u0176\5m\67\2\u0173"+ - "\u0176\5o8\2\u0174\u0176\5k\66\2\u0175\u0172\3\2\2\2\u0175\u0173\3\2\2"+ - "\2\u0175\u0174\3\2\2\2\u0176j\3\2\2\2\u0177\u0178\7\62\2\2\u0178\u017a"+ - "\t\4\2\2\u0179\u017b\5q9\2\u017a\u0179\3\2\2\2\u017b\u017c\3\2\2\2\u017c"+ - "\u017a\3\2\2\2\u017c\u017d\3\2\2\2\u017d\u0185\3\2\2\2\u017e\u0180\7\'"+ - "\2\2\u017f\u0181\5q9\2\u0180\u017f\3\2\2\2\u0181\u0182\3\2\2\2\u0182\u0180"+ - "\3\2\2\2\u0182\u0183\3\2\2\2\u0183\u0185\3\2\2\2\u0184\u0177\3\2\2\2\u0184"+ - "\u017e\3\2\2\2\u0185l\3\2\2\2\u0186\u0188\5s:\2\u0187\u0186\3\2\2\2\u0188"+ - "\u0189\3\2\2\2\u0189\u0187\3\2\2\2\u0189\u018a\3\2\2\2\u018an\3\2\2\2"+ - "\u018b\u0191\7&\2\2\u018c\u018d\7\62\2\2\u018d\u0191\7z\2\2\u018e\u018f"+ - "\7\62\2\2\u018f\u0191\7Z\2\2\u0190\u018b\3\2\2\2\u0190\u018c\3\2\2\2\u0190"+ - "\u018e\3\2\2\2\u0191\u0193\3\2\2\2\u0192\u0194\5u;\2\u0193\u0192\3\2\2"+ - "\2\u0194\u0195\3\2\2\2\u0195\u0193\3\2\2\2\u0195\u0196\3\2\2\2\u0196p"+ - "\3\2\2\2\u0197\u0198\t\5\2\2\u0198r\3\2\2\2\u0199\u019a\t\6\2\2\u019a"+ - "t\3\2\2\2\u019b\u019c\t\7\2\2\u019cv\3\2\2\2\u019d\u01a1\5y=\2\u019e\u01a0"+ - "\5{>\2\u019f\u019e\3\2\2\2\u01a0\u01a3\3\2\2\2\u01a1\u019f\3\2\2\2\u01a1"+ - "\u01a2\3\2\2\2\u01a2x\3\2\2\2\u01a3\u01a1\3\2\2\2\u01a4\u01a5\t\b\2\2"+ - "\u01a5z\3\2\2\2\u01a6\u01a7\t\t\2\2\u01a7|\3\2\2\2\u01a8\u01aa\t\n\2\2"+ - "\u01a9\u01a8\3\2\2\2\u01aa\u01ab\3\2\2\2\u01ab\u01a9\3\2\2\2\u01ab\u01ac"+ - "\3\2\2\2\u01ac\u01ad\3\2\2\2\u01ad\u01ae\b?\2\2\u01ae~\3\2\2\2\u01af\u01b0"+ - "\7\61\2\2\u01b0\u01b1\7\61\2\2\u01b1\u01b5\3\2\2\2\u01b2\u01b4\n\13\2"+ - "\2\u01b3\u01b2\3\2\2\2\u01b4\u01b7\3\2\2\2\u01b5\u01b3\3\2\2\2\u01b5\u01b6"+ - "\3\2\2\2\u01b6\u01b8\3\2\2\2\u01b7\u01b5\3\2\2\2\u01b8\u01b9\b@\2\2\u01b9"+ - "\u0080\3\2\2\2\u01ba\u01bb\7\61\2\2\u01bb\u01bc\7,\2\2\u01bc\u01c0\3\2"+ - "\2\2\u01bd\u01bf\13\2\2\2\u01be\u01bd\3\2\2\2\u01bf\u01c2\3\2\2\2\u01c0"+ - "\u01c1\3\2\2\2\u01c0\u01be\3\2\2\2\u01c1\u01c3\3\2\2\2\u01c2\u01c0\3\2"+ - "\2\2\u01c3\u01c4\7,\2\2\u01c4\u01c5\7\61\2\2\u01c5\u01c6\3\2\2\2\u01c6"+ - "\u01c7\bA\2\2\u01c7\u0082\3\2\2\2\35\2\u0117\u011d\u011f\u0128\u0135\u0139"+ - "\u013e\u0145\u014a\u0151\u0156\u015d\u0164\u0169\u0170\u0175\u017c\u0182"+ - "\u0184\u0189\u0190\u0195\u01a1\u01ab\u01b5\u01c0\3\b\2\2"; + "\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\3\2\3\2\3\3\3\3\3\4\3"+ + "\4\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\t\3\n\3\n"+ + "\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\r"+ + "\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\21\3\21"+ + "\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\25\3\26\3\26\3\26\3\27\3\27"+ + "\3\30\3\30\3\31\3\31\3\31\3\31\3\32\3\32\3\33\3\33\3\34\3\34\3\35\3\35"+ + "\3\35\3\36\3\36\3\36\3\37\3\37\3 \3 \3!\3!\3!\3\"\3\"\3\"\3#\3#\3#\3$"+ + "\3$\3%\3%\3%\3&\3&\3&\3\'\3\'\3\'\3(\3(\3(\3)\3)\3*\3*\3+\3+\3,\3,\3,"+ + "\3,\3-\3-\3-\3.\3.\3.\3/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60"+ + "\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60"+ + "\3\60\3\60\3\60\5\60\u0128\n\60\3\61\3\61\3\61\3\61\7\61\u012e\n\61\f"+ + "\61\16\61\u0131\13\61\3\61\3\61\3\62\3\62\3\62\3\62\5\62\u0139\n\62\3"+ + "\62\3\62\3\63\3\63\3\63\3\63\3\63\3\63\3\63\3\63\3\63\5\63\u0146\n\63"+ + "\3\64\3\64\5\64\u014a\n\64\3\65\3\65\3\65\5\65\u014f\n\65\3\66\3\66\3"+ + "\66\3\66\3\66\5\66\u0156\n\66\3\66\7\66\u0159\n\66\f\66\16\66\u015c\13"+ + "\66\3\66\3\66\6\66\u0160\n\66\r\66\16\66\u0161\3\67\7\67\u0165\n\67\f"+ + "\67\16\67\u0168\13\67\3\67\3\67\6\67\u016c\n\67\r\67\16\67\u016d\38\3"+ + "8\38\38\38\58\u0175\n8\38\78\u0178\n8\f8\168\u017b\138\38\38\68\u017f"+ + "\n8\r8\168\u0180\39\39\39\59\u0186\n9\3:\3:\3:\6:\u018b\n:\r:\16:\u018c"+ + "\3:\3:\6:\u0191\n:\r:\16:\u0192\5:\u0195\n:\3;\6;\u0198\n;\r;\16;\u0199"+ + "\3<\3<\3<\3<\3<\5<\u01a1\n<\3<\6<\u01a4\n<\r<\16<\u01a5\3=\3=\3>\3>\3"+ + "?\3?\3@\3@\7@\u01b0\n@\f@\16@\u01b3\13@\3A\3A\3B\3B\3C\6C\u01ba\nC\rC"+ + "\16C\u01bb\3C\3C\3D\3D\3D\3D\7D\u01c4\nD\fD\16D\u01c7\13D\3D\3D\3E\3E"+ + "\3E\3E\7E\u01cf\nE\fE\16E\u01d2\13E\3E\3E\3E\3E\3E\3\u01d0\2F\3\3\5\4"+ + "\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22"+ + "#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C"+ + "#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9q:s;u\u0081\2\u0083\2\u0085?\u0087@\u0089A\3\2\f\3\2$$\3\2)"+ + ")\4\2DDdd\3\2\62\63\3\2\62;\5\2\62;CHch\5\2C\\aac|\6\2\62;C\\aac|\5\2"+ + "\13\f\17\17\"\"\4\2\f\f\17\17\2\u01f4\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2"+ + "\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2"+ + "\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3"+ + "\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3"+ + "\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65"+ + "\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3"+ + "\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2"+ + "\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2"+ + "[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3"+ + "\2\2\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2s\3\2\2"+ + "\2\2u\3\2\2\2\2w\3\2\2\2\2\177\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2"+ + "\2\u0089\3\2\2\2\3\u008b\3\2\2\2\5\u008d\3\2\2\2\7\u008f\3\2\2\2\t\u0091"+ + "\3\2\2\2\13\u0093\3\2\2\2\r\u0099\3\2\2\2\17\u009b\3\2\2\2\21\u009d\3"+ + "\2\2\2\23\u00a0\3\2\2\2\25\u00a5\3\2\2\2\27\u00ab\3\2\2\2\31\u00ae\3\2"+ + "\2\2\33\u00b2\3\2\2\2\35\u00b9\3\2\2\2\37\u00bb\3\2\2\2!\u00be\3\2\2\2"+ + "#\u00c0\3\2\2\2%\u00c2\3\2\2\2\'\u00c4\3\2\2\2)\u00c6\3\2\2\2+\u00c9\3"+ + "\2\2\2-\u00cc\3\2\2\2/\u00ce\3\2\2\2\61\u00d0\3\2\2\2\63\u00d4\3\2\2\2"+ + "\65\u00d6\3\2\2\2\67\u00d8\3\2\2\29\u00da\3\2\2\2;\u00dd\3\2\2\2=\u00e0"+ + "\3\2\2\2?\u00e2\3\2\2\2A\u00e4\3\2\2\2C\u00e7\3\2\2\2E\u00ea\3\2\2\2G"+ + "\u00ed\3\2\2\2I\u00ef\3\2\2\2K\u00f2\3\2\2\2M\u00f5\3\2\2\2O\u00f8\3\2"+ + "\2\2Q\u00fb\3\2\2\2S\u00fd\3\2\2\2U\u00ff\3\2\2\2W\u0101\3\2\2\2Y\u0105"+ + "\3\2\2\2[\u0108\3\2\2\2]\u010b\3\2\2\2_\u0127\3\2\2\2a\u0129\3\2\2\2c"+ + "\u0134\3\2\2\2e\u0145\3\2\2\2g\u0149\3\2\2\2i\u014e\3\2\2\2k\u0155\3\2"+ + "\2\2m\u0166\3\2\2\2o\u0174\3\2\2\2q\u0185\3\2\2\2s\u0194\3\2\2\2u\u0197"+ + "\3\2\2\2w\u01a0\3\2\2\2y\u01a7\3\2\2\2{\u01a9\3\2\2\2}\u01ab\3\2\2\2\177"+ + "\u01ad\3\2\2\2\u0081\u01b4\3\2\2\2\u0083\u01b6\3\2\2\2\u0085\u01b9\3\2"+ + "\2\2\u0087\u01bf\3\2\2\2\u0089\u01ca\3\2\2\2\u008b\u008c\7}\2\2\u008c"+ + "\4\3\2\2\2\u008d\u008e\7\177\2\2\u008e\6\3\2\2\2\u008f\u0090\7*\2\2\u0090"+ + "\b\3\2\2\2\u0091\u0092\7+\2\2\u0092\n\3\2\2\2\u0093\u0094\7e\2\2\u0094"+ + "\u0095\7q\2\2\u0095\u0096\7p\2\2\u0096\u0097\7u\2\2\u0097\u0098\7v\2\2"+ + "\u0098\f\3\2\2\2\u0099\u009a\7?\2\2\u009a\16\3\2\2\2\u009b\u009c\7=\2"+ + "\2\u009c\20\3\2\2\2\u009d\u009e\7k\2\2\u009e\u009f\7h\2\2\u009f\22\3\2"+ + "\2\2\u00a0\u00a1\7g\2\2\u00a1\u00a2\7n\2\2\u00a2\u00a3\7u\2\2\u00a3\u00a4"+ + "\7g\2\2\u00a4\24\3\2\2\2\u00a5\u00a6\7y\2\2\u00a6\u00a7\7j\2\2\u00a7\u00a8"+ + "\7k\2\2\u00a8\u00a9\7n\2\2\u00a9\u00aa\7g\2\2\u00aa\26\3\2\2\2\u00ab\u00ac"+ + "\7f\2\2\u00ac\u00ad\7q\2\2\u00ad\30\3\2\2\2\u00ae\u00af\7h\2\2\u00af\u00b0"+ + "\7q\2\2\u00b0\u00b1\7t\2\2\u00b1\32\3\2\2\2\u00b2\u00b3\7t\2\2\u00b3\u00b4"+ + "\7g\2\2\u00b4\u00b5\7v\2\2\u00b5\u00b6\7w\2\2\u00b6\u00b7\7t\2\2\u00b7"+ + "\u00b8\7p\2\2\u00b8\34\3\2\2\2\u00b9\u00ba\7<\2\2\u00ba\36\3\2\2\2\u00bb"+ + "\u00bc\7\60\2\2\u00bc\u00bd\7\60\2\2\u00bd \3\2\2\2\u00be\u00bf\7.\2\2"+ + "\u00bf\"\3\2\2\2\u00c0\u00c1\7,\2\2\u00c1$\3\2\2\2\u00c2\u00c3\7]\2\2"+ + "\u00c3&\3\2\2\2\u00c4\u00c5\7_\2\2\u00c5(\3\2\2\2\u00c6\u00c7\7/\2\2\u00c7"+ + "\u00c8\7/\2\2\u00c8*\3\2\2\2\u00c9\u00ca\7-\2\2\u00ca\u00cb\7-\2\2\u00cb"+ + ",\3\2\2\2\u00cc\u00cd\7-\2\2\u00cd.\3\2\2\2\u00ce\u00cf\7/\2\2\u00cf\60"+ + "\3\2\2\2\u00d0\u00d1\7p\2\2\u00d1\u00d2\7q\2\2\u00d2\u00d3\7v\2\2\u00d3"+ + "\62\3\2\2\2\u00d4\u00d5\7#\2\2\u00d5\64\3\2\2\2\u00d6\u00d7\7(\2\2\u00d7"+ + "\66\3\2\2\2\u00d8\u00d9\7\u0080\2\2\u00d98\3\2\2\2\u00da\u00db\7@\2\2"+ + "\u00db\u00dc\7@\2\2\u00dc:\3\2\2\2\u00dd\u00de\7>\2\2\u00de\u00df\7>\2"+ + "\2\u00df<\3\2\2\2\u00e0\u00e1\7\61\2\2\u00e1>\3\2\2\2\u00e2\u00e3\7\'"+ + "\2\2\u00e3@\3\2\2\2\u00e4\u00e5\7?\2\2\u00e5\u00e6\7?\2\2\u00e6B\3\2\2"+ + "\2\u00e7\u00e8\7#\2\2\u00e8\u00e9\7?\2\2\u00e9D\3\2\2\2\u00ea\u00eb\7"+ + ">\2\2\u00eb\u00ec\7@\2\2\u00ecF\3\2\2\2\u00ed\u00ee\7>\2\2\u00eeH\3\2"+ + "\2\2\u00ef\u00f0\7>\2\2\u00f0\u00f1\7?\2\2\u00f1J\3\2\2\2\u00f2\u00f3"+ + "\7?\2\2\u00f3\u00f4\7>\2\2\u00f4L\3\2\2\2\u00f5\u00f6\7@\2\2\u00f6\u00f7"+ + "\7?\2\2\u00f7N\3\2\2\2\u00f8\u00f9\7?\2\2\u00f9\u00fa\7@\2\2\u00faP\3"+ + "\2\2\2\u00fb\u00fc\7@\2\2\u00fcR\3\2\2\2\u00fd\u00fe\7`\2\2\u00feT\3\2"+ + "\2\2\u00ff\u0100\7~\2\2\u0100V\3\2\2\2\u0101\u0102\7c\2\2\u0102\u0103"+ + "\7p\2\2\u0103\u0104\7f\2\2\u0104X\3\2\2\2\u0105\u0106\7(\2\2\u0106\u0107"+ + "\7(\2\2\u0107Z\3\2\2\2\u0108\u0109\7q\2\2\u0109\u010a\7t\2\2\u010a\\\3"+ + "\2\2\2\u010b\u010c\7~\2\2\u010c\u010d\7~\2\2\u010d^\3\2\2\2\u010e\u010f"+ + "\7d\2\2\u010f\u0110\7{\2\2\u0110\u0111\7v\2\2\u0111\u0128\7g\2\2\u0112"+ + "\u0113\7y\2\2\u0113\u0114\7q\2\2\u0114\u0115\7t\2\2\u0115\u0128\7f\2\2"+ + "\u0116\u0117\7u\2\2\u0117\u0118\7v\2\2\u0118\u0119\7t\2\2\u0119\u011a"+ + "\7k\2\2\u011a\u011b\7p\2\2\u011b\u0128\7i\2\2\u011c\u011d\7d\2\2\u011d"+ + "\u011e\7q\2\2\u011e\u011f\7q\2\2\u011f\u0120\7n\2\2\u0120\u0121\7g\2\2"+ + "\u0121\u0122\7c\2\2\u0122\u0128\7p\2\2\u0123\u0124\7x\2\2\u0124\u0125"+ + "\7q\2\2\u0125\u0126\7k\2\2\u0126\u0128\7f\2\2\u0127\u010e\3\2\2\2\u0127"+ + "\u0112\3\2\2\2\u0127\u0116\3\2\2\2\u0127\u011c\3\2\2\2\u0127\u0123\3\2"+ + "\2\2\u0128`\3\2\2\2\u0129\u012f\7$\2\2\u012a\u012b\7^\2\2\u012b\u012e"+ + "\7$\2\2\u012c\u012e\n\2\2\2\u012d\u012a\3\2\2\2\u012d\u012c\3\2\2\2\u012e"+ + "\u0131\3\2\2\2\u012f\u012d\3\2\2\2\u012f\u0130\3\2\2\2\u0130\u0132\3\2"+ + "\2\2\u0131\u012f\3\2\2\2\u0132\u0133\7$\2\2\u0133b\3\2\2\2\u0134\u0138"+ + "\7)\2\2\u0135\u0136\7^\2\2\u0136\u0139\7)\2\2\u0137\u0139\n\3\2\2\u0138"+ + "\u0135\3\2\2\2\u0138\u0137\3\2\2\2\u0139\u013a\3\2\2\2\u013a\u013b\7)"+ + "\2\2\u013bd\3\2\2\2\u013c\u013d\7v\2\2\u013d\u013e\7t\2\2\u013e\u013f"+ + "\7w\2\2\u013f\u0146\7g\2\2\u0140\u0141\7h\2\2\u0141\u0142\7c\2\2\u0142"+ + "\u0143\7n\2\2\u0143\u0144\7u\2\2\u0144\u0146\7g\2\2\u0145\u013c\3\2\2"+ + "\2\u0145\u0140\3\2\2\2\u0146f\3\2\2\2\u0147\u014a\5i\65\2\u0148\u014a"+ + "\5q9\2\u0149\u0147\3\2\2\2\u0149\u0148\3\2\2\2\u014ah\3\2\2\2\u014b\u014f"+ + "\5k\66\2\u014c\u014f\5m\67\2\u014d\u014f\5o8\2\u014e\u014b\3\2\2\2\u014e"+ + "\u014c\3\2\2\2\u014e\u014d\3\2\2\2\u014fj\3\2\2\2\u0150\u0156\7\'\2\2"+ + "\u0151\u0152\7\62\2\2\u0152\u0156\7d\2\2\u0153\u0154\7\62\2\2\u0154\u0156"+ + "\7D\2\2\u0155\u0150\3\2\2\2\u0155\u0151\3\2\2\2\u0155\u0153\3\2\2\2\u0156"+ + "\u015a\3\2\2\2\u0157\u0159\5y=\2\u0158\u0157\3\2\2\2\u0159\u015c\3\2\2"+ + "\2\u015a\u0158\3\2\2\2\u015a\u015b\3\2\2\2\u015b\u015d\3\2\2\2\u015c\u015a"+ + "\3\2\2\2\u015d\u015f\7\60\2\2\u015e\u0160\5y=\2\u015f\u015e\3\2\2\2\u0160"+ + "\u0161\3\2\2\2\u0161\u015f\3\2\2\2\u0161\u0162\3\2\2\2\u0162l\3\2\2\2"+ + "\u0163\u0165\5{>\2\u0164\u0163\3\2\2\2\u0165\u0168\3\2\2\2\u0166\u0164"+ + "\3\2\2\2\u0166\u0167\3\2\2\2\u0167\u0169\3\2\2\2\u0168\u0166\3\2\2\2\u0169"+ + "\u016b\7\60\2\2\u016a\u016c\5{>\2\u016b\u016a\3\2\2\2\u016c\u016d\3\2"+ + "\2\2\u016d\u016b\3\2\2\2\u016d\u016e\3\2\2\2\u016en\3\2\2\2\u016f\u0175"+ + "\7&\2\2\u0170\u0171\7\62\2\2\u0171\u0175\7z\2\2\u0172\u0173\7\62\2\2\u0173"+ + "\u0175\7Z\2\2\u0174\u016f\3\2\2\2\u0174\u0170\3\2\2\2\u0174\u0172\3\2"+ + "\2\2\u0175\u0179\3\2\2\2\u0176\u0178\5}?\2\u0177\u0176\3\2\2\2\u0178\u017b"+ + "\3\2\2\2\u0179\u0177\3\2\2\2\u0179\u017a\3\2\2\2\u017a\u017c\3\2\2\2\u017b"+ + "\u0179\3\2\2\2\u017c\u017e\7\60\2\2\u017d\u017f\5}?\2\u017e\u017d\3\2"+ + "\2\2\u017f\u0180\3\2\2\2\u0180\u017e\3\2\2\2\u0180\u0181\3\2\2\2\u0181"+ + "p\3\2\2\2\u0182\u0186\5u;\2\u0183\u0186\5w<\2\u0184\u0186\5s:\2\u0185"+ + "\u0182\3\2\2\2\u0185\u0183\3\2\2\2\u0185\u0184\3\2\2\2\u0186r\3\2\2\2"+ + "\u0187\u0188\7\62\2\2\u0188\u018a\t\4\2\2\u0189\u018b\5y=\2\u018a\u0189"+ + "\3\2\2\2\u018b\u018c\3\2\2\2\u018c\u018a\3\2\2\2\u018c\u018d\3\2\2\2\u018d"+ + "\u0195\3\2\2\2\u018e\u0190\7\'\2\2\u018f\u0191\5y=\2\u0190\u018f\3\2\2"+ + "\2\u0191\u0192\3\2\2\2\u0192\u0190\3\2\2\2\u0192\u0193\3\2\2\2\u0193\u0195"+ + "\3\2\2\2\u0194\u0187\3\2\2\2\u0194\u018e\3\2\2\2\u0195t\3\2\2\2\u0196"+ + "\u0198\5{>\2\u0197\u0196\3\2\2\2\u0198\u0199\3\2\2\2\u0199\u0197\3\2\2"+ + "\2\u0199\u019a\3\2\2\2\u019av\3\2\2\2\u019b\u01a1\7&\2\2\u019c\u019d\7"+ + "\62\2\2\u019d\u01a1\7z\2\2\u019e\u019f\7\62\2\2\u019f\u01a1\7Z\2\2\u01a0"+ + "\u019b\3\2\2\2\u01a0\u019c\3\2\2\2\u01a0\u019e\3\2\2\2\u01a1\u01a3\3\2"+ + "\2\2\u01a2\u01a4\5}?\2\u01a3\u01a2\3\2\2\2\u01a4\u01a5\3\2\2\2\u01a5\u01a3"+ + "\3\2\2\2\u01a5\u01a6\3\2\2\2\u01a6x\3\2\2\2\u01a7\u01a8\t\5\2\2\u01a8"+ + "z\3\2\2\2\u01a9\u01aa\t\6\2\2\u01aa|\3\2\2\2\u01ab\u01ac\t\7\2\2\u01ac"+ + "~\3\2\2\2\u01ad\u01b1\5\u0081A\2\u01ae\u01b0\5\u0083B\2\u01af\u01ae\3"+ + "\2\2\2\u01b0\u01b3\3\2\2\2\u01b1\u01af\3\2\2\2\u01b1\u01b2\3\2\2\2\u01b2"+ + "\u0080\3\2\2\2\u01b3\u01b1\3\2\2\2\u01b4\u01b5\t\b\2\2\u01b5\u0082\3\2"+ + "\2\2\u01b6\u01b7\t\t\2\2\u01b7\u0084\3\2\2\2\u01b8\u01ba\t\n\2\2\u01b9"+ + "\u01b8\3\2\2\2\u01ba\u01bb\3\2\2\2\u01bb\u01b9\3\2\2\2\u01bb\u01bc\3\2"+ + "\2\2\u01bc\u01bd\3\2\2\2\u01bd\u01be\bC\2\2\u01be\u0086\3\2\2\2\u01bf"+ + "\u01c0\7\61\2\2\u01c0\u01c1\7\61\2\2\u01c1\u01c5\3\2\2\2\u01c2\u01c4\n"+ + "\13\2\2\u01c3\u01c2\3\2\2\2\u01c4\u01c7\3\2\2\2\u01c5\u01c3\3\2\2\2\u01c5"+ + "\u01c6\3\2\2\2\u01c6\u01c8\3\2\2\2\u01c7\u01c5\3\2\2\2\u01c8\u01c9\bD"+ + "\2\2\u01c9\u0088\3\2\2\2\u01ca\u01cb\7\61\2\2\u01cb\u01cc\7,\2\2\u01cc"+ + "\u01d0\3\2\2\2\u01cd\u01cf\13\2\2\2\u01ce\u01cd\3\2\2\2\u01cf\u01d2\3"+ + "\2\2\2\u01d0\u01d1\3\2\2\2\u01d0\u01ce\3\2\2\2\u01d1\u01d3\3\2\2\2\u01d2"+ + "\u01d0\3\2\2\2\u01d3\u01d4\7,\2\2\u01d4\u01d5\7\61\2\2\u01d5\u01d6\3\2"+ + "\2\2\u01d6\u01d7\bE\2\2\u01d7\u008a\3\2\2\2\35\2\u0127\u012d\u012f\u0138"+ + "\u0145\u0149\u014e\u0155\u015a\u0161\u0166\u016d\u0174\u0179\u0180\u0185"+ + "\u018c\u0192\u0194\u0199\u01a0\u01a5\u01b1\u01bb\u01c5\u01d0\3\b\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens index 52e9cc928..cb7395c34 100644 --- a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens +++ b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens @@ -40,23 +40,27 @@ T__38=39 T__39=40 T__40=41 T__41=42 -SIMPLETYPE=43 -STRING=44 -CHAR=45 -BOOLEAN=46 -NUMBER=47 -NUMFLOAT=48 -BINFLOAT=49 -DECFLOAT=50 -HEXFLOAT=51 -NUMINT=52 -BININTEGER=53 -DECINTEGER=54 -HEXINTEGER=55 -NAME=56 -WS=57 -COMMENT_LINE=58 -COMMENT_BLOCK=59 +T__42=43 +T__43=44 +T__44=45 +T__45=46 +SIMPLETYPE=47 +STRING=48 +CHAR=49 +BOOLEAN=50 +NUMBER=51 +NUMFLOAT=52 +BINFLOAT=53 +DECFLOAT=54 +HEXFLOAT=55 +NUMINT=56 +BININTEGER=57 +DECINTEGER=58 +HEXINTEGER=59 +NAME=60 +WS=61 +COMMENT_LINE=62 +COMMENT_BLOCK=63 '{'=1 '}'=2 '('=3 @@ -83,19 +87,23 @@ COMMENT_BLOCK=59 'not'=24 '!'=25 '&'=26 -'>>'=27 -'<<'=28 -'/'=29 -'=='=30 -'!='=31 -'<>'=32 -'<'=33 -'<='=34 -'=<'=35 -'>='=36 -'=>'=37 -'>'=38 -'and'=39 -'&&'=40 -'or'=41 -'||'=42 +'~'=27 +'>>'=28 +'<<'=29 +'/'=30 +'%'=31 +'=='=32 +'!='=33 +'<>'=34 +'<'=35 +'<='=36 +'=<'=37 +'>='=38 +'=>'=39 +'>'=40 +'^'=41 +'|'=42 +'and'=43 +'&&'=44 +'or'=45 +'||'=46 diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCParser.java b/src/main/java/dk/camelot64/kickc/parser/KickCParser.java index 71f9af6d3..493af0a53 100644 --- a/src/main/java/dk/camelot64/kickc/parser/KickCParser.java +++ b/src/main/java/dk/camelot64/kickc/parser/KickCParser.java @@ -22,10 +22,10 @@ public class KickCParser extends Parser { T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38, - T__38=39, T__39=40, T__40=41, T__41=42, SIMPLETYPE=43, STRING=44, CHAR=45, - BOOLEAN=46, NUMBER=47, NUMFLOAT=48, BINFLOAT=49, DECFLOAT=50, HEXFLOAT=51, - NUMINT=52, BININTEGER=53, DECINTEGER=54, HEXINTEGER=55, NAME=56, WS=57, - COMMENT_LINE=58, COMMENT_BLOCK=59; + T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45, + T__45=46, SIMPLETYPE=47, STRING=48, CHAR=49, BOOLEAN=50, NUMBER=51, NUMFLOAT=52, + BINFLOAT=53, DECFLOAT=54, HEXFLOAT=55, NUMINT=56, BININTEGER=57, DECINTEGER=58, + HEXINTEGER=59, NAME=60, WS=61, COMMENT_LINE=62, COMMENT_BLOCK=63; public static final int RULE_file = 0, RULE_stmtSeq = 1, RULE_stmt = 2, RULE_forDeclaration = 3, RULE_forIteration = 4, RULE_parameterListDecl = 5, RULE_parameterDecl = 6, @@ -39,18 +39,18 @@ public class KickCParser extends Parser { private static final String[] _LITERAL_NAMES = { null, "'{'", "'}'", "'('", "')'", "'const'", "'='", "';'", "'if'", "'else'", "'while'", "'do'", "'for'", "'return'", "':'", "'..'", "','", "'*'", "'['", - "']'", "'--'", "'++'", "'+'", "'-'", "'not'", "'!'", "'&'", "'>>'", "'<<'", - "'/'", "'=='", "'!='", "'<>'", "'<'", "'<='", "'=<'", "'>='", "'=>'", - "'>'", "'and'", "'&&'", "'or'", "'||'" + "']'", "'--'", "'++'", "'+'", "'-'", "'not'", "'!'", "'&'", "'~'", "'>>'", + "'<<'", "'/'", "'%'", "'=='", "'!='", "'<>'", "'<'", "'<='", "'=<'", "'>='", + "'=>'", "'>'", "'^'", "'|'", "'and'", "'&&'", "'or'", "'||'" }; private static final String[] _SYMBOLIC_NAMES = { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, "SIMPLETYPE", "STRING", "CHAR", - "BOOLEAN", "NUMBER", "NUMFLOAT", "BINFLOAT", "DECFLOAT", "HEXFLOAT", "NUMINT", - "BININTEGER", "DECINTEGER", "HEXINTEGER", "NAME", "WS", "COMMENT_LINE", - "COMMENT_BLOCK" + null, null, null, null, null, null, null, null, null, null, null, "SIMPLETYPE", + "STRING", "CHAR", "BOOLEAN", "NUMBER", "NUMFLOAT", "BINFLOAT", "DECFLOAT", + "HEXFLOAT", "NUMINT", "BININTEGER", "DECINTEGER", "HEXINTEGER", "NAME", + "WS", "COMMENT_LINE", "COMMENT_BLOCK" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); @@ -194,7 +194,7 @@ public class KickCParser extends Parser { setState(30); _errHandler.sync(this); _la = _input.LA(1); - } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << T__4) | (1L << T__7) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0) ); + } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << T__4) | (1L << T__7) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0) ); } } catch (RecognitionException re) { @@ -459,7 +459,7 @@ public class KickCParser extends Parser { setState(34); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << T__4) | (1L << T__7) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << T__4) | (1L << T__7) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { { setState(33); stmtSeq(); @@ -497,7 +497,7 @@ public class KickCParser extends Parser { setState(46); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << T__4) | (1L << T__7) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << T__4) | (1L << T__7) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { { setState(45); stmtSeq(); @@ -663,7 +663,7 @@ public class KickCParser extends Parser { setState(102); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { { setState(101); expr(0); @@ -844,7 +844,7 @@ public class KickCParser extends Parser { setState(119); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { { setState(118); expr(0); @@ -1122,7 +1122,7 @@ public class KickCParser extends Parser { setState(147); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { { setState(146); expr(0); @@ -1223,6 +1223,7 @@ public class KickCParser extends Parser { case T__23: case T__24: case T__25: + case T__26: case STRING: case CHAR: case BOOLEAN: @@ -1766,7 +1767,7 @@ public class KickCParser extends Parser { setState(197); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__16) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) { { setState(196); parameterList(); @@ -1789,7 +1790,7 @@ public class KickCParser extends Parser { setState(202); match(T__3); setState(203); - expr(16); + expr(19); } break; case 4: @@ -1808,7 +1809,7 @@ public class KickCParser extends Parser { consume(); } setState(206); - expr(14); + expr(17); } break; case 5: @@ -1818,7 +1819,7 @@ public class KickCParser extends Parser { _prevctx = _localctx; setState(207); _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__16) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25))) != 0)) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__16) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26))) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -1827,7 +1828,7 @@ public class KickCParser extends Parser { consume(); } setState(208); - expr(12); + expr(15); } break; case 6: @@ -1877,7 +1878,7 @@ public class KickCParser extends Parser { break; } _ctx.stop = _input.LT(-1); - setState(243); + setState(252); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,25,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { @@ -1885,7 +1886,7 @@ public class KickCParser extends Parser { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(241); + setState(250); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,24,_ctx) ) { case 1: @@ -1893,10 +1894,10 @@ public class KickCParser extends Parser { _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); setState(216); - if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)"); + if (!(precpred(_ctx, 14))) throw new FailedPredicateException(this, "precpred(_ctx, 14)"); setState(217); _la = _input.LA(1); - if ( !(_la==T__26 || _la==T__27) ) { + if ( !(_la==T__27 || _la==T__28) ) { _errHandler.recoverInline(this); } else { @@ -1905,7 +1906,7 @@ public class KickCParser extends Parser { consume(); } setState(218); - expr(12); + expr(15); } break; case 2: @@ -1913,10 +1914,10 @@ public class KickCParser extends Parser { _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); setState(219); - if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)"); + if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)"); setState(220); _la = _input.LA(1); - if ( !(_la==T__16 || _la==T__28) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__16) | (1L << T__29) | (1L << T__30))) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -1925,7 +1926,7 @@ public class KickCParser extends Parser { consume(); } setState(221); - expr(11); + expr(14); } break; case 3: @@ -1933,7 +1934,7 @@ public class KickCParser extends Parser { _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); setState(222); - if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)"); + if (!(precpred(_ctx, 12))) throw new FailedPredicateException(this, "precpred(_ctx, 12)"); setState(223); _la = _input.LA(1); if ( !(_la==T__21 || _la==T__22) ) { @@ -1945,7 +1946,7 @@ public class KickCParser extends Parser { consume(); } setState(224); - expr(10); + expr(13); } break; case 4: @@ -1953,10 +1954,10 @@ public class KickCParser extends Parser { _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); setState(225); - if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); + if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)"); setState(226); _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__29) | (1L << T__30) | (1L << T__31) | (1L << T__32) | (1L << T__33) | (1L << T__34) | (1L << T__35) | (1L << T__36) | (1L << T__37))) != 0)) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__31) | (1L << T__32) | (1L << T__33) | (1L << T__34) | (1L << T__35) | (1L << T__36) | (1L << T__37) | (1L << T__38) | (1L << T__39))) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -1965,7 +1966,7 @@ public class KickCParser extends Parser { consume(); } setState(227); - expr(9); + expr(12); } break; case 5: @@ -1973,19 +1974,13 @@ public class KickCParser extends Parser { _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); setState(228); - if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); + if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)"); + { setState(229); - _la = _input.LA(1); - if ( !(_la==T__38 || _la==T__39) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); + match(T__25); } setState(230); - expr(8); + expr(11); } break; case 6: @@ -1993,10 +1988,38 @@ public class KickCParser extends Parser { _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); setState(231); - if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); + if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)"); + { setState(232); + match(T__40); + } + setState(233); + expr(10); + } + break; + case 7: + { + _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expr); + setState(234); + if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); + { + setState(235); + match(T__41); + } + setState(236); + expr(9); + } + break; + case 8: + { + _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expr); + setState(237); + if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); + setState(238); _la = _input.LA(1); - if ( !(_la==T__40 || _la==T__41) ) { + if ( !(_la==T__42 || _la==T__43) ) { _errHandler.recoverInline(this); } else { @@ -2004,31 +2027,51 @@ public class KickCParser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(233); + setState(239); + expr(8); + } + break; + case 9: + { + _localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expr); + setState(240); + if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); + setState(241); + _la = _input.LA(1); + if ( !(_la==T__44 || _la==T__45) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(242); expr(7); } break; - case 7: + case 10: { _localctx = new ExprArrayContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); - setState(234); - if (!(precpred(_ctx, 15))) throw new FailedPredicateException(this, "precpred(_ctx, 15)"); - setState(235); + setState(243); + if (!(precpred(_ctx, 18))) throw new FailedPredicateException(this, "precpred(_ctx, 18)"); + setState(244); match(T__17); - setState(236); + setState(245); expr(0); - setState(237); + setState(246); match(T__18); } break; - case 8: + case 11: { _localctx = new ExprPostModContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); - setState(239); - if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)"); - setState(240); + setState(248); + if (!(precpred(_ctx, 16))) throw new FailedPredicateException(this, "precpred(_ctx, 16)"); + setState(249); _la = _input.LA(1); if ( !(_la==T__19 || _la==T__20) ) { _errHandler.recoverInline(this); @@ -2043,7 +2086,7 @@ public class KickCParser extends Parser { } } } - setState(245); + setState(254); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,25,_ctx); } @@ -2093,21 +2136,21 @@ public class KickCParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(246); + setState(255); expr(0); - setState(251); + setState(260); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__15) { { { - setState(247); + setState(256); match(T__15); - setState(248); + setState(257); expr(0); } } - setState(253); + setState(262); _errHandler.sync(this); _la = _input.LA(1); } @@ -2154,27 +2197,33 @@ public class KickCParser extends Parser { private boolean expr_sempred(ExprContext _localctx, int predIndex) { switch (predIndex) { case 3: - return precpred(_ctx, 11); + return precpred(_ctx, 14); case 4: - return precpred(_ctx, 10); - case 5: - return precpred(_ctx, 9); - case 6: - return precpred(_ctx, 8); - case 7: - return precpred(_ctx, 7); - case 8: - return precpred(_ctx, 6); - case 9: - return precpred(_ctx, 15); - case 10: return precpred(_ctx, 13); + case 5: + return precpred(_ctx, 12); + case 6: + return precpred(_ctx, 11); + case 7: + return precpred(_ctx, 10); + case 8: + return precpred(_ctx, 9); + case 9: + return precpred(_ctx, 8); + case 10: + return precpred(_ctx, 7); + case 11: + return precpred(_ctx, 6); + case 12: + return precpred(_ctx, 18); + case 13: + return precpred(_ctx, 16); } return true; } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3=\u0101\4\2\t\2\4"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3A\u010a\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\3\2\3\2\3\2\3\3\6\3\37\n\3\r\3\16\3 \3\4\3\4\5\4%"+ "\n\4\3\4\3\4\3\4\3\4\3\4\5\4,\n\4\3\4\3\4\3\4\5\4\61\n\4\3\4\3\4\3\4\5"+ @@ -2190,78 +2239,82 @@ public class KickCParser extends Parser { "\u00bb\n\13\f\13\16\13\u00be\13\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f"+ "\u00c8\n\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f"+ "\5\f\u00d9\n\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f"+ - "\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\7\f\u00f4\n\f\f\f\16\f\u00f7"+ - "\13\f\3\r\3\r\3\r\7\r\u00fc\n\r\f\r\16\r\u00ff\13\r\3\r\2\5\20\24\26\16"+ - "\2\4\6\b\n\f\16\20\22\24\26\30\2\n\3\2\26\27\4\2\23\23\30\34\3\2\35\36"+ - "\4\2\23\23\37\37\3\2\30\31\3\2 (\3\2)*\3\2+,\2\u0126\2\32\3\2\2\2\4\36"+ - "\3\2\2\2\6k\3\2\2\2\bn\3\2\2\2\n\u0080\3\2\2\2\f\u0082\3\2\2\2\16\u008a"+ - "\3\2\2\2\20\u008d\3\2\2\2\22\u00a9\3\2\2\2\24\u00b3\3\2\2\2\26\u00d8\3"+ - "\2\2\2\30\u00f8\3\2\2\2\32\33\5\4\3\2\33\34\7\2\2\3\34\3\3\2\2\2\35\37"+ - "\5\6\4\2\36\35\3\2\2\2\37 \3\2\2\2 \36\3\2\2\2 !\3\2\2\2!\5\3\2\2\2\""+ - "$\7\3\2\2#%\5\4\3\2$#\3\2\2\2$%\3\2\2\2%&\3\2\2\2&l\7\4\2\2\'(\5\20\t"+ - "\2()\7:\2\2)+\7\5\2\2*,\5\f\7\2+*\3\2\2\2+,\3\2\2\2,-\3\2\2\2-.\7\6\2"+ - "\2.\60\7\3\2\2/\61\5\4\3\2\60/\3\2\2\2\60\61\3\2\2\2\61\62\3\2\2\2\62"+ - "\63\7\4\2\2\63l\3\2\2\2\64\66\7\7\2\2\65\64\3\2\2\2\65\66\3\2\2\2\66\67"+ - "\3\2\2\2\678\5\20\t\28;\7:\2\29:\7\b\2\2:<\5\22\n\2;9\3\2\2\2;<\3\2\2"+ - "\2<=\3\2\2\2=>\7\t\2\2>l\3\2\2\2?@\5\24\13\2@A\7\b\2\2AB\5\26\f\2BC\7"+ - "\t\2\2Cl\3\2\2\2DE\5\26\f\2EF\7\t\2\2Fl\3\2\2\2GH\7\n\2\2HI\7\5\2\2IJ"+ - "\5\26\f\2JK\7\6\2\2KN\5\6\4\2LM\7\13\2\2MO\5\6\4\2NL\3\2\2\2NO\3\2\2\2"+ - "Ol\3\2\2\2PQ\7\f\2\2QR\7\5\2\2RS\5\26\f\2ST\7\6\2\2TU\5\6\4\2Ul\3\2\2"+ - "\2VW\7\r\2\2WX\5\6\4\2XY\7\f\2\2YZ\7\5\2\2Z[\5\26\f\2[\\\7\6\2\2\\l\3"+ - "\2\2\2]^\7\16\2\2^`\7\5\2\2_a\5\b\5\2`_\3\2\2\2`a\3\2\2\2ab\3\2\2\2bc"+ - "\5\n\6\2cd\7\6\2\2de\5\6\4\2el\3\2\2\2fh\7\17\2\2gi\5\26\f\2hg\3\2\2\2"+ - "hi\3\2\2\2ij\3\2\2\2jl\7\t\2\2k\"\3\2\2\2k\'\3\2\2\2k\65\3\2\2\2k?\3\2"+ - "\2\2kD\3\2\2\2kG\3\2\2\2kP\3\2\2\2kV\3\2\2\2k]\3\2\2\2kf\3\2\2\2l\7\3"+ - "\2\2\2mo\5\20\t\2nm\3\2\2\2no\3\2\2\2op\3\2\2\2ps\7:\2\2qr\7\b\2\2rt\5"+ - "\22\n\2sq\3\2\2\2st\3\2\2\2t\t\3\2\2\2uv\7\t\2\2vw\5\26\f\2wy\7\t\2\2"+ - "xz\5\26\f\2yx\3\2\2\2yz\3\2\2\2z\u0081\3\2\2\2{|\7\20\2\2|}\5\26\f\2}"+ - "~\7\21\2\2~\177\5\26\f\2\177\u0081\3\2\2\2\u0080u\3\2\2\2\u0080{\3\2\2"+ - "\2\u0081\13\3\2\2\2\u0082\u0087\5\16\b\2\u0083\u0084\7\22\2\2\u0084\u0086"+ - "\5\16\b\2\u0085\u0083\3\2\2\2\u0086\u0089\3\2\2\2\u0087\u0085\3\2\2\2"+ - "\u0087\u0088\3\2\2\2\u0088\r\3\2\2\2\u0089\u0087\3\2\2\2\u008a\u008b\5"+ - "\20\t\2\u008b\u008c\7:\2\2\u008c\17\3\2\2\2\u008d\u008e\b\t\1\2\u008e"+ - "\u008f\7-\2\2\u008f\u009a\3\2\2\2\u0090\u0091\f\4\2\2\u0091\u0099\7\23"+ - "\2\2\u0092\u0093\f\3\2\2\u0093\u0095\7\24\2\2\u0094\u0096\5\26\f\2\u0095"+ - "\u0094\3\2\2\2\u0095\u0096\3\2\2\2\u0096\u0097\3\2\2\2\u0097\u0099\7\25"+ - "\2\2\u0098\u0090\3\2\2\2\u0098\u0092\3\2\2\2\u0099\u009c\3\2\2\2\u009a"+ - "\u0098\3\2\2\2\u009a\u009b\3\2\2\2\u009b\21\3\2\2\2\u009c\u009a\3\2\2"+ - "\2\u009d\u00aa\5\26\f\2\u009e\u009f\7\3\2\2\u009f\u00a4\5\22\n\2\u00a0"+ - "\u00a1\7\22\2\2\u00a1\u00a3\5\22\n\2\u00a2\u00a0\3\2\2\2\u00a3\u00a6\3"+ - "\2\2\2\u00a4\u00a2\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\u00a7\3\2\2\2\u00a6"+ - "\u00a4\3\2\2\2\u00a7\u00a8\7\4\2\2\u00a8\u00aa\3\2\2\2\u00a9\u009d\3\2"+ - "\2\2\u00a9\u009e\3\2\2\2\u00aa\23\3\2\2\2\u00ab\u00ac\b\13\1\2\u00ac\u00ad"+ - "\7\5\2\2\u00ad\u00ae\5\24\13\2\u00ae\u00af\7\6\2\2\u00af\u00b4\3\2\2\2"+ - "\u00b0\u00b4\7:\2\2\u00b1\u00b2\7\23\2\2\u00b2\u00b4\5\24\13\4\u00b3\u00ab"+ - "\3\2\2\2\u00b3\u00b0\3\2\2\2\u00b3\u00b1\3\2\2\2\u00b4\u00bc\3\2\2\2\u00b5"+ - "\u00b6\f\3\2\2\u00b6\u00b7\7\24\2\2\u00b7\u00b8\5\26\f\2\u00b8\u00b9\7"+ - "\25\2\2\u00b9\u00bb\3\2\2\2\u00ba\u00b5\3\2\2\2\u00bb\u00be\3\2\2\2\u00bc"+ - "\u00ba\3\2\2\2\u00bc\u00bd\3\2\2\2\u00bd\25\3\2\2\2\u00be\u00bc\3\2\2"+ - "\2\u00bf\u00c0\b\f\1\2\u00c0\u00c1\7\5\2\2\u00c1\u00c2\5\26\f\2\u00c2"+ - "\u00c3\7\6\2\2\u00c3\u00d9\3\2\2\2\u00c4\u00c5\7:\2\2\u00c5\u00c7\7\5"+ - "\2\2\u00c6\u00c8\5\30\r\2\u00c7\u00c6\3\2\2\2\u00c7\u00c8\3\2\2\2\u00c8"+ - "\u00c9\3\2\2\2\u00c9\u00d9\7\6\2\2\u00ca\u00cb\7\5\2\2\u00cb\u00cc\5\20"+ - "\t\2\u00cc\u00cd\7\6\2\2\u00cd\u00ce\5\26\f\22\u00ce\u00d9\3\2\2\2\u00cf"+ - "\u00d0\t\2\2\2\u00d0\u00d9\5\26\f\20\u00d1\u00d2\t\3\2\2\u00d2\u00d9\5"+ - "\26\f\16\u00d3\u00d9\7:\2\2\u00d4\u00d9\7\61\2\2\u00d5\u00d9\7.\2\2\u00d6"+ - "\u00d9\7/\2\2\u00d7\u00d9\7\60\2\2\u00d8\u00bf\3\2\2\2\u00d8\u00c4\3\2"+ - "\2\2\u00d8\u00ca\3\2\2\2\u00d8\u00cf\3\2\2\2\u00d8\u00d1\3\2\2\2\u00d8"+ - "\u00d3\3\2\2\2\u00d8\u00d4\3\2\2\2\u00d8\u00d5\3\2\2\2\u00d8\u00d6\3\2"+ - "\2\2\u00d8\u00d7\3\2\2\2\u00d9\u00f5\3\2\2\2\u00da\u00db\f\r\2\2\u00db"+ - "\u00dc\t\4\2\2\u00dc\u00f4\5\26\f\16\u00dd\u00de\f\f\2\2\u00de\u00df\t"+ - "\5\2\2\u00df\u00f4\5\26\f\r\u00e0\u00e1\f\13\2\2\u00e1\u00e2\t\6\2\2\u00e2"+ - "\u00f4\5\26\f\f\u00e3\u00e4\f\n\2\2\u00e4\u00e5\t\7\2\2\u00e5\u00f4\5"+ - "\26\f\13\u00e6\u00e7\f\t\2\2\u00e7\u00e8\t\b\2\2\u00e8\u00f4\5\26\f\n"+ - "\u00e9\u00ea\f\b\2\2\u00ea\u00eb\t\t\2\2\u00eb\u00f4\5\26\f\t\u00ec\u00ed"+ - "\f\21\2\2\u00ed\u00ee\7\24\2\2\u00ee\u00ef\5\26\f\2\u00ef\u00f0\7\25\2"+ - "\2\u00f0\u00f4\3\2\2\2\u00f1\u00f2\f\17\2\2\u00f2\u00f4\t\2\2\2\u00f3"+ - "\u00da\3\2\2\2\u00f3\u00dd\3\2\2\2\u00f3\u00e0\3\2\2\2\u00f3\u00e3\3\2"+ - "\2\2\u00f3\u00e6\3\2\2\2\u00f3\u00e9\3\2\2\2\u00f3\u00ec\3\2\2\2\u00f3"+ - "\u00f1\3\2\2\2\u00f4\u00f7\3\2\2\2\u00f5\u00f3\3\2\2\2\u00f5\u00f6\3\2"+ - "\2\2\u00f6\27\3\2\2\2\u00f7\u00f5\3\2\2\2\u00f8\u00fd\5\26\f\2\u00f9\u00fa"+ - "\7\22\2\2\u00fa\u00fc\5\26\f\2\u00fb\u00f9\3\2\2\2\u00fc\u00ff\3\2\2\2"+ - "\u00fd\u00fb\3\2\2\2\u00fd\u00fe\3\2\2\2\u00fe\31\3\2\2\2\u00ff\u00fd"+ - "\3\2\2\2\35 $+\60\65;N`hknsy\u0080\u0087\u0095\u0098\u009a\u00a4\u00a9"+ - "\u00b3\u00bc\u00c7\u00d8\u00f3\u00f5\u00fd"; + "\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3"+ + "\f\3\f\3\f\7\f\u00fd\n\f\f\f\16\f\u0100\13\f\3\r\3\r\3\r\7\r\u0105\n\r"+ + "\f\r\16\r\u0108\13\r\3\r\2\5\20\24\26\16\2\4\6\b\n\f\16\20\22\24\26\30"+ + "\2\n\3\2\26\27\4\2\23\23\30\35\3\2\36\37\4\2\23\23 !\3\2\30\31\3\2\"*"+ + "\3\2-.\3\2/\60\2\u0132\2\32\3\2\2\2\4\36\3\2\2\2\6k\3\2\2\2\bn\3\2\2\2"+ + "\n\u0080\3\2\2\2\f\u0082\3\2\2\2\16\u008a\3\2\2\2\20\u008d\3\2\2\2\22"+ + "\u00a9\3\2\2\2\24\u00b3\3\2\2\2\26\u00d8\3\2\2\2\30\u0101\3\2\2\2\32\33"+ + "\5\4\3\2\33\34\7\2\2\3\34\3\3\2\2\2\35\37\5\6\4\2\36\35\3\2\2\2\37 \3"+ + "\2\2\2 \36\3\2\2\2 !\3\2\2\2!\5\3\2\2\2\"$\7\3\2\2#%\5\4\3\2$#\3\2\2\2"+ + "$%\3\2\2\2%&\3\2\2\2&l\7\4\2\2\'(\5\20\t\2()\7>\2\2)+\7\5\2\2*,\5\f\7"+ + "\2+*\3\2\2\2+,\3\2\2\2,-\3\2\2\2-.\7\6\2\2.\60\7\3\2\2/\61\5\4\3\2\60"+ + "/\3\2\2\2\60\61\3\2\2\2\61\62\3\2\2\2\62\63\7\4\2\2\63l\3\2\2\2\64\66"+ + "\7\7\2\2\65\64\3\2\2\2\65\66\3\2\2\2\66\67\3\2\2\2\678\5\20\t\28;\7>\2"+ + "\29:\7\b\2\2:<\5\22\n\2;9\3\2\2\2;<\3\2\2\2<=\3\2\2\2=>\7\t\2\2>l\3\2"+ + "\2\2?@\5\24\13\2@A\7\b\2\2AB\5\26\f\2BC\7\t\2\2Cl\3\2\2\2DE\5\26\f\2E"+ + "F\7\t\2\2Fl\3\2\2\2GH\7\n\2\2HI\7\5\2\2IJ\5\26\f\2JK\7\6\2\2KN\5\6\4\2"+ + "LM\7\13\2\2MO\5\6\4\2NL\3\2\2\2NO\3\2\2\2Ol\3\2\2\2PQ\7\f\2\2QR\7\5\2"+ + "\2RS\5\26\f\2ST\7\6\2\2TU\5\6\4\2Ul\3\2\2\2VW\7\r\2\2WX\5\6\4\2XY\7\f"+ + "\2\2YZ\7\5\2\2Z[\5\26\f\2[\\\7\6\2\2\\l\3\2\2\2]^\7\16\2\2^`\7\5\2\2_"+ + "a\5\b\5\2`_\3\2\2\2`a\3\2\2\2ab\3\2\2\2bc\5\n\6\2cd\7\6\2\2de\5\6\4\2"+ + "el\3\2\2\2fh\7\17\2\2gi\5\26\f\2hg\3\2\2\2hi\3\2\2\2ij\3\2\2\2jl\7\t\2"+ + "\2k\"\3\2\2\2k\'\3\2\2\2k\65\3\2\2\2k?\3\2\2\2kD\3\2\2\2kG\3\2\2\2kP\3"+ + "\2\2\2kV\3\2\2\2k]\3\2\2\2kf\3\2\2\2l\7\3\2\2\2mo\5\20\t\2nm\3\2\2\2n"+ + "o\3\2\2\2op\3\2\2\2ps\7>\2\2qr\7\b\2\2rt\5\22\n\2sq\3\2\2\2st\3\2\2\2"+ + "t\t\3\2\2\2uv\7\t\2\2vw\5\26\f\2wy\7\t\2\2xz\5\26\f\2yx\3\2\2\2yz\3\2"+ + "\2\2z\u0081\3\2\2\2{|\7\20\2\2|}\5\26\f\2}~\7\21\2\2~\177\5\26\f\2\177"+ + "\u0081\3\2\2\2\u0080u\3\2\2\2\u0080{\3\2\2\2\u0081\13\3\2\2\2\u0082\u0087"+ + "\5\16\b\2\u0083\u0084\7\22\2\2\u0084\u0086\5\16\b\2\u0085\u0083\3\2\2"+ + "\2\u0086\u0089\3\2\2\2\u0087\u0085\3\2\2\2\u0087\u0088\3\2\2\2\u0088\r"+ + "\3\2\2\2\u0089\u0087\3\2\2\2\u008a\u008b\5\20\t\2\u008b\u008c\7>\2\2\u008c"+ + "\17\3\2\2\2\u008d\u008e\b\t\1\2\u008e\u008f\7\61\2\2\u008f\u009a\3\2\2"+ + "\2\u0090\u0091\f\4\2\2\u0091\u0099\7\23\2\2\u0092\u0093\f\3\2\2\u0093"+ + "\u0095\7\24\2\2\u0094\u0096\5\26\f\2\u0095\u0094\3\2\2\2\u0095\u0096\3"+ + "\2\2\2\u0096\u0097\3\2\2\2\u0097\u0099\7\25\2\2\u0098\u0090\3\2\2\2\u0098"+ + "\u0092\3\2\2\2\u0099\u009c\3\2\2\2\u009a\u0098\3\2\2\2\u009a\u009b\3\2"+ + "\2\2\u009b\21\3\2\2\2\u009c\u009a\3\2\2\2\u009d\u00aa\5\26\f\2\u009e\u009f"+ + "\7\3\2\2\u009f\u00a4\5\22\n\2\u00a0\u00a1\7\22\2\2\u00a1\u00a3\5\22\n"+ + "\2\u00a2\u00a0\3\2\2\2\u00a3\u00a6\3\2\2\2\u00a4\u00a2\3\2\2\2\u00a4\u00a5"+ + "\3\2\2\2\u00a5\u00a7\3\2\2\2\u00a6\u00a4\3\2\2\2\u00a7\u00a8\7\4\2\2\u00a8"+ + "\u00aa\3\2\2\2\u00a9\u009d\3\2\2\2\u00a9\u009e\3\2\2\2\u00aa\23\3\2\2"+ + "\2\u00ab\u00ac\b\13\1\2\u00ac\u00ad\7\5\2\2\u00ad\u00ae\5\24\13\2\u00ae"+ + "\u00af\7\6\2\2\u00af\u00b4\3\2\2\2\u00b0\u00b4\7>\2\2\u00b1\u00b2\7\23"+ + "\2\2\u00b2\u00b4\5\24\13\4\u00b3\u00ab\3\2\2\2\u00b3\u00b0\3\2\2\2\u00b3"+ + "\u00b1\3\2\2\2\u00b4\u00bc\3\2\2\2\u00b5\u00b6\f\3\2\2\u00b6\u00b7\7\24"+ + "\2\2\u00b7\u00b8\5\26\f\2\u00b8\u00b9\7\25\2\2\u00b9\u00bb\3\2\2\2\u00ba"+ + "\u00b5\3\2\2\2\u00bb\u00be\3\2\2\2\u00bc\u00ba\3\2\2\2\u00bc\u00bd\3\2"+ + "\2\2\u00bd\25\3\2\2\2\u00be\u00bc\3\2\2\2\u00bf\u00c0\b\f\1\2\u00c0\u00c1"+ + "\7\5\2\2\u00c1\u00c2\5\26\f\2\u00c2\u00c3\7\6\2\2\u00c3\u00d9\3\2\2\2"+ + "\u00c4\u00c5\7>\2\2\u00c5\u00c7\7\5\2\2\u00c6\u00c8\5\30\r\2\u00c7\u00c6"+ + "\3\2\2\2\u00c7\u00c8\3\2\2\2\u00c8\u00c9\3\2\2\2\u00c9\u00d9\7\6\2\2\u00ca"+ + "\u00cb\7\5\2\2\u00cb\u00cc\5\20\t\2\u00cc\u00cd\7\6\2\2\u00cd\u00ce\5"+ + "\26\f\25\u00ce\u00d9\3\2\2\2\u00cf\u00d0\t\2\2\2\u00d0\u00d9\5\26\f\23"+ + "\u00d1\u00d2\t\3\2\2\u00d2\u00d9\5\26\f\21\u00d3\u00d9\7>\2\2\u00d4\u00d9"+ + "\7\65\2\2\u00d5\u00d9\7\62\2\2\u00d6\u00d9\7\63\2\2\u00d7\u00d9\7\64\2"+ + "\2\u00d8\u00bf\3\2\2\2\u00d8\u00c4\3\2\2\2\u00d8\u00ca\3\2\2\2\u00d8\u00cf"+ + "\3\2\2\2\u00d8\u00d1\3\2\2\2\u00d8\u00d3\3\2\2\2\u00d8\u00d4\3\2\2\2\u00d8"+ + "\u00d5\3\2\2\2\u00d8\u00d6\3\2\2\2\u00d8\u00d7\3\2\2\2\u00d9\u00fe\3\2"+ + "\2\2\u00da\u00db\f\20\2\2\u00db\u00dc\t\4\2\2\u00dc\u00fd\5\26\f\21\u00dd"+ + "\u00de\f\17\2\2\u00de\u00df\t\5\2\2\u00df\u00fd\5\26\f\20\u00e0\u00e1"+ + "\f\16\2\2\u00e1\u00e2\t\6\2\2\u00e2\u00fd\5\26\f\17\u00e3\u00e4\f\r\2"+ + "\2\u00e4\u00e5\t\7\2\2\u00e5\u00fd\5\26\f\16\u00e6\u00e7\f\f\2\2\u00e7"+ + "\u00e8\7\34\2\2\u00e8\u00fd\5\26\f\r\u00e9\u00ea\f\13\2\2\u00ea\u00eb"+ + "\7+\2\2\u00eb\u00fd\5\26\f\f\u00ec\u00ed\f\n\2\2\u00ed\u00ee\7,\2\2\u00ee"+ + "\u00fd\5\26\f\13\u00ef\u00f0\f\t\2\2\u00f0\u00f1\t\b\2\2\u00f1\u00fd\5"+ + "\26\f\n\u00f2\u00f3\f\b\2\2\u00f3\u00f4\t\t\2\2\u00f4\u00fd\5\26\f\t\u00f5"+ + "\u00f6\f\24\2\2\u00f6\u00f7\7\24\2\2\u00f7\u00f8\5\26\f\2\u00f8\u00f9"+ + "\7\25\2\2\u00f9\u00fd\3\2\2\2\u00fa\u00fb\f\22\2\2\u00fb\u00fd\t\2\2\2"+ + "\u00fc\u00da\3\2\2\2\u00fc\u00dd\3\2\2\2\u00fc\u00e0\3\2\2\2\u00fc\u00e3"+ + "\3\2\2\2\u00fc\u00e6\3\2\2\2\u00fc\u00e9\3\2\2\2\u00fc\u00ec\3\2\2\2\u00fc"+ + "\u00ef\3\2\2\2\u00fc\u00f2\3\2\2\2\u00fc\u00f5\3\2\2\2\u00fc\u00fa\3\2"+ + "\2\2\u00fd\u0100\3\2\2\2\u00fe\u00fc\3\2\2\2\u00fe\u00ff\3\2\2\2\u00ff"+ + "\27\3\2\2\2\u0100\u00fe\3\2\2\2\u0101\u0106\5\26\f\2\u0102\u0103\7\22"+ + "\2\2\u0103\u0105\5\26\f\2\u0104\u0102\3\2\2\2\u0105\u0108\3\2\2\2\u0106"+ + "\u0104\3\2\2\2\u0106\u0107\3\2\2\2\u0107\31\3\2\2\2\u0108\u0106\3\2\2"+ + "\2\35 $+\60\65;N`hknsy\u0080\u0087\u0095\u0098\u009a\u00a4\u00a9\u00b3"+ + "\u00bc\u00c7\u00d8\u00fc\u00fe\u0106"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java b/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java index c82f60b5c..64cd732ef 100644 --- a/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java +++ b/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java @@ -24,6 +24,10 @@ public class TestCompilationOutput extends TestCase { helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/"); } + public void testHalfscii() throws IOException, URISyntaxException { + compileAndCompare("halfscii"); + } + public void testLiterals() throws IOException, URISyntaxException { compileAndCompare("literals"); } diff --git a/src/main/java/dk/camelot64/kickc/test/halfscii.kc b/src/main/java/dk/camelot64/kickc/test/halfscii.kc new file mode 100644 index 000000000..461f6c762 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/halfscii.kc @@ -0,0 +1,27 @@ +byte* SCREEN = $0400; +byte* CHARSET = $2000; +byte* CHARGEN = $D000; +byte* PROCPORT = $01; +byte* D018 = $d018; +byte* CHARSET4 = $2800; + +main(); +void main() { + *PROCPORT = $32; + byte* chargen = CHARGEN; + byte* charset4 = CHARSET4; + byte* chargen1 = chargen+1; + byte bits = (*chargen & %11000000) >>2 | (*chargen1 & %11000000); + + *SCREEN = bits; + + *PROCPORT = $37; + + //*D018 = $18; + //for(byte i : 0..255) { + // SCREEN[i] = i; + //} + +} + + diff --git a/src/main/java/dk/camelot64/kickc/test/literals.kc b/src/main/java/dk/camelot64/kickc/test/literals.kc index 1a77a53b9..b755b18b4 100644 --- a/src/main/java/dk/camelot64/kickc/test/literals.kc +++ b/src/main/java/dk/camelot64/kickc/test/literals.kc @@ -2,15 +2,15 @@ byte* SCREEN = $0400; byte char = 'a'; byte num = 1; -byte[] str = "bcd"; -byte[] nums = { 2, 3, 4}; +byte[] str = "bc"+"d"+'e'; +byte[] nums = { 2, 3, 4, 5}; main(); void main() { SCREEN[0] = char; SCREEN[2] = num; - for(byte i : 0..2) { + for(byte i : 0..3) { SCREEN[4+i] = str[i]; - SCREEN[8+i] = nums[i]; + SCREEN[9+i] = nums[i]; } } \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log index a9c767337..c7793565f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log @@ -709,44 +709,6 @@ Uplift Scope [] Uplifting [main] best 362 combination reg byte x [ main::i#2 main::i#1 ] reg byte alu [ main::$3 ] reg byte a [ main::$4 ] reg byte a [ main::$1 ] Uplifting [] best 362 combination -MISSING FRAGMENTS - zpby1=zpby2_plus_cowo1_staridx_zpby3 - zpby1=zpby2_plus_cowo1_staridx_aby - zpby1=zpby2_plus_cowo1_staridx_xby - zpby1=zpby2_plus_cowo1_staridx_yby - aby=zpby1_plus_cowo1_staridx_zpby2 - aby=zpby1_plus_cowo1_staridx_xby - aby=zpby1_plus_cowo1_staridx_yby - xby=zpby1_plus_cowo1_staridx_zpby2 - xby=zpby1_plus_cowo1_staridx_aby - xby=zpby1_plus_cowo1_staridx_yby - yby=zpby1_plus_cowo1_staridx_zpby2 - yby=zpby1_plus_cowo1_staridx_aby - yby=zpby1_plus_cowo1_staridx_xby - zpby1=aby_plus_cowo1_staridx_zpby2 - aby=aby_plus_cowo1_staridx_zpby1 - xby=aby_plus_cowo1_staridx_zpby1 - yby=aby_plus_cowo1_staridx_zpby1 - zpby1=xby_plus_cowo1_staridx_zpby2 - zpby1=xby_plus_cowo1_staridx_aby - zpby1=xby_plus_cowo1_staridx_yby - aby=xby_plus_cowo1_staridx_zpby1 - aby=xby_plus_cowo1_staridx_yby - xby=xby_plus_cowo1_staridx_zpby1 - xby=xby_plus_cowo1_staridx_aby - xby=xby_plus_cowo1_staridx_yby - yby=xby_plus_cowo1_staridx_zpby1 - yby=xby_plus_cowo1_staridx_aby - zpby1=yby_plus_cowo1_staridx_zpby2 - zpby1=yby_plus_cowo1_staridx_aby - zpby1=yby_plus_cowo1_staridx_xby - aby=yby_plus_cowo1_staridx_zpby1 - aby=yby_plus_cowo1_staridx_xby - xby=yby_plus_cowo1_staridx_zpby1 - xby=yby_plus_cowo1_staridx_aby - yby=yby_plus_cowo1_staridx_zpby1 - yby=yby_plus_cowo1_staridx_aby - yby=yby_plus_cowo1_staridx_xby Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn diff --git a/src/main/java/dk/camelot64/kickc/test/ref/literals.asm b/src/main/java/dk/camelot64/kickc/test/ref/literals.asm index 4909d8316..0301ff0eb 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/literals.asm +++ b/src/main/java/dk/camelot64/kickc/test/ref/literals.asm @@ -1,8 +1,8 @@ .const SCREEN = $400 .const char = 'a' .const num = 1 - str: .text "bcd" - nums: .byte 2, 3, 4 + .const str = "bc"+"d"+'e' + nums: .byte 2, 3, 4, 5 jsr main main: { lda #char @@ -14,9 +14,9 @@ main: { lda str,x sta SCREEN+4,x lda nums,x - sta SCREEN+8,x + sta SCREEN+9,x inx - cpx #3 + cpx #4 bne b1 rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/literals.cfg b/src/main/java/dk/camelot64/kickc/test/ref/literals.cfg index a7734ebc5..c8f62629b 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/literals.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/literals.cfg @@ -11,9 +11,9 @@ main::@1: scope:[main] from main main::@1 [4] (byte~) main::$1 ← (const byte[]) str#0 *idx (byte) main::i#2 [ main::i#2 main::$1 ] [5] *((const byte*) SCREEN#0+(byte) 4 + (byte) main::i#2) ← (byte~) main::$1 [ main::i#2 ] [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] - [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] + [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] + [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 [10] return [ ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/literals.log b/src/main/java/dk/camelot64/kickc/test/ref/literals.log index 8155864d8..1da0b0ef2 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/literals.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/literals.log @@ -2,25 +2,27 @@ byte* SCREEN = $0400; byte char = 'a'; byte num = 1; -byte[] str = "bcd"; -byte[] nums = { 2, 3, 4}; +byte[] str = "bc"+"d"+'e'; +byte[] nums = { 2, 3, 4, 5}; main(); void main() { SCREEN[0] = char; SCREEN[2] = num; - for(byte i : 0..2) { + for(byte i : 0..3) { SCREEN[4+i] = str[i]; - SCREEN[8+i] = nums[i]; + SCREEN[9+i] = nums[i]; } } PROGRAM (byte*) SCREEN ← (word) 1024 (byte) char ← (byte) 'a' (byte) num ← (byte) 1 - (byte[]) str ← (string) "bcd" - (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4 } - (void~) $0 ← call main + (string~) $0 ← (string) "bc" + (string) "d" + (string~) $1 ← (string~) $0 + (byte) 'e' + (byte[]) str ← (string~) $1 + (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } + (void~) $2 ← call main proc (void()) main() *((byte*) SCREEN + (byte) 0) ← (byte) char *((byte*) SCREEN + (byte) 2) ← (byte) num @@ -29,18 +31,20 @@ main::@1: (byte~) main::$0 ← (byte) 4 + (byte) main::i (byte~) main::$1 ← (byte[]) str *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i + (byte~) main::$2 ← (byte) 9 + (byte) main::i (byte~) main::$3 ← (byte[]) nums *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i ← ++ (byte) main::i - (boolean~) main::$4 ← (byte) main::i != (byte) 3 + (boolean~) main::$4 ← (byte) main::i != (byte) 4 if((boolean~) main::$4) goto main::@1 main::@return: return endproc // main() SYMBOLS -(void~) $0 +(string~) $0 +(string~) $1 +(void~) $2 (byte*) SCREEN (byte) char (void()) main() @@ -61,9 +65,11 @@ INITIAL CONTROL FLOW GRAPH (byte*) SCREEN ← (word) 1024 (byte) char ← (byte) 'a' (byte) num ← (byte) 1 - (byte[]) str ← (string) "bcd" - (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4 } - (void~) $0 ← call main + (string~) $0 ← (string) "bc" + (string) "d" + (string~) $1 ← (string~) $0 + (byte) 'e' + (byte[]) str ← (string~) $1 + (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } + (void~) $2 ← call main to:@1 main: scope:[main] from *((byte*) SCREEN + (byte) 0) ← (byte) char @@ -74,11 +80,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i (byte~) main::$1 ← (byte[]) str *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i + (byte~) main::$2 ← (byte) 9 + (byte) main::i (byte~) main::$3 ← (byte[]) nums *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i ← ++ (byte) main::i - (boolean~) main::$4 ← (byte) main::i != (byte) 3 + (boolean~) main::$4 ← (byte) main::i != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@2 main::@2: scope:[main] from main::@1 @@ -97,9 +103,11 @@ CONTROL FLOW GRAPH (byte*) SCREEN ← (word) 1024 (byte) char ← (byte) 'a' (byte) num ← (byte) 1 - (byte[]) str ← (string) "bcd" - (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4 } - (void~) $0 ← call main + (string~) $0 ← (string) "bc" + (string) "d" + (string~) $1 ← (string~) $0 + (byte) 'e' + (byte[]) str ← (string~) $1 + (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } + (void~) $2 ← call main to:@end main: scope:[main] from *((byte*) SCREEN + (byte) 0) ← (byte) char @@ -110,11 +118,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i (byte~) main::$1 ← (byte[]) str *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i + (byte~) main::$2 ← (byte) 9 + (byte) main::i (byte~) main::$3 ← (byte[]) nums *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i ← ++ (byte) main::i - (boolean~) main::$4 ← (byte) main::i != (byte) 3 + (boolean~) main::$4 ← (byte) main::i != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 @@ -129,8 +137,10 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL (byte*) SCREEN ← (word) 1024 (byte) char ← (byte) 'a' (byte) num ← (byte) 1 - (byte[]) str ← (string) "bcd" - (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4 } + (string~) $0 ← (string) "bc" + (string) "d" + (string~) $1 ← (string~) $0 + (byte) 'e' + (byte[]) str ← (string~) $1 + (byte[]) nums ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } call main param-assignment to:@2 @2: scope:[] from @begin @@ -144,11 +154,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i (byte~) main::$1 ← (byte[]) str *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i + (byte~) main::$2 ← (byte) 9 + (byte) main::i (byte~) main::$3 ← (byte[]) nums *idx (byte) main::i *((byte*) SCREEN + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i ← ++ (byte) main::i - (boolean~) main::$4 ← (byte) main::i != (byte) 3 + (boolean~) main::$4 ← (byte) main::i != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 @@ -163,8 +173,10 @@ CONTROL FLOW GRAPH SSA (byte*) SCREEN#0 ← (word) 1024 (byte) char#0 ← (byte) 'a' (byte) num#0 ← (byte) 1 - (byte[]) str#0 ← (string) "bcd" - (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4 } + (string~) $0 ← (string) "bc" + (string) "d" + (string~) $1 ← (string~) $0 + (byte) 'e' + (byte[]) str#0 ← (string~) $1 + (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } call main param-assignment to:@2 @2: scope:[] from @begin @@ -187,11 +199,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - (boolean~) main::$4 ← (byte) main::i#1 != (byte) 3 + (boolean~) main::$4 ← (byte) main::i#1 != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 @@ -204,8 +216,10 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN (byte*) SCREEN#0 ← (word) 1024 (byte) char#0 ← (byte) 'a' (byte) num#0 ← (byte) 1 - (byte[]) str#0 ← (string) "bcd" - (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4 } + (string~) $0 ← (string) "bc" + (string) "d" + (string~) $1 ← (string~) $0 + (byte) 'e' + (byte[]) str#0 ← (string~) $1 + (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } call main param-assignment to:@2 @2: scope:[] from @begin @@ -228,11 +242,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - (boolean~) main::$4 ← (byte) main::i#1 != (byte) 3 + (boolean~) main::$4 ← (byte) main::i#1 != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 @@ -241,6 +255,8 @@ main::@return: scope:[main] from main::@1 @end: scope:[] from @2 INITIAL SSA SYMBOL TABLE +(string~) $0 +(string~) $1 (label) @2 (label) @begin (label) @end @@ -282,8 +298,10 @@ CONTROL FLOW GRAPH (byte*) SCREEN#0 ← (word) 1024 (byte) char#0 ← (byte) 'a' (byte) num#0 ← (byte) 1 - (byte[]) str#0 ← (string) "bcd" - (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4 } + (string~) $0 ← (string) "bc" + (string) "d" + (string~) $1 ← (string~) $0 + (byte) 'e' + (byte[]) str#0 ← (string~) $1 + (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } call main param-assignment to:@end main: scope:[main] from @begin @@ -304,11 +322,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - (boolean~) main::$4 ← (byte) main::i#1 != (byte) 3 + (boolean~) main::$4 ← (byte) main::i#1 != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 @@ -316,10 +334,10 @@ main::@return: scope:[main] from main::@1 to:@return @end: scope:[] from @begin +Alias (byte[]) str#0 = (string~) $1 (byte[]) str#2 Alias (byte) char#0 = (byte) char#1 Alias (byte*) SCREEN#0 = (byte*) SCREEN#1 Alias (byte) num#0 = (byte) num#1 -Alias (byte[]) str#0 = (byte[]) str#2 Alias (byte[]) nums#0 = (byte[]) nums#2 Succesful SSA optimization Pass2AliasElimination CONTROL FLOW GRAPH @@ -327,8 +345,9 @@ CONTROL FLOW GRAPH (byte*) SCREEN#0 ← (word) 1024 (byte) char#0 ← (byte) 'a' (byte) num#0 ← (byte) 1 - (byte[]) str#0 ← (string) "bcd" - (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4 } + (string~) $0 ← (string) "bc" + (string) "d" + (byte[]) str#0 ← (string~) $0 + (byte) 'e' + (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } call main param-assignment to:@end main: scope:[main] from @begin @@ -344,11 +363,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - (boolean~) main::$4 ← (byte) main::i#1 != (byte) 3 + (boolean~) main::$4 ← (byte) main::i#1 != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 @@ -365,8 +384,9 @@ CONTROL FLOW GRAPH (byte*) SCREEN#0 ← (word) 1024 (byte) char#0 ← (byte) 'a' (byte) num#0 ← (byte) 1 - (byte[]) str#0 ← (string) "bcd" - (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4 } + (string~) $0 ← (string) "bc" + (string) "d" + (byte[]) str#0 ← (string~) $0 + (byte) 'e' + (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } call main param-assignment to:@end main: scope:[main] from @begin @@ -382,11 +402,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - (boolean~) main::$4 ← (byte) main::i#1 != (byte) 3 + (boolean~) main::$4 ← (byte) main::i#1 != (byte) 4 if((boolean~) main::$4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 @@ -394,15 +414,16 @@ main::@return: scope:[main] from main::@1 to:@return @end: scope:[] from @begin -Simple Condition (boolean~) main::$4 if((byte) main::i#1!=(byte) 3) goto main::@1 +Simple Condition (boolean~) main::$4 if((byte) main::i#1!=(byte) 4) goto main::@1 Succesful SSA optimization Pass2ConditionalJumpSimplification CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN#0 ← (word) 1024 (byte) char#0 ← (byte) 'a' (byte) num#0 ← (byte) 1 - (byte[]) str#0 ← (string) "bcd" - (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4 } + (string~) $0 ← (string) "bc" + (string) "d" + (byte[]) str#0 ← (string~) $0 + (byte) 'e' + (byte[]) nums#0 ← { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } call main param-assignment to:@end main: scope:[main] from @begin @@ -418,11 +439,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - if((byte) main::i#1!=(byte) 3) goto main::@1 + if((byte) main::i#1!=(byte) 4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 return @@ -432,11 +453,43 @@ main::@return: scope:[main] from main::@1 Constant (const byte*) SCREEN#0 = 1024 Constant (const byte) char#0 = 'a' Constant (const byte) num#0 = 1 -Constant (const byte[]) str#0 = "bcd" -Constant (const byte[]) nums#0 = { 2, 3, 4 } +Constant (const string) $0 = "bc"+"d" +Constant (const byte[]) nums#0 = { 2, 3, 4, 5 } Constant (const byte) main::i#0 = 0 Succesful SSA optimization Pass2ConstantIdentification CONTROL FLOW GRAPH +@begin: scope:[] from + (byte[]) str#0 ← (const string) $0 + (byte) 'e' + call main param-assignment + to:@end +main: scope:[main] from @begin + *((const byte*) SCREEN#0 + (byte) 0) ← (const byte) char#0 + *((const byte*) SCREEN#0 + (byte) 2) ← (const byte) num#0 + to:main::@1 +main::@1: scope:[main] from main main::@1 + (byte[]) nums#1 ← phi( main/(const byte[]) nums#0 ) + (byte*) SCREEN#2 ← phi( main/(const byte*) SCREEN#0 ) + (byte[]) str#1 ← phi( main/(byte[]) str#0 ) + (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@1/(byte) main::i#1 ) + (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 + (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 + *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 + (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 + *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 + (byte) main::i#1 ← ++ (byte) main::i#2 + if((byte) main::i#1!=(byte) 4) goto main::@1 + to:main::@return +main::@return: scope:[main] from main::@1 + return + to:@return +@end: scope:[] from @begin + +Constant (const byte[]) str#0 = $0+'e' +Constant (const byte*) SCREEN#2 = SCREEN#0 +Constant (const byte[]) nums#1 = nums#0 +Succesful SSA optimization Pass2ConstantIdentification +CONTROL FLOW GRAPH @begin: scope:[] from call main param-assignment to:@end @@ -445,18 +498,16 @@ main: scope:[main] from @begin *((const byte*) SCREEN#0 + (byte) 2) ← (const byte) num#0 to:main::@1 main::@1: scope:[main] from main main::@1 - (byte[]) nums#1 ← phi( main/(const byte[]) nums#0 ) - (byte*) SCREEN#2 ← phi( main/(const byte*) SCREEN#0 ) (byte[]) str#1 ← phi( main/(const byte[]) str#0 ) (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@1/(byte) main::i#1 ) (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (byte[]) str#1 *idx (byte) main::i#2 - *((byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 - (byte~) main::$3 ← (byte[]) nums#1 *idx (byte) main::i#2 - *((byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 + *((const byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 + (byte~) main::$3 ← (const byte[]) nums#1 *idx (byte) main::i#2 + *((const byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - if((byte) main::i#1!=(byte) 3) goto main::@1 + if((byte) main::i#1!=(byte) 4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 return @@ -464,8 +515,6 @@ main::@return: scope:[main] from main::@1 @end: scope:[] from @begin Constant (const byte[]) str#1 = str#0 -Constant (const byte*) SCREEN#2 = SCREEN#0 -Constant (const byte[]) nums#1 = nums#0 Succesful SSA optimization Pass2ConstantIdentification CONTROL FLOW GRAPH @begin: scope:[] from @@ -480,11 +529,11 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$0 ← (byte) 4 + (byte) main::i#2 (byte~) main::$1 ← (const byte[]) str#1 *idx (byte) main::i#2 *((const byte*) SCREEN#2 + (byte~) main::$0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) 8 + (byte) main::i#2 + (byte~) main::$2 ← (byte) 9 + (byte) main::i#2 (byte~) main::$3 ← (const byte[]) nums#1 *idx (byte) main::i#2 *((const byte*) SCREEN#2 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - if((byte) main::i#1!=(byte) 3) goto main::@1 + if((byte) main::i#1!=(byte) 4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 return @@ -498,7 +547,7 @@ Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2 Consolidated assigned array index constant in assignment *(SCREEN#2+4 + main::$0) Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2 Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2 -Consolidated assigned array index constant in assignment *(SCREEN#2+8 + main::$2) +Consolidated assigned array index constant in assignment *(SCREEN#2+9 + main::$2) Succesful SSA optimization Pass2ConstantAdditionElimination CONTROL FLOW GRAPH @begin: scope:[] from @@ -515,9 +564,9 @@ main::@1: scope:[main] from main main::@1 *((const byte*) SCREEN#2+(byte) 4 + (byte~) main::$0) ← (byte~) main::$1 (byte~) main::$2 ← (byte) main::i#2 (byte~) main::$3 ← (const byte[]) nums#1 *idx (byte) main::i#2 - *((const byte*) SCREEN#2+(byte) 8 + (byte~) main::$2) ← (byte~) main::$3 + *((const byte*) SCREEN#2+(byte) 9 + (byte~) main::$2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - if((byte) main::i#1!=(byte) 3) goto main::@1 + if((byte) main::i#1!=(byte) 4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 return @@ -541,9 +590,9 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$1 ← (const byte[]) str#1 *idx (byte) main::i#2 *((const byte*) SCREEN#2+(byte) 4 + (byte) main::i#2) ← (byte~) main::$1 (byte~) main::$3 ← (const byte[]) nums#1 *idx (byte) main::i#2 - *((const byte*) SCREEN#2+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 + *((const byte*) SCREEN#2+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - if((byte) main::i#1!=(byte) 3) goto main::@1 + if((byte) main::i#1!=(byte) 4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 return @@ -560,6 +609,7 @@ Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2 Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2 Constant inlined SCREEN#2 = (const byte*) SCREEN#0 Constant inlined str#1 = (const byte[]) str#0 +Constant inlined $0 = (string) "bc"+(string) "d" Constant inlined main::i#0 = (byte) 0 Constant inlined nums#1 = (const byte[]) nums#0 Succesful SSA optimization Pass2ConstantInlining @@ -576,9 +626,9 @@ main::@1: scope:[main] from main main::@1 (byte~) main::$1 ← (const byte[]) str#0 *idx (byte) main::i#2 *((const byte*) SCREEN#0+(byte) 4 + (byte) main::i#2) ← (byte~) main::$1 (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 - *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 + *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - if((byte) main::i#1!=(byte) 3) goto main::@1 + if((byte) main::i#1!=(byte) 4) goto main::@1 to:main::@return main::@return: scope:[main] from main::@1 return @@ -603,9 +653,9 @@ FINAL SYMBOL TABLE (byte) num (const byte) num#0 = (byte) 1 (byte[]) nums -(const byte[]) nums#0 = { (byte) 2, (byte) 3, (byte) 4 } +(const byte[]) nums#0 = { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } (byte[]) str -(const byte[]) str#0 = (string) "bcd" +(const byte[]) str#0 = (string) "bc"+(string) "d"+(byte) 'e' Block Sequence Planned @begin @end main main::@1 main::@return Added new block during phi lifting main::@3(between main::@1 and main::@1) @@ -624,9 +674,9 @@ main::@1: scope:[main] from main main::@3 (byte~) main::$1 ← (const byte[]) str#0 *idx (byte) main::i#2 *((const byte*) SCREEN#0+(byte) 4 + (byte) main::i#2) ← (byte~) main::$1 (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 - *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 + *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 (byte) main::i#1 ← ++ (byte) main::i#2 - if((byte) main::i#1!=(byte) 3) goto main::@3 + if((byte) main::i#1!=(byte) 4) goto main::@3 to:main::@return main::@return: scope:[main] from main::@1 return @@ -654,9 +704,9 @@ main::@1: scope:[main] from main main::@3 [4] (byte~) main::$1 ← (const byte[]) str#0 *idx (byte) main::i#2 [ main::i#2 main::$1 ] [5] *((const byte*) SCREEN#0+(byte) 4 + (byte) main::i#2) ← (byte~) main::$1 [ main::i#2 ] [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] - [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] + [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [9] if((byte) main::i#1!=(byte) 3) goto main::@3 [ main::i#1 ] + [9] if((byte) main::i#1!=(byte) 4) goto main::@3 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 [10] return [ ] @@ -686,9 +736,9 @@ main::@1: scope:[main] from main main::@1 [4] (byte~) main::$1 ← (const byte[]) str#0 *idx (byte) main::i#2 [ main::i#2 main::$1 ] [5] *((const byte*) SCREEN#0+(byte) 4 + (byte) main::i#2) ← (byte~) main::$1 [ main::i#2 ] [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] - [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] + [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] + [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 [10] return [ ] @@ -742,8 +792,8 @@ INITIAL ASM .const SCREEN = $400 .const char = 'a' .const num = 1 - str: .text "bcd" - nums: .byte 2, 3, 4 + .const str = "bc"+"d"+'e' + nums: .byte 2, 3, 4, 5 //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] @@ -786,15 +836,15 @@ main: { ldx i lda nums,x sta _3 - //SEG15 [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2 + //SEG15 [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2 lda _3 ldx i - sta SCREEN+8,x + sta SCREEN+9,x //SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG17 [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1 + //SEG17 [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1 lda i - cmp #3 + cmp #4 bne b1_from_b1 jmp breturn //SEG18 main::@return @@ -827,8 +877,8 @@ ASSEMBLER .const SCREEN = $400 .const char = 'a' .const num = 1 - str: .text "bcd" - nums: .byte 2, 3, 4 + .const str = "bc"+"d"+'e' + nums: .byte 2, 3, 4, 5 //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] @@ -859,12 +909,12 @@ main: { sta SCREEN+4,x //SEG14 [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] -- aby=cowo1_staridx_xby lda nums,x - //SEG15 [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby - sta SCREEN+8,x + //SEG15 [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby + sta SCREEN+9,x //SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG17 [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 - cpx #3 + //SEG17 [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + cpx #4 bne b1_from_b1 //SEG18 main::@return breturn: @@ -880,8 +930,8 @@ ASSEMBLER .const SCREEN = $400 .const char = 'a' .const num = 1 - str: .text "bcd" - nums: .byte 2, 3, 4 + .const str = "bc"+"d"+'e' + nums: .byte 2, 3, 4, 5 //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] @@ -911,12 +961,12 @@ main: { sta SCREEN+4,x //SEG14 [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] -- aby=cowo1_staridx_xby lda nums,x - //SEG15 [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby - sta SCREEN+8,x + //SEG15 [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby + sta SCREEN+9,x //SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG17 [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 - cpx #3 + //SEG17 [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + cpx #4 bne b1 //SEG18 main::@return breturn: @@ -934,8 +984,8 @@ ASSEMBLER .const SCREEN = $400 .const char = 'a' .const num = 1 - str: .text "bcd" - nums: .byte 2, 3, 4 + .const str = "bc"+"d"+'e' + nums: .byte 2, 3, 4, 5 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] jsr main @@ -962,12 +1012,12 @@ main: { sta SCREEN+4,x //SEG14 [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] -- aby=cowo1_staridx_xby lda nums,x - //SEG15 [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby - sta SCREEN+8,x + //SEG15 [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby + sta SCREEN+9,x //SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG17 [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 - cpx #3 + //SEG17 [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + cpx #4 bne b1 //SEG18 main::@return //SEG19 [10] return [ ] @@ -981,8 +1031,8 @@ ASSEMBLER .const SCREEN = $400 .const char = 'a' .const num = 1 - str: .text "bcd" - nums: .byte 2, 3, 4 + .const str = "bc"+"d"+'e' + nums: .byte 2, 3, 4, 5 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] jsr main @@ -1008,12 +1058,12 @@ main: { sta SCREEN+4,x //SEG14 [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] -- aby=cowo1_staridx_xby lda nums,x - //SEG15 [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby - sta SCREEN+8,x + //SEG15 [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby + sta SCREEN+9,x //SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG17 [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 - cpx #3 + //SEG17 [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + cpx #4 bne b1 //SEG18 main::@return //SEG19 [10] return [ ] @@ -1038,9 +1088,9 @@ FINAL SYMBOL TABLE (byte) num (const byte) num#0 num = (byte) 1 (byte[]) nums -(const byte[]) nums#0 nums = { (byte) 2, (byte) 3, (byte) 4 } +(const byte[]) nums#0 nums = { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } (byte[]) str -(const byte[]) str#0 str = (string) "bcd" +(const byte[]) str#0 str = (string) "bc"+(string) "d"+(byte) 'e' reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$1 ] @@ -1051,8 +1101,8 @@ FINAL CODE .const SCREEN = $400 .const char = 'a' .const num = 1 - str: .text "bcd" - nums: .byte 2, 3, 4 + .const str = "bc"+"d"+'e' + nums: .byte 2, 3, 4, 5 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] jsr main @@ -1078,12 +1128,12 @@ main: { sta SCREEN+4,x //SEG14 [6] (byte~) main::$3 ← (const byte[]) nums#0 *idx (byte) main::i#2 [ main::i#2 main::$3 ] -- aby=cowo1_staridx_xby lda nums,x - //SEG15 [7] *((const byte*) SCREEN#0+(byte) 8 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby - sta SCREEN+8,x + //SEG15 [7] *((const byte*) SCREEN#0+(byte) 9 + (byte) main::i#2) ← (byte~) main::$3 [ main::i#2 ] -- cowo1_staridx_xby=aby + sta SCREEN+9,x //SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG17 [9] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 - cpx #3 + //SEG17 [9] if((byte) main::i#1!=(byte) 4) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + cpx #4 bne b1 //SEG18 main::@return //SEG19 [10] return [ ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/literals.sym b/src/main/java/dk/camelot64/kickc/test/ref/literals.sym index 956c2175a..609048158 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/literals.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/literals.sym @@ -15,9 +15,9 @@ (byte) num (const byte) num#0 num = (byte) 1 (byte[]) nums -(const byte[]) nums#0 nums = { (byte) 2, (byte) 3, (byte) 4 } +(const byte[]) nums#0 nums = { (byte) 2, (byte) 3, (byte) 4, (byte) 5 } (byte[]) str -(const byte[]) str#0 str = (string) "bcd" +(const byte[]) str#0 str = (string) "bc"+(string) "d"+(byte) 'e' reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$1 ]