diff --git a/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuxx=vdsm1.asm b/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuxx=vdsm1.asm index e8e02f5c6..e57df6055 100644 --- a/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuxx=vdsm1.asm +++ b/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuxx=vdsm1.asm @@ -1,4 +1,4 @@ -lda m1} +lda {m1} sta {c1},x lda {m1}+1 sta {c1}+1,x diff --git a/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuyy=vdsm1.asm b/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuyy=vdsm1.asm index 8e3ba2cf3..a58a384fb 100644 --- a/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuyy=vdsm1.asm +++ b/src/main/fragment/mos6502-common/pdsc1_derefidx_vbuyy=vdsm1.asm @@ -1,4 +1,4 @@ -lda m1} +lda {m1} sta {c1},y lda {m1}+1 sta {c1}+1,y diff --git a/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm1_derefidx_vbuyy_minus_vdsm2.asm b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm1_derefidx_vbuyy_minus_vdsm2.asm new file mode 100644 index 000000000..ca6cb853e --- /dev/null +++ b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm1_derefidx_vbuyy_minus_vdsm2.asm @@ -0,0 +1,20 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +sec +lda ($fe),y +sbc {m2} +sta ($fe),y +iny +lda ($fe),y +sbc {m2}+1 +sta ($fe),y +iny +lda ($fe),y +sbc {m2}+2 +sta ($fe),y +iny +lda ($fe),y +sbc {m2}+3 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm1_derefidx_vbuyy_plus_vdsm2.asm b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm1_derefidx_vbuyy_plus_vdsm2.asm new file mode 100644 index 000000000..357621791 --- /dev/null +++ b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm1_derefidx_vbuyy_plus_vdsm2.asm @@ -0,0 +1,20 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +clc +lda ($fe),y +adc {m2} +sta ($fe),y +iny +lda ($fe),y +adc {m2}+1 +sta ($fe),y +iny +lda ($fe),y +adc {m2}+2 +sta ($fe),y +iny +lda ($fe),y +adc {m2}+3 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm2_derefidx_vbuyy_minus_vdsm3.asm b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm2_derefidx_vbuyy_minus_vdsm3.asm new file mode 100644 index 000000000..cc728ee48 --- /dev/null +++ b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm2_derefidx_vbuyy_minus_vdsm3.asm @@ -0,0 +1,24 @@ +lda {m1} +sta $fc +lda {m1}+1 +sta $fd +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +sec +lda ($fe),y +sbc {m3} +sta ($fc),y +iny +lda ($fe),y +sbc {m3}+1 +sta ($fc),y +iny +lda ($fe),y +sbc {m3}+2 +sta ($fc),y +iny +lda ($fe),y +sbc {m3}+3 +sta ($fc),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm2_derefidx_vbuyy_plus_vdsm3.asm b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm2_derefidx_vbuyy_plus_vdsm3.asm new file mode 100644 index 000000000..c182f0d6e --- /dev/null +++ b/src/main/fragment/mos6502-common/pdsm1_derefidx_vbuyy=pdsm2_derefidx_vbuyy_plus_vdsm3.asm @@ -0,0 +1,24 @@ +lda {m2} +sta $fc +lda {m2}+1 +sta $fd +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +clc +lda ($fc),y +adc {m3} +sta ($fe),y +iny +lda ($fc),y +adc {m3}+1 +sta ($fe),y +iny +lda ($fc),y +adc {m3}+2 +sta ($fe),y +iny +lda ($fc),y +adc {m3}+3 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pvom1=pvom2_plus_vbuaa.asm b/src/main/fragment/mos6502-common/pvom1=pvom2_plus_vbuaa.asm index 6fa8ea1c7..061db7118 100644 --- a/src/main/fragment/mos6502-common/pvom1=pvom2_plus_vbuaa.asm +++ b/src/main/fragment/mos6502-common/pvom1=pvom2_plus_vbuaa.asm @@ -1,5 +1,5 @@ clc -adc {m2} +adc m2} sta {m1} lda #0 adc {m2}+1 diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuxx=pwsm2_derefidx_vbuyy.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuxx=pwsm2_derefidx_vbuyy.asm new file mode 100644 index 000000000..3011b25d6 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuxx=pwsm2_derefidx_vbuyy.asm @@ -0,0 +1,21 @@ +lda {m1} +sta $fc +lda {m1}+1 +sta $fd +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +lda ($fe),y +pha +iny +lda ($fe),y +pha +txa +tay +iny +pla +sta ($fc),y +dey +pla +sta ($fc),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuxx.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuxx.asm new file mode 100644 index 000000000..9cf6f3c40 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuxx.asm @@ -0,0 +1,17 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +lda ($fe),y +pha +iny +lda ($fe),y +pha +txa +tay +iny +pla +sta ($fe),y +dey +pla +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsc1.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsc1.asm new file mode 100644 index 000000000..529a5e99a --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsc1.asm @@ -0,0 +1,12 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +sec +lda ($fe),y +sbc #<{c1} +sta ($fe),y +iny +lda ($fe),y +sbc #>{c1} +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsm2.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsm2.asm new file mode 100644 index 000000000..5de795006 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsm2.asm @@ -0,0 +1,12 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +sec +lda ($fe),y +sbc {m2} +sta ($fe),y +iny +lda ($fe),y +sbc {m2}+1 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_plus_vwsc1.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_plus_vwsc1.asm new file mode 100644 index 000000000..ab938f3f6 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_plus_vwsc1.asm @@ -0,0 +1,12 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +clc +lda ($fe),y +adc #<{c1} +sta ($fe),y +iny +lda ($fe),y +adc #>{c1} +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_plus_vwsm2.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_plus_vwsm2.asm new file mode 100644 index 000000000..1cb243661 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_plus_vwsm2.asm @@ -0,0 +1,12 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +clc +lda ($fe),y +adc {m2} +sta ($fe),y +iny +lda ($fe),y +adc {m2}+1 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm2_derefidx_vbuyy_minus_vwsm3.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm2_derefidx_vbuyy_minus_vwsm3.asm new file mode 100644 index 000000000..5a603cf10 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm2_derefidx_vbuyy_minus_vwsm3.asm @@ -0,0 +1,16 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +lda {m2} +sta $fc +lda {m2}+1 +sta $fd +sec +lda ($fc),y +sbc {m3} +sta ($fe),y +iny +lda ($fc),y +sbc {m3}+1 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm2_derefidx_vbuyy_plus_vwsm3.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm2_derefidx_vbuyy_plus_vwsm3.asm new file mode 100644 index 000000000..a742c2f99 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm2_derefidx_vbuyy_plus_vwsm3.asm @@ -0,0 +1,16 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +lda {m2} +sta $fc +lda {m2}+1 +sta $fd +clc +lda ($fc),y +adc {m3} +sta ($fe),y +iny +lda ($fc),y +adc {m3}+1 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=vwsc2.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=vwsc2.asm new file mode 100644 index 000000000..9507e8cb3 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=vwsc2.asm @@ -0,0 +1,9 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +lda #<{c2} +sta ($fe),y +iny +lda #>{c2} +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=vwsm2.asm b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=vwsm2.asm new file mode 100644 index 000000000..d979856a5 --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=vwsm2.asm @@ -0,0 +1,9 @@ +lda {m1} +sta $fe +lda {m1}+1 +sta $ff +lda {m2} +sta ($fe),y +iny +lda {m2}+1 +sta ($fe),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vbum1=vbsaa.asm b/src/main/fragment/mos6502-common/vbum1=vbsaa.asm new file mode 100644 index 000000000..d2d258d83 --- /dev/null +++ b/src/main/fragment/mos6502-common/vbum1=vbsaa.asm @@ -0,0 +1 @@ +sta {m1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vbum1_eq_pbum2_derefidx_vbuyy_then_la1.asm b/src/main/fragment/mos6502-common/vbum1_eq_pbum2_derefidx_vbuyy_then_la1.asm new file mode 100644 index 000000000..91ebde136 --- /dev/null +++ b/src/main/fragment/mos6502-common/vbum1_eq_pbum2_derefidx_vbuyy_then_la1.asm @@ -0,0 +1,7 @@ +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +lda ($fe),y +cmp {m1} +beq {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vdsm1=pdsm2_derefidx_vbuyy.asm b/src/main/fragment/mos6502-common/vdsm1=pdsm2_derefidx_vbuyy.asm new file mode 100644 index 000000000..1beb07637 --- /dev/null +++ b/src/main/fragment/mos6502-common/vdsm1=pdsm2_derefidx_vbuyy.asm @@ -0,0 +1,15 @@ +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +lda ($fe),y +sta {m1} +iny +lda ($fe),y +sta {m1}+1 +iny +lda ($fe),y +sta {m1}+2 +iny +lda ($fe),y +sta {m1}+3 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vdsm1=pdsm2_derefidx_vbuyy_plus_vdsc1.asm b/src/main/fragment/mos6502-common/vdsm1=pdsm2_derefidx_vbuyy_plus_vdsc1.asm new file mode 100644 index 000000000..ef6180389 --- /dev/null +++ b/src/main/fragment/mos6502-common/vdsm1=pdsm2_derefidx_vbuyy_plus_vdsc1.asm @@ -0,0 +1,20 @@ +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +clc +lda ($fe),y +adc #<{c1} +sta {m1} +iny +lda ($fe),y +adc #>{c1} +sta {m1}+1 +iny +lda ($fe),y +adc #<{c1}>>16 +sta {m1}+2 +iny +lda ($fe),y +adc #>{c1}>>16 +sta {m1}+3 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vdsm1_neq_0_then_la1.asm b/src/main/fragment/mos6502-common/vdsm1_neq_0_then_la1.asm new file mode 100644 index 000000000..10ee57403 --- /dev/null +++ b/src/main/fragment/mos6502-common/vdsm1_neq_0_then_la1.asm @@ -0,0 +1,5 @@ +lda {m1} +ora {m1}+1 +ora {m1}+2 +ora {m1}+3 +bne {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vdum1=_dword_vwsm2.asm b/src/main/fragment/mos6502-common/vdum1=_dword_vwsm2.asm new file mode 100644 index 000000000..819e19d47 --- /dev/null +++ b/src/main/fragment/mos6502-common/vdum1=_dword_vwsm2.asm @@ -0,0 +1,10 @@ +lda {m2} +sta {m1} +lda {m2}+1 +sta {m1}+1 +ora #$7f +bmi !+ +lda #0 +!: +sta {m1}+2 +sta {m1}+3 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=_sword_vdum2.asm b/src/main/fragment/mos6502-common/vwsm1=_sword_vdum2.asm new file mode 100644 index 000000000..b25001a66 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=_sword_vdum2.asm @@ -0,0 +1,4 @@ +lda {m2} +sta {m1} +lda {m2}+1 +sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy.asm b/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy.asm new file mode 100644 index 000000000..0cf8df4a3 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy.asm @@ -0,0 +1,9 @@ +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +lda ($fe),y +sta {m1} +iny +lda ($fe),y +sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy_plus_pwsm2_derefidx_vbuc2.asm b/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy_plus_pwsm2_derefidx_vbuc2.asm new file mode 100644 index 000000000..603889add --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy_plus_pwsm2_derefidx_vbuc2.asm @@ -0,0 +1,17 @@ +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +clc +iny +lda ($fe),y +pha +dey +lda ($fe),y +ldy #{c2} +adc ($fe),y +sta {m1} +iny +pla +adc ($fe),y +sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy_plus_vbsaa.asm b/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy_plus_vbsaa.asm new file mode 100644 index 000000000..33e9e9ac2 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=pwsm2_derefidx_vbuyy_plus_vbsaa.asm @@ -0,0 +1,17 @@ +sta $fd +lda {m2} +sta $fe +lda {m2}+1 +sta $ff +lda ($fe),y +clc +adc $fd +sta {m1} +iny +lda $fd +ora #$7f +bmi !+ +lda #0 +!: +adc ($fe),y +sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=pwsm3_derefidx_vbuyy_minus_pwsm2_derefidx_vbuxx.asm b/src/main/fragment/mos6502-common/vwsm1=pwsm3_derefidx_vbuyy_minus_pwsm2_derefidx_vbuxx.asm new file mode 100644 index 000000000..3f6233bf0 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=pwsm3_derefidx_vbuyy_minus_pwsm2_derefidx_vbuxx.asm @@ -0,0 +1,24 @@ +lda {m2} +sta $fc +lda {m2}+1 +sta $fd +lda {m3} +sta $fe +lda {m3}+1 +sta $ff +iny +lda ($fe),y +pha +dey +lda ($fe),y +pha +txa +tay +pla +sec +sbc ($fc),y +sta {m1} +iny +pla +sbc ($fc),y +sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=pwsm3_derefidx_vbuyy_plus_pwsm2_derefidx_vbuxx.asm b/src/main/fragment/mos6502-common/vwsm1=pwsm3_derefidx_vbuyy_plus_pwsm2_derefidx_vbuxx.asm new file mode 100644 index 000000000..c64da1d83 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=pwsm3_derefidx_vbuyy_plus_pwsm2_derefidx_vbuxx.asm @@ -0,0 +1,24 @@ +lda {m2} +sta $fc +lda {m2}+1 +sta $fd +lda {m3} +sta $fe +lda {m3}+1 +sta $ff +iny +lda ($fe),y +pha +dey +lda ($fe),y +pha +txa +tay +pla +clc +adc ($fc),y +sta {m1} +iny +pla +adc ($fc),y +sta {m1}+1 \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/KickC.java b/src/main/java/dk/camelot64/kickc/KickC.java index 96f1d5953..c89715fca 100644 --- a/src/main/java/dk/camelot64/kickc/KickC.java +++ b/src/main/java/dk/camelot64/kickc/KickC.java @@ -273,14 +273,20 @@ public class KickC implements Callable { compiler.getLog().setVerboseFragmentLog(true); } compiler.getLog().setSysOut(true); - final AsmFragmentTemplateMasterSynthesizer masterSynthesizer = compiler.getAsmFragmentMasterSynthesizer(); - final AsmFragmentTemplateSynthesizer cpuSynthesizer = masterSynthesizer.getSynthesizer(program.getTargetCpu()); - Collection fragmentTemplates = cpuSynthesizer.getBestTemplates(fragment, compiler.getLog()); - for(AsmFragmentTemplate fragmentTemplate : fragmentTemplates) { - AsmFragmentTemplateUsages.logTemplate(compiler.getLog(), fragmentTemplate, ""); - } - if(fragmentTemplates.size()==0) { - compiler.getLog().append("Cannot create "+fragment); + try { + final AsmFragmentTemplateMasterSynthesizer masterSynthesizer = compiler.getAsmFragmentMasterSynthesizer(); + final AsmFragmentTemplateSynthesizer cpuSynthesizer = masterSynthesizer.getSynthesizer(program.getTargetCpu()); + Collection fragmentTemplates = cpuSynthesizer.getBestTemplates(fragment, compiler.getLog()); + for(AsmFragmentTemplate fragmentTemplate : fragmentTemplates) { + AsmFragmentTemplateUsages.logTemplate(compiler.getLog(), fragmentTemplate, ""); + } + if(fragmentTemplates.size() == 0) { + compiler.getLog().append("Cannot create " + fragment); + return COMPILE_ERROR; + } + } catch (CompileError e) { + // Print the error and exit with compile error + System.err.println(e.format()); return COMPILE_ERROR; } } @@ -295,7 +301,7 @@ public class KickC implements Callable { if(outputDir != null) program.getOutputFileManager().setOutputDir(outputDir); - if(outputFileName!=null) + if(outputFileName != null) program.getOutputFileManager().setOutputFileName(outputFileName); if(optimizeNoUplift) diff --git a/src/main/java/dk/camelot64/kickc/parser/AsmParser.java b/src/main/java/dk/camelot64/kickc/parser/AsmParser.java index f8eb7e076..341c18fb5 100644 --- a/src/main/java/dk/camelot64/kickc/parser/AsmParser.java +++ b/src/main/java/dk/camelot64/kickc/parser/AsmParser.java @@ -18,6 +18,7 @@ public class AsmParser { KickCLexer kickCLexer = new KickCLexer(fragmentCharStream, cParser); kickCLexer.pushMode(KickCLexer.ASM_MODE); KickCParser kickCParser = new KickCParser(new CommonTokenStream(kickCLexer), cParser); + kickCParser.removeErrorListeners(); kickCParser.addErrorListener(new BaseErrorListener() { @Override public void syntaxError(Recognizer recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {