diff --git a/src/dk/camelot64/kickc/asm/fragment/xby=coby1.asm b/src/dk/camelot64/kickc/asm/fragment/xby=coby1.asm index 95c8c2fa8..8bc1f4465 100644 --- a/src/dk/camelot64/kickc/asm/fragment/xby=coby1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/xby=coby1.asm @@ -1 +1 @@ -ldx #{coby1} +ldx #{coby1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/xby=xby_minus_1.asm b/src/dk/camelot64/kickc/asm/fragment/xby=xby_minus_1.asm index 125cf09a3..23e2d0ff8 100644 --- a/src/dk/camelot64/kickc/asm/fragment/xby=xby_minus_1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/xby=xby_minus_1.asm @@ -1 +1 @@ -dex +dex \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/xby_gt_0_then_la1.asm b/src/dk/camelot64/kickc/asm/fragment/xby_gt_0_then_la1.asm index 55b9cb6c2..0f99f0508 100644 --- a/src/dk/camelot64/kickc/asm/fragment/xby_gt_0_then_la1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/xby_gt_0_then_la1.asm @@ -1,2 +1,2 @@ cpx #0 -bne {la1} +bne {la1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_gt_coby1.asm b/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_gt_coby1.asm index 2d5f4a5c2..4481a6701 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_gt_coby1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_gt_coby1.asm @@ -8,4 +8,4 @@ !t: LDA #$ff !d: - STA {zpbo1} + STA {zpbo1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_le_coby1.asm b/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_le_coby1.asm index ecccc4e19..2b8b0f1c7 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_le_coby1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_le_coby1.asm @@ -5,4 +5,4 @@ beq !t+ !f: lda #0 jmp !d+ !t: lda #$ff -!d: sta {zpbo1 +!d: sta {zpbo1 \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_lt_coby1.asm b/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_lt_coby1.asm index 924b85821..825f8b359 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_lt_coby1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpbo1=zpby1_lt_coby1.asm @@ -4,4 +4,4 @@ bcc !t+ !f: lda #0 jmp !d+ !t: lda #$ff -!d: sta {zpbo1} +!d: sta {zpbo1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1=coby1.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1=coby1.asm index 68252d812..74a2a50a8 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1=coby1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1=coby1.asm @@ -1,2 +1,2 @@ lda #{coby1} -sta {zpby1} +sta {zpby1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2.asm index c49b5d65b..f52963699 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2.asm @@ -1,2 +1,2 @@ lda {zpby2} -sta {zpby1} +sta {zpby1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_1.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_1.asm index 9e8babc6b..90e148872 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_1.asm @@ -1,4 +1,4 @@ lda {zpby2} sec sbc #1 -sta {zpby1} +sta {zpby1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_coby1.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_coby1.asm index b22d21688..a1cc2cef9 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_coby1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_minus_coby1.asm @@ -1,4 +1,4 @@ lda {zpby2} sec sbc #{coby1} -sta {zpby1} +sta {zpby1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_1.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_1.asm index 44b347210..580648132 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_1.asm @@ -1,4 +1,4 @@ lda {zpby1} clc adc #1 -sta {zpby2} +sta {zpby2} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_zpby3.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_zpby3.asm index a61eea457..3a5edaaa0 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_zpby3.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1=zpby2_plus_zpby3.asm @@ -1,4 +1,4 @@ lda {zpby2} clc adc {zpby3} -sta {zpby1} +sta {zpby1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_0_then_la1.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_0_then_la1.asm index 4c6ddba5c..aa3881fa0 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_0_then_la1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_0_then_la1.asm @@ -1,2 +1,2 @@ lda {zpby1} -bne {la1} +bne {la1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_coby1_then_la1.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_coby1_then_la1.asm index ecc88c62f..7da7bd205 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_coby1_then_la1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1_gt_coby1_then_la1.asm @@ -2,4 +2,4 @@ lda {zpby1} cmp #{coby1} beq !+ bcs {la1} -!: +!: \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/fragment/zpby1_lt_coby1_then_la1.asm b/src/dk/camelot64/kickc/asm/fragment/zpby1_lt_coby1_then_la1.asm index f61f981ea..6333bc30b 100644 --- a/src/dk/camelot64/kickc/asm/fragment/zpby1_lt_coby1_then_la1.asm +++ b/src/dk/camelot64/kickc/asm/fragment/zpby1_lt_coby1_then_la1.asm @@ -1,3 +1,3 @@ lda {zpby1} cmp #{coby1} -bcc {la1} +bcc {la1} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/asm/parser/Asm6502.g4 b/src/dk/camelot64/kickc/asm/parser/Asm6502.g4 index fb0fa1827..a047c27e8 100644 --- a/src/dk/camelot64/kickc/asm/parser/Asm6502.g4 +++ b/src/dk/camelot64/kickc/asm/parser/Asm6502.g4 @@ -6,11 +6,15 @@ file : ; lineSeq - : line+ + : line ( nline*) + ; + +nline + : '\n' line ; line - : label? instruction? comment? '\n' + : label? instruction? comment? ; label diff --git a/src/dk/camelot64/kickc/asm/parser/Asm6502BaseListener.java b/src/dk/camelot64/kickc/asm/parser/Asm6502BaseListener.java index 016ed5d50..ba46876d3 100644 --- a/src/dk/camelot64/kickc/asm/parser/Asm6502BaseListener.java +++ b/src/dk/camelot64/kickc/asm/parser/Asm6502BaseListener.java @@ -35,6 +35,18 @@ public class Asm6502BaseListener implements Asm6502Listener { *

The default implementation does nothing.

*/ @Override public void exitLineSeq(Asm6502Parser.LineSeqContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNline(Asm6502Parser.NlineContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNline(Asm6502Parser.NlineContext ctx) { } /** * {@inheritDoc} * diff --git a/src/dk/camelot64/kickc/asm/parser/Asm6502BaseVisitor.java b/src/dk/camelot64/kickc/asm/parser/Asm6502BaseVisitor.java index 45ae587a2..84371a697 100644 --- a/src/dk/camelot64/kickc/asm/parser/Asm6502BaseVisitor.java +++ b/src/dk/camelot64/kickc/asm/parser/Asm6502BaseVisitor.java @@ -25,6 +25,13 @@ public class Asm6502BaseVisitor extends AbstractParseTreeVisitor implement * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitLineSeq(Asm6502Parser.LineSeqContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitNline(Asm6502Parser.NlineContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * diff --git a/src/dk/camelot64/kickc/asm/parser/Asm6502Listener.java b/src/dk/camelot64/kickc/asm/parser/Asm6502Listener.java index 4fd06e0bd..236a799ef 100644 --- a/src/dk/camelot64/kickc/asm/parser/Asm6502Listener.java +++ b/src/dk/camelot64/kickc/asm/parser/Asm6502Listener.java @@ -27,6 +27,16 @@ public interface Asm6502Listener extends ParseTreeListener { * @param ctx the parse tree */ void exitLineSeq(Asm6502Parser.LineSeqContext ctx); + /** + * Enter a parse tree produced by {@link Asm6502Parser#nline}. + * @param ctx the parse tree + */ + void enterNline(Asm6502Parser.NlineContext ctx); + /** + * Exit a parse tree produced by {@link Asm6502Parser#nline}. + * @param ctx the parse tree + */ + void exitNline(Asm6502Parser.NlineContext ctx); /** * Enter a parse tree produced by {@link Asm6502Parser#line}. * @param ctx the parse tree diff --git a/src/dk/camelot64/kickc/asm/parser/Asm6502Parser.java b/src/dk/camelot64/kickc/asm/parser/Asm6502Parser.java index 1650ae77c..def387205 100644 --- a/src/dk/camelot64/kickc/asm/parser/Asm6502Parser.java +++ b/src/dk/camelot64/kickc/asm/parser/Asm6502Parser.java @@ -21,11 +21,11 @@ public class Asm6502Parser extends Parser { T__9=10, MNEMONIC=11, NUMINT=12, BININTEGER=13, DECINTEGER=14, HEXINTEGER=15, NAME=16, WS=17; public static final int - RULE_file = 0, RULE_lineSeq = 1, RULE_line = 2, RULE_label = 3, RULE_comment = 4, - RULE_instruction = 5, RULE_paramMode = 6, RULE_param = 7; + RULE_file = 0, RULE_lineSeq = 1, RULE_nline = 2, RULE_line = 3, RULE_label = 4, + RULE_comment = 5, RULE_instruction = 6, RULE_paramMode = 7, RULE_param = 8; public static final String[] ruleNames = { - "file", "lineSeq", "line", "label", "comment", "instruction", "paramMode", - "param" + "file", "lineSeq", "nline", "line", "label", "comment", "instruction", + "paramMode", "param" }; private static final String[] _LITERAL_NAMES = { @@ -115,9 +115,9 @@ public class Asm6502Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(16); + setState(18); lineSeq(); - setState(17); + setState(19); match(EOF); } } @@ -133,11 +133,14 @@ public class Asm6502Parser extends Parser { } public static class LineSeqContext extends ParserRuleContext { - public List line() { - return getRuleContexts(LineContext.class); + public LineContext line() { + return getRuleContext(LineContext.class,0); } - public LineContext line(int i) { - return getRuleContext(LineContext.class,i); + public List nline() { + return getRuleContexts(NlineContext.class); + } + public NlineContext nline(int i) { + return getRuleContext(NlineContext.class,i); } public LineSeqContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); @@ -165,20 +168,70 @@ public class Asm6502Parser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(20); + setState(21); + line(); + { + setState(25); _errHandler.sync(this); _la = _input.LA(1); - do { + while (_la==T__0) { { { - setState(19); - line(); + setState(22); + nline(); } } - setState(22); + setState(27); _errHandler.sync(this); _la = _input.LA(1); - } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << MNEMONIC) | (1L << NAME))) != 0) ); + } + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class NlineContext extends ParserRuleContext { + public LineContext line() { + return getRuleContext(LineContext.class,0); + } + public NlineContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_nline; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Asm6502Listener ) ((Asm6502Listener)listener).enterNline(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Asm6502Listener ) ((Asm6502Listener)listener).exitNline(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof Asm6502Visitor ) return ((Asm6502Visitor)visitor).visitNline(this); + else return visitor.visitChildren(this); + } + } + + public final NlineContext nline() throws RecognitionException { + NlineContext _localctx = new NlineContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_nline); + try { + enterOuterAlt(_localctx, 1); + { + setState(28); + match(T__0); + setState(29); + line(); } } catch (RecognitionException re) { @@ -223,43 +276,41 @@ public class Asm6502Parser extends Parser { public final LineContext line() throws RecognitionException { LineContext _localctx = new LineContext(_ctx, getState()); - enterRule(_localctx, 4, RULE_line); + enterRule(_localctx, 6, RULE_line); int _la; try { enterOuterAlt(_localctx, 1); { - setState(25); + setState(32); _errHandler.sync(this); _la = _input.LA(1); if (_la==NAME) { { - setState(24); + setState(31); label(); } } - setState(28); + setState(35); _errHandler.sync(this); _la = _input.LA(1); if (_la==MNEMONIC) { { - setState(27); + setState(34); instruction(); } } - setState(31); + setState(38); _errHandler.sync(this); _la = _input.LA(1); if (_la==T__2) { { - setState(30); + setState(37); comment(); } } - setState(33); - match(T__0); } } catch (RecognitionException re) { @@ -296,13 +347,13 @@ public class Asm6502Parser extends Parser { public final LabelContext label() throws RecognitionException { LabelContext _localctx = new LabelContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_label); + enterRule(_localctx, 8, RULE_label); try { enterOuterAlt(_localctx, 1); { - setState(35); + setState(40); match(NAME); - setState(36); + setState(41); match(T__1); } } @@ -339,26 +390,26 @@ public class Asm6502Parser extends Parser { public final CommentContext comment() throws RecognitionException { CommentContext _localctx = new CommentContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_comment); + enterRule(_localctx, 10, RULE_comment); try { int _alt; enterOuterAlt(_localctx, 1); { - setState(38); + setState(43); match(T__2); - setState(42); + setState(47); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,4,_ctx); while ( _alt!=1 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1+1 ) { { { - setState(39); + setState(44); matchWildcard(); } } } - setState(44); + setState(49); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,4,_ctx); } @@ -401,19 +452,19 @@ public class Asm6502Parser extends Parser { public final InstructionContext instruction() throws RecognitionException { InstructionContext _localctx = new InstructionContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_instruction); + enterRule(_localctx, 12, RULE_instruction); int _la; try { enterOuterAlt(_localctx, 1); { - setState(45); + setState(50); match(MNEMONIC); - setState(47); + setState(52); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__3) | (1L << T__6) | (1L << T__8) | (1L << NUMINT) | (1L << NAME))) != 0)) { { - setState(46); + setState(51); paramMode(); } } @@ -578,16 +629,16 @@ public class Asm6502Parser extends Parser { public final ParamModeContext paramMode() throws RecognitionException { ParamModeContext _localctx = new ParamModeContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_paramMode); + enterRule(_localctx, 14, RULE_paramMode); try { - setState(72); + setState(77); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) { case 1: _localctx = new ModeAbsContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(49); + setState(54); param(); } break; @@ -595,9 +646,9 @@ public class Asm6502Parser extends Parser { _localctx = new ModeImmContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(50); + setState(55); match(T__3); - setState(51); + setState(56); param(); } break; @@ -605,9 +656,9 @@ public class Asm6502Parser extends Parser { _localctx = new ModeAbsXContext(_localctx); enterOuterAlt(_localctx, 3); { - setState(52); + setState(57); param(); - setState(53); + setState(58); match(T__4); } break; @@ -615,9 +666,9 @@ public class Asm6502Parser extends Parser { _localctx = new ModeAbsYContext(_localctx); enterOuterAlt(_localctx, 4); { - setState(55); + setState(60); param(); - setState(56); + setState(61); match(T__5); } break; @@ -625,13 +676,13 @@ public class Asm6502Parser extends Parser { _localctx = new ModeIndYContext(_localctx); enterOuterAlt(_localctx, 5); { - setState(58); + setState(63); match(T__6); - setState(59); + setState(64); param(); - setState(60); + setState(65); match(T__7); - setState(61); + setState(66); match(T__5); } break; @@ -639,13 +690,13 @@ public class Asm6502Parser extends Parser { _localctx = new ModeIndXContext(_localctx); enterOuterAlt(_localctx, 6); { - setState(63); + setState(68); match(T__6); - setState(64); + setState(69); param(); - setState(65); + setState(70); match(T__4); - setState(66); + setState(71); match(T__7); } break; @@ -653,11 +704,11 @@ public class Asm6502Parser extends Parser { _localctx = new ModeIndContext(_localctx); enterOuterAlt(_localctx, 7); { - setState(68); + setState(73); match(T__6); - setState(69); + setState(74); param(); - setState(70); + setState(75); match(T__7); } break; @@ -739,16 +790,16 @@ public class Asm6502Parser extends Parser { public final ParamContext param() throws RecognitionException { ParamContext _localctx = new ParamContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_param); + enterRule(_localctx, 16, RULE_param); try { - setState(79); + setState(84); _errHandler.sync(this); switch (_input.LA(1)) { case NAME: _localctx = new ParamLabelContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(74); + setState(79); match(NAME); } break; @@ -756,11 +807,11 @@ public class Asm6502Parser extends Parser { _localctx = new ParamReplaceContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(75); + setState(80); match(T__8); - setState(76); + setState(81); match(NAME); - setState(77); + setState(82); match(T__9); } break; @@ -768,7 +819,7 @@ public class Asm6502Parser extends Parser { _localctx = new ParamIntContext(_localctx); enterOuterAlt(_localctx, 3); { - setState(78); + setState(83); match(NUMINT); } break; @@ -788,28 +839,29 @@ public class Asm6502Parser extends Parser { } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\23T\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\3\2\3\2\3\2\3\3\6\3"+ - "\27\n\3\r\3\16\3\30\3\4\5\4\34\n\4\3\4\5\4\37\n\4\3\4\5\4\"\n\4\3\4\3"+ - "\4\3\5\3\5\3\5\3\6\3\6\7\6+\n\6\f\6\16\6.\13\6\3\7\3\7\5\7\62\n\7\3\b"+ - "\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3"+ - "\b\3\b\3\b\3\b\3\b\5\bK\n\b\3\t\3\t\3\t\3\t\3\t\5\tR\n\t\3\t\3,\2\n\2"+ - "\4\6\b\n\f\16\20\2\2\2Y\2\22\3\2\2\2\4\26\3\2\2\2\6\33\3\2\2\2\b%\3\2"+ - "\2\2\n(\3\2\2\2\f/\3\2\2\2\16J\3\2\2\2\20Q\3\2\2\2\22\23\5\4\3\2\23\24"+ - "\7\2\2\3\24\3\3\2\2\2\25\27\5\6\4\2\26\25\3\2\2\2\27\30\3\2\2\2\30\26"+ - "\3\2\2\2\30\31\3\2\2\2\31\5\3\2\2\2\32\34\5\b\5\2\33\32\3\2\2\2\33\34"+ - "\3\2\2\2\34\36\3\2\2\2\35\37\5\f\7\2\36\35\3\2\2\2\36\37\3\2\2\2\37!\3"+ - "\2\2\2 \"\5\n\6\2! \3\2\2\2!\"\3\2\2\2\"#\3\2\2\2#$\7\3\2\2$\7\3\2\2\2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 + "\2\2OK\3\2\2\2P\21\3\2\2\2QW\7\22\2\2RS\7\13\2\2ST\7\22\2\2TW\7\f\2\2"+ + "UW\7\16\2\2VQ\3\2\2\2VR\3\2\2\2VU\3\2\2\2W\23\3\2\2\2\n\33\"%(\61\66O"+ + "V"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/dk/camelot64/kickc/asm/parser/Asm6502Visitor.java b/src/dk/camelot64/kickc/asm/parser/Asm6502Visitor.java index 6a927296d..3957cb7e8 100644 --- a/src/dk/camelot64/kickc/asm/parser/Asm6502Visitor.java +++ b/src/dk/camelot64/kickc/asm/parser/Asm6502Visitor.java @@ -22,6 +22,12 @@ public interface Asm6502Visitor extends ParseTreeVisitor { * @return the visitor result */ T visitLineSeq(Asm6502Parser.LineSeqContext ctx); + /** + * Visit a parse tree produced by {@link Asm6502Parser#nline}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNline(Asm6502Parser.NlineContext ctx); /** * Visit a parse tree produced by {@link Asm6502Parser#line}. * @param ctx the parse tree diff --git a/src/dk/camelot64/kickc/icl/Pass3RegisterAllocation.java b/src/dk/camelot64/kickc/icl/Pass3RegisterAllocation.java index 8319c343b..be44c4180 100644 --- a/src/dk/camelot64/kickc/icl/Pass3RegisterAllocation.java +++ b/src/dk/camelot64/kickc/icl/Pass3RegisterAllocation.java @@ -22,10 +22,10 @@ public class Pass3RegisterAllocation { allocation.allocate(var, new RegisterAllocation.RegisterZpBool(currentZp++)); } } -// allocation.allocate(symbols.getVariable("i#1"), RegisterAllocation.getRegisterX()); -// allocation.allocate(symbols.getVariable("i#3"), RegisterAllocation.getRegisterX()); -// allocation.allocate(symbols.getVariable("n1#1"), new RegisterAllocation.RegisterZpByte(8)); -// allocation.allocate(symbols.getVariable("n1#2"), new RegisterAllocation.RegisterZpByte(8)); + allocation.allocate(symbols.getVariable("i#1"), RegisterAllocation.getRegisterX()); + allocation.allocate(symbols.getVariable("i#3"), RegisterAllocation.getRegisterX()); + allocation.allocate(symbols.getVariable("n1#1"), new RegisterAllocation.RegisterZpByte(8)); + allocation.allocate(symbols.getVariable("n1#2"), new RegisterAllocation.RegisterZpByte(8)); symbols.setAllocation(allocation); }