diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java
index 351a85fd4..b1ddc0ac4 100644
--- a/src/main/java/dk/camelot64/kickc/Compiler.java
+++ b/src/main/java/dk/camelot64/kickc/Compiler.java
@@ -106,7 +106,6 @@ public class Compiler {
private Program pass1GenerateSSA() {
- new Pass1FixLvalueLoHi(program).execute();
new Pass1TypeInference(program).execute();
getLog().append("PROGRAM");
getLog().append(program.getStatementSequence().toString(program));
@@ -114,6 +113,8 @@ public class Compiler {
getLog().append(program.getScope().getSymbolTableContents(program));
new Pass1GenerateControlFlowGraph(program).execute();
+ new Pass1FixLValuesLoHi(program).execute();
+ new Pass1AssertNoLValueIntermediate(program).execute();
new Pass1AddTypePromotions(program).execute();
getLog().append("INITIAL CONTROL FLOW GRAPH");
diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java
index d9c2779e4..fdc9c1f69 100644
--- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java
+++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentManager.java
@@ -89,9 +89,18 @@ public class AsmFragmentManager {
Map mapZ = new LinkedHashMap<>();
mapZ.put("z2", "z1");
mapZ.put("z3", "z2");
- Map mapConst = new LinkedHashMap<>();
- mapConst.put("c2", "c1");
- mapConst.put("c3", "c2");
+ Map mapZ2 = new LinkedHashMap<>();
+ mapZ2.put("z3", "z1");
+ Map mapZ3 = new LinkedHashMap<>();
+ mapZ3.put("z3", "z2");
+ Map mapC = new LinkedHashMap<>();
+ mapC.put("c2", "c1");
+ mapC.put("c3", "c2");
+ Map mapC3 = new LinkedHashMap<>();
+ mapC3.put("c3", "c2");
+ Map mapZC = new LinkedHashMap<>();
+ mapZC.putAll(mapZ);
+ mapZC.putAll(mapC);
Map mapSToU = new LinkedHashMap<>();
mapSToU.put("vbsz1", "vbuz1");
mapSToU.put("vbsz2", "vbuz2");
@@ -124,9 +133,14 @@ public class AsmFragmentManager {
synths.add(new FragmentSynthesis("vbsyy=(.*)", null, null, "vbsaa=$1", "tay\n", null));
synths.add(new FragmentSynthesis("vbuz1=(.*)", ".*=.*vb.z1.*", null, "vbuaa=$1", "sta {z1}\n", mapZ));
synths.add(new FragmentSynthesis("vbsz1=(.*)", ".*=.*vb.z1.*", null, "vbsaa=$1", "sta {z1}\n", mapZ));
- synths.add(new FragmentSynthesis("_deref_vwuc1=(.*)", null, null, "vbuaa=$1", "sta {c1}\n", mapConst));
+ synths.add(new FragmentSynthesis("_deref_vwuc1=(.*)", null, null, "vbuaa=$1", "sta {c1}\n", mapC));
synths.add(new FragmentSynthesis("_deref_pbuz1=(.*)", ".*=.*z1.*", null, "vbuaa=$1", "ldy #0\n" + "sta ({z1}),y\n", mapZ));
- synths.add(new FragmentSynthesis("vwuc1_derefidx_vbuz1=(.*)", null, null, "vbuaa=$1", "ldx {z1}\n"+"sta {c1},x\n", mapZ));
+
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuz1=(.*)", ".*z1.*z1.*|.*c1.*c1.*", null, "vb$1aa=$2", "ldx {z1}\n"+"sta {c1},x\n", mapZC));
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuz1=(.*c1.*)", ".*z1.*z1.*", null, "vb$1aa=$2", "ldx {z1}\n"+"sta {c1},x\n", mapZ));
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuyy=(.*)", ".*c1.*c1.*", null, "vb$1aa=$2", "sta {c1},y\n", mapC));
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuxx=(.*)", ".*c1.*c1.*", null, "vb$1aa=$2", "sta {c1},x\n", mapC));
+ synths.add(new FragmentSynthesis("pb(.)z1_derefidx_vbuz2=(.*)", ".*z1.*z1.*|.*z2.*z2.*", null, "vb$1aa=$2", "ldy {z2}\n"+"sta ({z1}),y\n", mapZ2));
synths.add(new FragmentSynthesis("(.*)=vbuxx(.*)", ".*=.*vb.aa.*", "txa\n", "$1=vbuaa$2", null, null));
synths.add(new FragmentSynthesis("(.*)=vbuyy(.*)", ".*=.*vb.aa.*", "tya\n", "$1=vbuaa$2", null, null));
@@ -136,11 +150,39 @@ public class AsmFragmentManager {
synths.add(new FragmentSynthesis("(.*)=vbsz2(.*)", ".*=.*vb.aa.*|.*z2.*z2.*|.*z3.*", "lda {z2}\n", "$1=vbsaa$2", null, null));
synths.add(new FragmentSynthesis("(.*)=vbuz2", ".*=.*aa.*|.*z2.*=.*", "lda {z2}\n", "$1=vbuaa", null, null));
synths.add(new FragmentSynthesis("(.*)=vbsz2", ".*=.*aa.*|.*z2.*=.*", "lda {z2}\n", "$1=vbuaa", null, null));
- synths.add(new FragmentSynthesis("(.*)=vbuc1", ".*=.*aa.*", "lda #{c1}\n", "$1=vbuaa", null, mapConst));
- synths.add(new FragmentSynthesis("(.*)=vbsc1", ".*=.*aa.*", "lda #{c1}\n", "$1=vbsaa", null, mapConst));
- synths.add(new FragmentSynthesis("(.*)=_deref_vwuc1(.*)", ".*=.*aa.*", "lda {c1}\n", "$1=vbuaa$2", null, mapConst));
+ synths.add(new FragmentSynthesis("(.*)=vbuc1", ".*=.*aa.*", "lda #{c1}\n", "$1=vbuaa", null, mapC));
+ synths.add(new FragmentSynthesis("(.*)=vbsc1", ".*=.*aa.*", "lda #{c1}\n", "$1=vbsaa", null, mapC));
+ synths.add(new FragmentSynthesis("(.*)=_deref_vwuc1(.*)", ".*=.*aa.*", "lda {c1}\n", "$1=vbuaa$2", null, mapC));
synths.add(new FragmentSynthesis("(.*)=_deref_pb(.)z1(.*)", ".*z1.*z1.*|.*=.*aa.*|.*=.*yy.*", "ldy #0\n" + "lda ({z1}),y\n", "$1=vb$2aa$3", null, mapZ));
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c1_derefidx_vbuxx(.*)", ".*=.*aa.*|.*c1.*c1.*", "lda {c1},x\n", "$1=$2vb$3aa$4", null, mapC));
+ synths.add(new FragmentSynthesis("(.*)=(.*c1.*)pb(.)c1_derefidx_vbuxx(.*)", ".*=.*aa.*", "lda {c1},x\n", "$1=$2vb$3aa$4", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c1_derefidx_vbuxx(.*c1.*)", ".*=.*aa.*", "lda {c1},x\n", "$1=$2vb$3aa$4", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c1_derefidx_vbuyy(.*)", ".*=.*aa.*|.*c1.*c1.*", "lda {c1},y\n", "$1=$2vb$3aa$4", null, mapC));
+ synths.add(new FragmentSynthesis("(.*)=(.*c1.*)pb(.)c1_derefidx_vbuyy(.*)", ".*=.*aa.*", "lda {c1},y\n", "$1=$2vb$3aa$4", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c1_derefidx_vbuyy(.*c1.*)", ".*=.*aa.*", "lda {c1},y\n", "$1=$2vb$3aa$4", null, null));
+
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c2_derefidx_vbuxx(.*)", ".*=.*aa.*|.*c2.*c2.*", "lda {c2},x\n", "$1=$2vb$3aa$4", null, mapC3));
+ synths.add(new FragmentSynthesis("(.*)=(.*c2.*)pb(.)c2_derefidx_vbuxx(.*)", ".*=.*aa.*", "lda {c2},x\n", "$1=$2vb$3aa$4", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c2_derefidx_vbuxx(.*c2.*)", ".*=.*aa.*", "lda {c2},x\n", "$1=$2vb$3aa$4", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c2_derefidx_vbuyy(.*)", ".*=.*aa.*|.*c2.*c2.*", "lda {c2},y\n", "$1=$2vb$3aa$4", null, mapC3));
+ synths.add(new FragmentSynthesis("(.*)=(.*c2.*)pb(.)c2_derefidx_vbuyy(.*)", ".*=.*aa.*", "lda {c2},y\n", "$1=$2vb$3aa$4", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c2_derefidx_vbuyy(.*c2.*)", ".*=.*aa.*", "lda {c2},y\n", "$1=$2vb$3aa$4", null, null));
+
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuaa(.*)", ".*=.*xx.*", "tax\n", "$1=$2_derefidx_vbuxx$3", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuaa(.*)", ".*=.*yy.*", "tay\n", "$1=$2_derefidx_vbuyy$3", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz1(.*)", ".*=.*xx.*|.*z1.*z1.*", "ldx {z1}\n", "$1=$2_derefidx_vbuxx$3", null, mapZ));
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz1(.*)", ".*=.*yy.*|.*z1.*z1.*", "ldy {z1}\n", "$1=$2_derefidx_vbuyy$3", null, mapZ));
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz2(.*)", ".*=.*xx.*|.*z2.*z2.*", "ldx {z2}\n", "$1=$2_derefidx_vbuxx$3", null, mapZ3));
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz2(.*)", ".*=.*yy.*|.*z2.*z2.*", "ldy {z2}\n", "$1=$2_derefidx_vbuyy$3", null, mapZ3));
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz3(.*)", ".*=.*yy.*", "ldy {z3}\n", "$1=$2_derefidx_vbuyy$3", null, null));
+ synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz3(.*)", ".*=.*xx.*", "ldx {z3}\n", "$1=$2_derefidx_vbuxx$3", null, null));
+
+ synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz1(.*)_derefidx_vbuz1(.*)", ".*z1.*z1.*z1.*|.*xx.*", null, "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", "ldx {z1}\n", mapZ));
+ synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz1(.*)_derefidx_vbuz1(.*)", ".*z1.*z1.*z1.*|.*yy.*", null, "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", "ldy {z1}\n", mapZ));
+ synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", ".*z2.*z2.*z2.*|.*xx.*", null, "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", "ldx {z2}\n", mapZ));
+ synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", ".*z2.*z2.*z2.*|.*yy.*", null, "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", "ldy {z2}\n", mapZ));
+
synths.add(new FragmentSynthesis("(.*)=(.*)_vbuxx", ".*=.*[ax][ax].*xx|.*derefidx_vb.xx", "txa\n", "$1=$2_vbuaa", null, null));
synths.add(new FragmentSynthesis("(.*)=(.*)_vbsxx", ".*=.*[ax][ax].*xx|.*derefidx_vb.xx", "txa\n", "$1=$2_vbsaa", null, null));
synths.add(new FragmentSynthesis("(.*)=(.*)_vbuyy", ".*=.*[ay][ay].*yy|.*derefidx_vb.yy", "tya\n", "$1=$2_vbuaa", null, null));
@@ -153,20 +195,19 @@ public class AsmFragmentManager {
synths.add(new FragmentSynthesis("vbuz1=vbuz1(.*)", ".*=.*vb.aa.*|.*z1.*z1.*z1.*", "lda {z1}\n", "vbuaa=vbuaa$1", "sta {z1}\n", mapZ));
synths.add(new FragmentSynthesis("vbsz1=vbsz1(.*)", ".*=.*vb.aa.*|.*z1.*z1.*z1.*", "lda {z1}\n", "vbsaa=vbsaa$1", "sta {z1}\n", mapZ));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuaa", ".*=.*yy.*", "tay\n", "$1=$2_derefidx_vbuyy", null, null));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuaa", ".*=.*xx.*", "tax\n", "$1=$2_derefidx_vbuxx", null, null));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz1", ".*=.*yy.*|.*z1.*z1.*", "ldy {z1}\n", "$1=$2_derefidx_vbuyy", null, mapZ));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz1", ".*=.*xx.*|.*z1.*z1.*", "ldx {z1}\n", "$1=$2_derefidx_vbuxx", null, mapZ));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz2", ".*=.*xx.*|.*z2.*z2.*", "ldx {z2}\n", "$1=$2_derefidx_vbuxx", null, mapZ));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz2", ".*=.*yy.*|.*z2.*z2.*", "ldy {z2}\n", "$1=$2_derefidx_vbuyy", null, mapZ));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz3", ".*=.*xx.*|.*z3.*z3.*", "ldx {z3}\n", "$1=$2_derefidx_vbuxx", null, mapZ));
- synths.add(new FragmentSynthesis("(.*)=(.*)_derefidx_vbuz3", ".*=.*yy.*|.*z3.*z3.*", "ldy {z3}\n", "$1=$2_derefidx_vbuyy", null, mapZ));
synths.add(new FragmentSynthesis("vbuz1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {z1}\n", "vbuaa_$1_$2", null, mapZ));
synths.add(new FragmentSynthesis("vbsz1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {z1}\n", "vbsaa_$1_$2", null, mapZ));
- synths.add(new FragmentSynthesis("_deref_vwuc1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {c1}\n", "vbuaa_$1_$2", null, mapConst));
+ synths.add(new FragmentSynthesis("_deref_vwuc1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {c1}\n", "vbuaa_$1_$2", null, mapC));
synths.add(new FragmentSynthesis("_deref_pb(.)z1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*|.*vb.yy.*|.*z1.*z1.*", "ldy #0\n" + "lda ({z1}),y\n", "vb$1aa_$2_$3", null, mapZ));
+ synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz1_(lt|gt|le|ge|eq|neq)_(.*)", ".*z1.*z1.*|.*vb.yy.*", "ldy {z1}\n", "$1_derefidx_vbuyy_$2_$3", null, mapZ));
+ synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz1_(lt|gt|le|ge|eq|neq)_(.*)", ".*z1.*z1.*|.*vb.xx.*", "ldx {z1}\n", "$1_derefidx_vbuxx_$2_$3", null, mapZ));
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuyy_(lt|gt|le|ge|eq|neq)_(.*)", ".*c1.*c1.*|.*aa.*", "lda {c1},y\n", "vb$1aa_$2_$3", null, mapC));
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuyy_(lt|gt|le|ge|eq|neq)_(.*c1.*)", ".*aa.*", "lda {c1},y\n", "vb$1aa_$2_$3", null, null));
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuxx_(lt|gt|le|ge|eq|neq)_(.*)", ".*c1.*c1.*|.*aa.*", "lda {c1},x\n", "vb$1aa_$2_$3", null, mapC));
+ synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuxx_(lt|gt|le|ge|eq|neq)_(.*c1.*)", ".*aa.*", "lda {c1},x\n", "vb$1aa_$2_$3", null, null));
+
synths.add(new FragmentSynthesis("(.*)_ge_(vb.aa)_then_(.*)", ".*vb.aa.*_ge.*", null, "$2_lt_$1_then_$3", null, null));
synths.add(new FragmentSynthesis("(.*)_ge_(vb.xx)_then_(.*)", ".*vb.[ax][ax].*_ge.*", null, "$2_lt_$1_then_$3", null, null));
synths.add(new FragmentSynthesis("(.*)_ge_(vb.yy)_then_(.*)", ".*vb.[axy][axy].*_ge.*", null, "$2_lt_$1_then_$3", null, null));
diff --git a/src/main/java/dk/camelot64/kickc/model/LvalueIntermediate.java b/src/main/java/dk/camelot64/kickc/model/LvalueIntermediate.java
new file mode 100644
index 000000000..c624d478a
--- /dev/null
+++ b/src/main/java/dk/camelot64/kickc/model/LvalueIntermediate.java
@@ -0,0 +1,27 @@
+package dk.camelot64.kickc.model;
+
+/**
+ * LValue containing an intermediate variable during parsing. Must be resolved to a proper LValue in Pass 1 - or result in failure
+ */
+public class LvalueIntermediate implements LValue {
+
+ private VariableRef variable;
+
+ public LvalueIntermediate(VariableRef variable) {
+ this.variable = variable;
+ }
+
+ public VariableRef getVariable() {
+ return variable;
+ }
+
+ @Override
+ public String toString(Program program) {
+ return "lval" + "(" + variable.toString(program) + ")";
+ }
+
+ public void setVariable(VariableRef variable) {
+ this.variable = variable;
+ }
+
+}
diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java
index 872c15655..a0aa9ace4 100644
--- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java
+++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeInference.java
@@ -18,6 +18,9 @@ public class SymbolTypeInference {
* @return The type of the resulting value
*/
public static SymbolType inferType(ProgramScope programScope, Operator operator, RValue rValue) {
+ if(operator==null) {
+ return inferType(programScope, rValue);
+ }
if (operator.equals(Operator.CAST_BYTE)) {
return SymbolType.BYTE;
} else if (operator.equals(Operator.CAST_SBYTE)) {
@@ -375,4 +378,45 @@ public class SymbolTypeInference {
return false;
}
+ public static void inferCallLValue(ProgramScope programScope, StatementCall call) {
+ LValue lValue = call.getlValue();
+ if(lValue instanceof VariableRef) {
+ Variable lValueVar = programScope.getVariable((VariableRef) lValue);
+ if(SymbolType.VAR.equals(lValueVar.getType())) {
+ Procedure procedure = programScope.getProcedure(call.getProcedure());
+ lValueVar.setTypeInferred(procedure.getReturnType());
+ }
+ }
+ }
+
+ public static void inferAssignmentLValue(ProgramScope programScope, StatementAssignment assignment) {
+ LValue lValue = assignment.getlValue();
+ if (lValue instanceof VariableRef) {
+ Variable symbol = programScope.getVariable((VariableRef) lValue);
+ if (SymbolType.VAR.equals(symbol.getType())) {
+ // Unresolved symbol - perform inference
+ Operator operator = assignment.getOperator();
+ if (operator == null || assignment.getrValue1() == null) {
+ // Copy operation or Unary operation
+ RValue rValue = assignment.getrValue2();
+ SymbolType type = inferType(programScope, operator, rValue);
+ symbol.setTypeInferred(type);
+ } else {
+ // Binary operation
+ SymbolType type = inferType(programScope, assignment.getrValue1(), assignment.getOperator(), assignment.getrValue2());
+ symbol.setTypeInferred(type);
+ }
+ }
+ }
+ }
+
+ public static void inferLValue(ProgramScope programScope, StatementLValue statementLValue) {
+ if(statementLValue instanceof StatementAssignment) {
+ inferAssignmentLValue(programScope, (StatementAssignment) statementLValue);
+ } else if(statementLValue instanceof StatementCall) {
+ inferCallLValue(programScope, (StatementCall) statementLValue);
+ } else {
+ throw new RuntimeException("LValue statement not implemented "+statementLValue);
+ }
+ }
}
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickC.g4 b/src/main/java/dk/camelot64/kickc/parser/KickC.g4
index 75f79fa8f..c5b097a1f 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickC.g4
+++ b/src/main/java/dk/camelot64/kickc/parser/KickC.g4
@@ -43,7 +43,6 @@ stmtSeq
stmt
: declVar #stmtDeclVar
| '{' stmtSeq? '}' #stmtBlock
- | lvalue '=' expr ';' #stmtAssignment
| expr ';' #stmtExpr
| 'if' '(' expr ')' stmt ( 'else' stmt )? #stmtIfElse
| 'while' '(' expr ')' stmt #stmtWhile
@@ -58,7 +57,7 @@ forDeclaration
;
forIteration
- : ';' expr ';' expr? # forClassic
+ : ';' expr ';' expr # forClassic
| ':' expr ( '..' ) expr #forRange
;
@@ -69,14 +68,6 @@ typeDecl
| typeDecl '[' (expr)? ']' #typeArray
;
-lvalue
- : NAME #lvalueName
- | '*' NAME #lvaluePtr
- | '*' '(' expr ')' #lvaluePtrExpr
- | ('<' | '>' ) lvalue #lvalueLoHi
- | lvalue '[' expr ']' #lvalueArray
- ;
-
expr
: '(' expr ')' #exprPar
| NAME '(' parameterList? ')' #exprCall
@@ -84,7 +75,8 @@ expr
| expr '[' expr ']' #exprArray
| ('--' | '++' ) expr #exprPreMod
| expr ('--' | '++' ) #exprPostMod
- | ('+' | '-' | '!' | '&' | '*' | '~') expr #exprUnary
+ | '*' expr #exprPtr
+ | ('+' | '-' | '!' | '&' | '~') expr #exprUnary
| expr ('>>' | '<<' ) expr #exprBinary
| expr ('*' | '/' | '%' ) expr #exprBinary
| expr ( '+' | '-') expr #exprBinary
@@ -95,6 +87,7 @@ expr
| expr ( '|' ) expr #exprBinary
| expr ( '&&' ) expr #exprBinary
| expr ( '||' ) expr #exprBinary
+ | expr '=' expr #exprAssignment
| '{' expr (',' expr )* '}' #initList
| NAME #exprId
| NUMBER #exprNumber
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickC.tokens b/src/main/java/dk/camelot64/kickc/parser/KickC.tokens
index 7205ec01e..d142d4efa 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickC.tokens
+++ b/src/main/java/dk/camelot64/kickc/parser/KickC.tokens
@@ -86,19 +86,19 @@ COMMENT_BLOCK=66
'*'=20
'['=21
']'=22
-'<'=23
-'>'=24
-'--'=25
-'++'=26
-'+'=27
-'-'=28
-'!'=29
-'&'=30
-'~'=31
-'>>'=32
-'<<'=33
-'/'=34
-'%'=35
+'--'=23
+'++'=24
+'+'=25
+'-'=26
+'!'=27
+'&'=28
+'~'=29
+'>>'=30
+'<<'=31
+'/'=32
+'%'=33
+'<'=34
+'>'=35
'=='=36
'!='=37
'<>'=38
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCBaseListener.java b/src/main/java/dk/camelot64/kickc/parser/KickCBaseListener.java
index 0af96d7df..c7add4b5f 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickCBaseListener.java
+++ b/src/main/java/dk/camelot64/kickc/parser/KickCBaseListener.java
@@ -167,18 +167,6 @@ public class KickCBaseListener implements KickCListener {
* The default implementation does nothing.
*/
@Override public void exitStmtBlock(KickCParser.StmtBlockContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void enterStmtAssignment(KickCParser.StmtAssignmentContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void exitStmtAssignment(KickCParser.StmtAssignmentContext ctx) { }
/**
* {@inheritDoc}
*
@@ -352,61 +340,13 @@ public class KickCBaseListener implements KickCListener {
*
* The default implementation does nothing.
*/
- @Override public void enterLvalueName(KickCParser.LvalueNameContext ctx) { }
+ @Override public void enterExprPtr(KickCParser.ExprPtrContext ctx) { }
/**
* {@inheritDoc}
*
* The default implementation does nothing.
*/
- @Override public void exitLvalueName(KickCParser.LvalueNameContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void enterLvaluePtr(KickCParser.LvaluePtrContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void exitLvaluePtr(KickCParser.LvaluePtrContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void enterLvaluePtrExpr(KickCParser.LvaluePtrExprContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void exitLvaluePtrExpr(KickCParser.LvaluePtrExprContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void enterLvalueArray(KickCParser.LvalueArrayContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void exitLvalueArray(KickCParser.LvalueArrayContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void enterLvalueLoHi(KickCParser.LvalueLoHiContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * The default implementation does nothing.
- */
- @Override public void exitLvalueLoHi(KickCParser.LvalueLoHiContext ctx) { }
+ @Override public void exitExprPtr(KickCParser.ExprPtrContext ctx) { }
/**
* {@inheritDoc}
*
@@ -563,6 +503,18 @@ public class KickCBaseListener implements KickCListener {
* The default implementation does nothing.
*/
@Override public void exitExprId(KickCParser.ExprIdContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterExprAssignment(KickCParser.ExprAssignmentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitExprAssignment(KickCParser.ExprAssignmentContext ctx) { }
/**
* {@inheritDoc}
*
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCBaseVisitor.java b/src/main/java/dk/camelot64/kickc/parser/KickCBaseVisitor.java
index ef9321667..93ee98f12 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickCBaseVisitor.java
+++ b/src/main/java/dk/camelot64/kickc/parser/KickCBaseVisitor.java
@@ -102,13 +102,6 @@ public class KickCBaseVisitor extends AbstractParseTreeVisitor implements
* {@link #visitChildren} on {@code ctx}.
*/
@Override public T visitStmtBlock(KickCParser.StmtBlockContext ctx) { return visitChildren(ctx); }
- /**
- * {@inheritDoc}
- *
- * The default implementation returns the result of calling
- * {@link #visitChildren} on {@code ctx}.
- */
- @Override public T visitStmtAssignment(KickCParser.StmtAssignmentContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@@ -213,35 +206,7 @@ public class KickCBaseVisitor extends AbstractParseTreeVisitor implements
* The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.
*/
- @Override public T visitLvalueName(KickCParser.LvalueNameContext ctx) { return visitChildren(ctx); }
- /**
- * {@inheritDoc}
- *
- * The default implementation returns the result of calling
- * {@link #visitChildren} on {@code ctx}.
- */
- @Override public T visitLvaluePtr(KickCParser.LvaluePtrContext ctx) { return visitChildren(ctx); }
- /**
- * {@inheritDoc}
- *
- * The default implementation returns the result of calling
- * {@link #visitChildren} on {@code ctx}.
- */
- @Override public T visitLvaluePtrExpr(KickCParser.LvaluePtrExprContext ctx) { return visitChildren(ctx); }
- /**
- * {@inheritDoc}
- *
- * The default implementation returns the result of calling
- * {@link #visitChildren} on {@code ctx}.
- */
- @Override public T visitLvalueArray(KickCParser.LvalueArrayContext ctx) { return visitChildren(ctx); }
- /**
- * {@inheritDoc}
- *
- * The default implementation returns the result of calling
- * {@link #visitChildren} on {@code ctx}.
- */
- @Override public T visitLvalueLoHi(KickCParser.LvalueLoHiContext ctx) { return visitChildren(ctx); }
+ @Override public T visitExprPtr(KickCParser.ExprPtrContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@@ -333,6 +298,13 @@ public class KickCBaseVisitor extends AbstractParseTreeVisitor implements
* {@link #visitChildren} on {@code ctx}.
*/
@Override public T visitExprId(KickCParser.ExprIdContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitExprAssignment(KickCParser.ExprAssignmentContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java
index 42d59254f..824404d54 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java
+++ b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.java
@@ -51,8 +51,8 @@ public class KickCLexer extends Lexer {
private static final String[] _LITERAL_NAMES = {
null, "'import'", "'('", "')'", "'{'", "'}'", "','", "'const'", "'='",
"';'", "'if'", "'else'", "'while'", "'do'", "'for'", "'return'", "'asm'",
- "':'", "'..'", "'signed'", "'*'", "'['", "']'", "'<'", "'>'", "'--'",
- "'++'", "'+'", "'-'", "'!'", "'&'", "'~'", "'>>'", "'<<'", "'/'", "'%'",
+ "':'", "'..'", "'signed'", "'*'", "'['", "']'", "'--'", "'++'", "'+'",
+ "'-'", "'!'", "'&'", "'~'", "'>>'", "'<<'", "'/'", "'%'", "'<'", "'>'",
"'=='", "'!='", "'<>'", "'<='", "'=<'", "'>='", "'=>'", "'^'", "'|'",
"'&&'", "'||'", "'#'"
};
@@ -137,10 +137,10 @@ public class KickCLexer extends Lexer {
"\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20"+
"\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\22\3\22\3\23\3\23\3\23"+
"\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3\27\3\27\3\30"+
- "\3\30\3\31\3\31\3\32\3\32\3\32\3\33\3\33\3\33\3\34\3\34\3\35\3\35\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\60\3\60\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3"+
+ "\3\30\3\30\3\31\3\31\3\31\3\32\3\32\3\33\3\33\3\34\3\34\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\60\3\60\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3"+
"\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3"+
"\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3"+
"\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3"+
@@ -193,9 +193,9 @@ public class KickCLexer extends Lexer {
"\2\25\u00ac\3\2\2\2\27\u00af\3\2\2\2\31\u00b4\3\2\2\2\33\u00ba\3\2\2\2"+
"\35\u00bd\3\2\2\2\37\u00c1\3\2\2\2!\u00c8\3\2\2\2#\u00cc\3\2\2\2%\u00ce"+
"\3\2\2\2\'\u00d1\3\2\2\2)\u00d8\3\2\2\2+\u00da\3\2\2\2-\u00dc\3\2\2\2"+
- "/\u00de\3\2\2\2\61\u00e0\3\2\2\2\63\u00e2\3\2\2\2\65\u00e5\3\2\2\2\67"+
- "\u00e8\3\2\2\29\u00ea\3\2\2\2;\u00ec\3\2\2\2=\u00ee\3\2\2\2?\u00f0\3\2"+
- "\2\2A\u00f2\3\2\2\2C\u00f5\3\2\2\2E\u00f8\3\2\2\2G\u00fa\3\2\2\2I\u00fc"+
+ "/\u00de\3\2\2\2\61\u00e1\3\2\2\2\63\u00e4\3\2\2\2\65\u00e6\3\2\2\2\67"+
+ "\u00e8\3\2\2\29\u00ea\3\2\2\2;\u00ec\3\2\2\2=\u00ee\3\2\2\2?\u00f1\3\2"+
+ "\2\2A\u00f4\3\2\2\2C\u00f6\3\2\2\2E\u00f8\3\2\2\2G\u00fa\3\2\2\2I\u00fc"+
"\3\2\2\2K\u00ff\3\2\2\2M\u0102\3\2\2\2O\u0105\3\2\2\2Q\u0108\3\2\2\2S"+
"\u010b\3\2\2\2U\u010e\3\2\2\2W\u0111\3\2\2\2Y\u0113\3\2\2\2[\u0115\3\2"+
"\2\2]\u0118\3\2\2\2_\u011b\3\2\2\2a\u01f8\3\2\2\2c\u020d\3\2\2\2e\u020f"+
@@ -224,14 +224,14 @@ public class KickCLexer extends Lexer {
"\u00d2\u00d3\7k\2\2\u00d3\u00d4\7i\2\2\u00d4\u00d5\7p\2\2\u00d5\u00d6"+
"\7g\2\2\u00d6\u00d7\7f\2\2\u00d7(\3\2\2\2\u00d8\u00d9\7,\2\2\u00d9*\3"+
"\2\2\2\u00da\u00db\7]\2\2\u00db,\3\2\2\2\u00dc\u00dd\7_\2\2\u00dd.\3\2"+
- "\2\2\u00de\u00df\7>\2\2\u00df\60\3\2\2\2\u00e0\u00e1\7@\2\2\u00e1\62\3"+
- "\2\2\2\u00e2\u00e3\7/\2\2\u00e3\u00e4\7/\2\2\u00e4\64\3\2\2\2\u00e5\u00e6"+
- "\7-\2\2\u00e6\u00e7\7-\2\2\u00e7\66\3\2\2\2\u00e8\u00e9\7-\2\2\u00e98"+
- "\3\2\2\2\u00ea\u00eb\7/\2\2\u00eb:\3\2\2\2\u00ec\u00ed\7#\2\2\u00ed<\3"+
- "\2\2\2\u00ee\u00ef\7(\2\2\u00ef>\3\2\2\2\u00f0\u00f1\7\u0080\2\2\u00f1"+
- "@\3\2\2\2\u00f2\u00f3\7@\2\2\u00f3\u00f4\7@\2\2\u00f4B\3\2\2\2\u00f5\u00f6"+
- "\7>\2\2\u00f6\u00f7\7>\2\2\u00f7D\3\2\2\2\u00f8\u00f9\7\61\2\2\u00f9F"+
- "\3\2\2\2\u00fa\u00fb\7\'\2\2\u00fbH\3\2\2\2\u00fc\u00fd\7?\2\2\u00fd\u00fe"+
+ "\2\2\u00de\u00df\7/\2\2\u00df\u00e0\7/\2\2\u00e0\60\3\2\2\2\u00e1\u00e2"+
+ "\7-\2\2\u00e2\u00e3\7-\2\2\u00e3\62\3\2\2\2\u00e4\u00e5\7-\2\2\u00e5\64"+
+ "\3\2\2\2\u00e6\u00e7\7/\2\2\u00e7\66\3\2\2\2\u00e8\u00e9\7#\2\2\u00e9"+
+ "8\3\2\2\2\u00ea\u00eb\7(\2\2\u00eb:\3\2\2\2\u00ec\u00ed\7\u0080\2\2\u00ed"+
+ "<\3\2\2\2\u00ee\u00ef\7@\2\2\u00ef\u00f0\7@\2\2\u00f0>\3\2\2\2\u00f1\u00f2"+
+ "\7>\2\2\u00f2\u00f3\7>\2\2\u00f3@\3\2\2\2\u00f4\u00f5\7\61\2\2\u00f5B"+
+ "\3\2\2\2\u00f6\u00f7\7\'\2\2\u00f7D\3\2\2\2\u00f8\u00f9\7>\2\2\u00f9F"+
+ "\3\2\2\2\u00fa\u00fb\7@\2\2\u00fbH\3\2\2\2\u00fc\u00fd\7?\2\2\u00fd\u00fe"+
"\7?\2\2\u00feJ\3\2\2\2\u00ff\u0100\7#\2\2\u0100\u0101\7?\2\2\u0101L\3"+
"\2\2\2\u0102\u0103\7>\2\2\u0103\u0104\7@\2\2\u0104N\3\2\2\2\u0105\u0106"+
"\7>\2\2\u0106\u0107\7?\2\2\u0107P\3\2\2\2\u0108\u0109\7?\2\2\u0109\u010a"+
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens
index 7205ec01e..d142d4efa 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens
+++ b/src/main/java/dk/camelot64/kickc/parser/KickCLexer.tokens
@@ -86,19 +86,19 @@ COMMENT_BLOCK=66
'*'=20
'['=21
']'=22
-'<'=23
-'>'=24
-'--'=25
-'++'=26
-'+'=27
-'-'=28
-'!'=29
-'&'=30
-'~'=31
-'>>'=32
-'<<'=33
-'/'=34
-'%'=35
+'--'=23
+'++'=24
+'+'=25
+'-'=26
+'!'=27
+'&'=28
+'~'=29
+'>>'=30
+'<<'=31
+'/'=32
+'%'=33
+'<'=34
+'>'=35
'=='=36
'!='=37
'<>'=38
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCListener.java b/src/main/java/dk/camelot64/kickc/parser/KickCListener.java
index 3fed9ae30..308b1cfc0 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickCListener.java
+++ b/src/main/java/dk/camelot64/kickc/parser/KickCListener.java
@@ -145,18 +145,6 @@ public interface KickCListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitStmtBlock(KickCParser.StmtBlockContext ctx);
- /**
- * Enter a parse tree produced by the {@code stmtAssignment}
- * labeled alternative in {@link KickCParser#stmt}.
- * @param ctx the parse tree
- */
- void enterStmtAssignment(KickCParser.StmtAssignmentContext ctx);
- /**
- * Exit a parse tree produced by the {@code stmtAssignment}
- * labeled alternative in {@link KickCParser#stmt}.
- * @param ctx the parse tree
- */
- void exitStmtAssignment(KickCParser.StmtAssignmentContext ctx);
/**
* Enter a parse tree produced by the {@code stmtExpr}
* labeled alternative in {@link KickCParser#stmt}.
@@ -326,65 +314,17 @@ public interface KickCListener extends ParseTreeListener {
*/
void exitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
- * Enter a parse tree produced by the {@code lvalueName}
- * labeled alternative in {@link KickCParser#lvalue}.
+ * Enter a parse tree produced by the {@code exprPtr}
+ * labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
- void enterLvalueName(KickCParser.LvalueNameContext ctx);
+ void enterExprPtr(KickCParser.ExprPtrContext ctx);
/**
- * Exit a parse tree produced by the {@code lvalueName}
- * labeled alternative in {@link KickCParser#lvalue}.
+ * Exit a parse tree produced by the {@code exprPtr}
+ * labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
- void exitLvalueName(KickCParser.LvalueNameContext ctx);
- /**
- * Enter a parse tree produced by the {@code lvaluePtr}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void enterLvaluePtr(KickCParser.LvaluePtrContext ctx);
- /**
- * Exit a parse tree produced by the {@code lvaluePtr}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void exitLvaluePtr(KickCParser.LvaluePtrContext ctx);
- /**
- * Enter a parse tree produced by the {@code lvaluePtrExpr}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void enterLvaluePtrExpr(KickCParser.LvaluePtrExprContext ctx);
- /**
- * Exit a parse tree produced by the {@code lvaluePtrExpr}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void exitLvaluePtrExpr(KickCParser.LvaluePtrExprContext ctx);
- /**
- * Enter a parse tree produced by the {@code lvalueArray}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void enterLvalueArray(KickCParser.LvalueArrayContext ctx);
- /**
- * Exit a parse tree produced by the {@code lvalueArray}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void exitLvalueArray(KickCParser.LvalueArrayContext ctx);
- /**
- * Enter a parse tree produced by the {@code lvalueLoHi}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void enterLvalueLoHi(KickCParser.LvalueLoHiContext ctx);
- /**
- * Exit a parse tree produced by the {@code lvalueLoHi}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- */
- void exitLvalueLoHi(KickCParser.LvalueLoHiContext ctx);
+ void exitExprPtr(KickCParser.ExprPtrContext ctx);
/**
* Enter a parse tree produced by the {@code exprPreMod}
* labeled alternative in {@link KickCParser#expr}.
@@ -541,6 +481,18 @@ public interface KickCListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitExprId(KickCParser.ExprIdContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code exprAssignment}
+ * labeled alternative in {@link KickCParser#expr}.
+ * @param ctx the parse tree
+ */
+ void enterExprAssignment(KickCParser.ExprAssignmentContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code exprAssignment}
+ * labeled alternative in {@link KickCParser#expr}.
+ * @param ctx the parse tree
+ */
+ void exitExprAssignment(KickCParser.ExprAssignmentContext ctx);
/**
* Enter a parse tree produced by the {@code exprArray}
* labeled alternative in {@link KickCParser#expr}.
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCParser.java b/src/main/java/dk/camelot64/kickc/parser/KickCParser.java
index f79bb48e3..1262bde8b 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickCParser.java
+++ b/src/main/java/dk/camelot64/kickc/parser/KickCParser.java
@@ -31,21 +31,21 @@ public class KickCParser extends Parser {
RULE_file = 0, RULE_asmFile = 1, RULE_importSeq = 2, RULE_importDecl = 3,
RULE_declSeq = 4, RULE_decl = 5, RULE_parameterListDecl = 6, RULE_parameterDecl = 7,
RULE_declVar = 8, RULE_stmtSeq = 9, RULE_stmt = 10, RULE_forDeclaration = 11,
- RULE_forIteration = 12, RULE_typeDecl = 13, RULE_lvalue = 14, RULE_expr = 15,
- RULE_parameterList = 16, RULE_asmLines = 17, RULE_asmLine = 18, RULE_asmLabel = 19,
- RULE_asmInstruction = 20, RULE_asmParamMode = 21, RULE_asmExpr = 22;
+ RULE_forIteration = 12, RULE_typeDecl = 13, RULE_expr = 14, RULE_parameterList = 15,
+ RULE_asmLines = 16, RULE_asmLine = 17, RULE_asmLabel = 18, RULE_asmInstruction = 19,
+ RULE_asmParamMode = 20, RULE_asmExpr = 21;
public static final String[] ruleNames = {
"file", "asmFile", "importSeq", "importDecl", "declSeq", "decl", "parameterListDecl",
"parameterDecl", "declVar", "stmtSeq", "stmt", "forDeclaration", "forIteration",
- "typeDecl", "lvalue", "expr", "parameterList", "asmLines", "asmLine",
- "asmLabel", "asmInstruction", "asmParamMode", "asmExpr"
+ "typeDecl", "expr", "parameterList", "asmLines", "asmLine", "asmLabel",
+ "asmInstruction", "asmParamMode", "asmExpr"
};
private static final String[] _LITERAL_NAMES = {
null, "'import'", "'('", "')'", "'{'", "'}'", "','", "'const'", "'='",
"';'", "'if'", "'else'", "'while'", "'do'", "'for'", "'return'", "'asm'",
- "':'", "'..'", "'signed'", "'*'", "'['", "']'", "'<'", "'>'", "'--'",
- "'++'", "'+'", "'-'", "'!'", "'&'", "'~'", "'>>'", "'<<'", "'/'", "'%'",
+ "':'", "'..'", "'signed'", "'*'", "'['", "']'", "'--'", "'++'", "'+'",
+ "'-'", "'!'", "'&'", "'~'", "'>>'", "'<<'", "'/'", "'%'", "'<'", "'>'",
"'=='", "'!='", "'<>'", "'<='", "'=<'", "'>='", "'=>'", "'^'", "'|'",
"'&&'", "'||'", "'#'"
};
@@ -140,11 +140,11 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(46);
+ setState(44);
importSeq();
- setState(47);
+ setState(45);
declSeq();
- setState(48);
+ setState(46);
match(EOF);
}
}
@@ -189,9 +189,9 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(50);
+ setState(48);
asmLines();
- setState(51);
+ setState(49);
match(EOF);
}
}
@@ -239,17 +239,17 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(56);
+ setState(54);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__0) {
{
{
- setState(53);
+ setState(51);
importDecl();
}
}
- setState(58);
+ setState(56);
_errHandler.sync(this);
_la = _input.LA(1);
}
@@ -293,9 +293,9 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(59);
+ setState(57);
match(T__0);
- setState(60);
+ setState(58);
match(STRING);
}
}
@@ -343,17 +343,17 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(63);
+ setState(61);
_errHandler.sync(this);
_la = _input.LA(1);
do {
{
{
- setState(62);
+ setState(60);
decl();
}
}
- setState(65);
+ setState(63);
_errHandler.sync(this);
_la = _input.LA(1);
} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__6) | (1L << T__18) | (1L << SIMPLETYPE))) != 0) );
@@ -432,44 +432,44 @@ public class KickCParser extends Parser {
enterRule(_localctx, 10, RULE_decl);
int _la;
try {
- setState(81);
+ setState(79);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
_localctx = new DeclMethodContext(_localctx);
enterOuterAlt(_localctx, 1);
{
- setState(67);
+ setState(65);
typeDecl(0);
- setState(68);
+ setState(66);
match(NAME);
- setState(69);
+ setState(67);
match(T__1);
- setState(71);
+ setState(69);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__18 || _la==SIMPLETYPE) {
{
- setState(70);
+ setState(68);
parameterListDecl();
}
}
- setState(73);
+ setState(71);
match(T__2);
- setState(74);
+ setState(72);
match(T__3);
- setState(76);
+ setState(74);
_errHandler.sync(this);
_la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__6) | (1L << T__9) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__18) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__6) | (1L << T__9) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__18) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__33) | (1L << T__34) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
{
- setState(75);
+ setState(73);
stmtSeq();
}
}
- setState(78);
+ setState(76);
match(T__4);
}
break;
@@ -477,7 +477,7 @@ public class KickCParser extends Parser {
_localctx = new DeclVariableContext(_localctx);
enterOuterAlt(_localctx, 2);
{
- setState(80);
+ setState(78);
declVar();
}
break;
@@ -527,21 +527,21 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(83);
+ setState(81);
parameterDecl();
- setState(88);
+ setState(86);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__5) {
{
{
- setState(84);
+ setState(82);
match(T__5);
- setState(85);
+ setState(83);
parameterDecl();
}
}
- setState(90);
+ setState(88);
_errHandler.sync(this);
_la = _input.LA(1);
}
@@ -588,9 +588,9 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(91);
+ setState(89);
typeDecl(0);
- setState(92);
+ setState(90);
match(NAME);
}
}
@@ -639,33 +639,33 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(95);
+ setState(93);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__6) {
{
- setState(94);
+ setState(92);
match(T__6);
}
}
- setState(97);
+ setState(95);
typeDecl(0);
- setState(98);
+ setState(96);
match(NAME);
- setState(101);
+ setState(99);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__7) {
{
- setState(99);
+ setState(97);
match(T__7);
- setState(100);
+ setState(98);
expr(0);
}
}
- setState(103);
+ setState(101);
match(T__8);
}
}
@@ -713,20 +713,20 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(106);
+ setState(104);
_errHandler.sync(this);
_la = _input.LA(1);
do {
{
{
- setState(105);
+ setState(103);
stmt();
}
}
- setState(108);
+ setState(106);
_errHandler.sync(this);
_la = _input.LA(1);
- } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__6) | (1L << T__9) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__18) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0) );
+ } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__6) | (1L << T__9) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__18) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__33) | (1L << T__34) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0) );
}
}
catch (RecognitionException re) {
@@ -877,28 +877,6 @@ public class KickCParser extends Parser {
else return visitor.visitChildren(this);
}
}
- public static class StmtAssignmentContext extends StmtContext {
- public LvalueContext lvalue() {
- return getRuleContext(LvalueContext.class,0);
- }
- public ExprContext expr() {
- return getRuleContext(ExprContext.class,0);
- }
- public StmtAssignmentContext(StmtContext ctx) { copyFrom(ctx); }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).enterStmtAssignment(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).exitStmtAssignment(this);
- }
- @Override
- public T accept(ParseTreeVisitor extends T> visitor) {
- if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitStmtAssignment(this);
- else return visitor.visitChildren(this);
- }
- }
public static class StmtAsmContext extends StmtContext {
public AsmLinesContext asmLines() {
return getRuleContext(AsmLinesContext.class,0);
@@ -968,14 +946,14 @@ public class KickCParser extends Parser {
enterRule(_localctx, 20, RULE_stmt);
int _la;
try {
- setState(166);
+ setState(159);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) {
case 1:
_localctx = new StmtDeclVarContext(_localctx);
enterOuterAlt(_localctx, 1);
{
- setState(110);
+ setState(108);
declVar();
}
break;
@@ -983,167 +961,153 @@ public class KickCParser extends Parser {
_localctx = new StmtBlockContext(_localctx);
enterOuterAlt(_localctx, 2);
{
- setState(111);
+ setState(109);
match(T__3);
- setState(113);
+ setState(111);
_errHandler.sync(this);
_la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__6) | (1L << T__9) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__18) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__6) | (1L << T__9) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__18) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__33) | (1L << T__34) | (1L << SIMPLETYPE) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
{
- setState(112);
+ setState(110);
stmtSeq();
}
}
- setState(115);
+ setState(113);
match(T__4);
}
break;
case 3:
- _localctx = new StmtAssignmentContext(_localctx);
+ _localctx = new StmtExprContext(_localctx);
enterOuterAlt(_localctx, 3);
{
- setState(116);
- lvalue(0);
- setState(117);
- match(T__7);
- setState(118);
+ setState(114);
expr(0);
- setState(119);
+ setState(115);
match(T__8);
}
break;
case 4:
- _localctx = new StmtExprContext(_localctx);
+ _localctx = new StmtIfElseContext(_localctx);
enterOuterAlt(_localctx, 4);
{
- setState(121);
- expr(0);
- setState(122);
- match(T__8);
- }
- break;
- case 5:
- _localctx = new StmtIfElseContext(_localctx);
- enterOuterAlt(_localctx, 5);
- {
- setState(124);
+ setState(117);
match(T__9);
- setState(125);
+ setState(118);
match(T__1);
- setState(126);
+ setState(119);
expr(0);
- setState(127);
+ setState(120);
match(T__2);
- setState(128);
+ setState(121);
stmt();
- setState(131);
+ setState(124);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,10,_ctx) ) {
case 1:
{
- setState(129);
+ setState(122);
match(T__10);
- setState(130);
+ setState(123);
stmt();
}
break;
}
}
break;
- case 6:
+ case 5:
_localctx = new StmtWhileContext(_localctx);
- enterOuterAlt(_localctx, 6);
+ enterOuterAlt(_localctx, 5);
{
- setState(133);
+ setState(126);
match(T__11);
- setState(134);
+ setState(127);
match(T__1);
- setState(135);
+ setState(128);
expr(0);
- setState(136);
+ setState(129);
match(T__2);
- setState(137);
+ setState(130);
stmt();
}
break;
- case 7:
+ case 6:
_localctx = new StmtDoWhileContext(_localctx);
- enterOuterAlt(_localctx, 7);
+ enterOuterAlt(_localctx, 6);
{
- setState(139);
+ setState(132);
match(T__12);
- setState(140);
+ setState(133);
stmt();
- setState(141);
+ setState(134);
match(T__11);
- setState(142);
+ setState(135);
match(T__1);
- setState(143);
+ setState(136);
expr(0);
- setState(144);
+ setState(137);
match(T__2);
- setState(145);
+ setState(138);
match(T__8);
}
break;
- case 8:
+ case 7:
_localctx = new StmtForContext(_localctx);
- enterOuterAlt(_localctx, 8);
+ enterOuterAlt(_localctx, 7);
{
- setState(147);
+ setState(140);
match(T__13);
- setState(148);
+ setState(141);
match(T__1);
- setState(150);
+ setState(143);
_errHandler.sync(this);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__18) | (1L << SIMPLETYPE) | (1L << NAME))) != 0)) {
{
- setState(149);
+ setState(142);
forDeclaration();
}
}
- setState(152);
+ setState(145);
forIteration();
- setState(153);
+ setState(146);
match(T__2);
- setState(154);
+ setState(147);
stmt();
}
break;
- case 9:
+ case 8:
_localctx = new StmtReturnContext(_localctx);
- enterOuterAlt(_localctx, 9);
+ enterOuterAlt(_localctx, 8);
{
- setState(156);
+ setState(149);
match(T__14);
- setState(158);
+ setState(151);
_errHandler.sync(this);
_la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__33) | (1L << T__34) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
{
- setState(157);
+ setState(150);
expr(0);
}
}
- setState(160);
+ setState(153);
match(T__8);
}
break;
- case 10:
+ case 9:
_localctx = new StmtAsmContext(_localctx);
- enterOuterAlt(_localctx, 10);
+ enterOuterAlt(_localctx, 9);
{
- setState(161);
+ setState(154);
match(T__15);
- setState(162);
+ setState(155);
match(T__3);
- setState(163);
+ setState(156);
asmLines();
- setState(164);
+ setState(157);
match(T__4);
}
break;
@@ -1203,26 +1167,26 @@ public class KickCParser extends Parser {
_localctx = new ForDeclContext(_localctx);
enterOuterAlt(_localctx, 1);
{
- setState(169);
+ setState(162);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__18 || _la==SIMPLETYPE) {
{
- setState(168);
+ setState(161);
typeDecl(0);
}
}
- setState(171);
+ setState(164);
match(NAME);
- setState(174);
+ setState(167);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__7) {
{
- setState(172);
+ setState(165);
match(T__7);
- setState(173);
+ setState(166);
expr(0);
}
}
@@ -1299,46 +1263,37 @@ public class KickCParser extends Parser {
public final ForIterationContext forIteration() throws RecognitionException {
ForIterationContext _localctx = new ForIterationContext(_ctx, getState());
enterRule(_localctx, 24, RULE_forIteration);
- int _la;
try {
- setState(187);
+ setState(179);
_errHandler.sync(this);
switch (_input.LA(1)) {
case T__8:
_localctx = new ForClassicContext(_localctx);
enterOuterAlt(_localctx, 1);
{
- setState(176);
+ setState(169);
match(T__8);
- setState(177);
+ setState(170);
expr(0);
- setState(178);
+ setState(171);
match(T__8);
- setState(180);
- _errHandler.sync(this);
- _la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
- {
- setState(179);
- expr(0);
- }
- }
-
+ setState(172);
+ expr(0);
}
break;
case T__16:
_localctx = new ForRangeContext(_localctx);
enterOuterAlt(_localctx, 2);
{
- setState(182);
+ setState(174);
match(T__16);
- setState(183);
+ setState(175);
expr(0);
{
- setState(184);
+ setState(176);
match(T__17);
}
- setState(185);
+ setState(177);
expr(0);
}
break;
@@ -1460,7 +1415,7 @@ public class KickCParser extends Parser {
int _alt;
enterOuterAlt(_localctx, 1);
{
- setState(193);
+ setState(185);
_errHandler.sync(this);
switch (_input.LA(1)) {
case SIMPLETYPE:
@@ -1469,7 +1424,7 @@ public class KickCParser extends Parser {
_ctx = _localctx;
_prevctx = _localctx;
- setState(190);
+ setState(182);
match(SIMPLETYPE);
}
break;
@@ -1478,9 +1433,9 @@ public class KickCParser extends Parser {
_localctx = new TypeSignedSimpleContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(191);
+ setState(183);
match(T__18);
- setState(192);
+ setState(184);
match(SIMPLETYPE);
}
break;
@@ -1488,24 +1443,24 @@ public class KickCParser extends Parser {
throw new NoViableAltException(this);
}
_ctx.stop = _input.LT(-1);
- setState(205);
+ setState(197);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,21,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,20,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
- setState(203);
+ setState(195);
_errHandler.sync(this);
- switch ( getInterpreter().adaptivePredict(_input,20,_ctx) ) {
+ switch ( getInterpreter().adaptivePredict(_input,19,_ctx) ) {
case 1:
{
_localctx = new TypePtrContext(new TypeDeclContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_typeDecl);
- setState(195);
+ setState(187);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
- setState(196);
+ setState(188);
match(T__19);
}
break;
@@ -1513,251 +1468,30 @@ public class KickCParser extends Parser {
{
_localctx = new TypeArrayContext(new TypeDeclContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_typeDecl);
- setState(197);
+ setState(189);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
- setState(198);
+ setState(190);
match(T__20);
- setState(200);
+ setState(192);
_errHandler.sync(this);
_la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__33) | (1L << T__34) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
{
- setState(199);
+ setState(191);
expr(0);
}
}
- setState(202);
+ setState(194);
match(T__21);
}
break;
}
}
}
- setState(207);
+ setState(199);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,21,_ctx);
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- unrollRecursionContexts(_parentctx);
- }
- return _localctx;
- }
-
- public static class LvalueContext extends ParserRuleContext {
- public LvalueContext(ParserRuleContext parent, int invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_lvalue; }
-
- public LvalueContext() { }
- public void copyFrom(LvalueContext ctx) {
- super.copyFrom(ctx);
- }
- }
- public static class LvalueNameContext extends LvalueContext {
- public TerminalNode NAME() { return getToken(KickCParser.NAME, 0); }
- public LvalueNameContext(LvalueContext ctx) { copyFrom(ctx); }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).enterLvalueName(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).exitLvalueName(this);
- }
- @Override
- public T accept(ParseTreeVisitor extends T> visitor) {
- if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitLvalueName(this);
- else return visitor.visitChildren(this);
- }
- }
- public static class LvaluePtrContext extends LvalueContext {
- public TerminalNode NAME() { return getToken(KickCParser.NAME, 0); }
- public LvaluePtrContext(LvalueContext ctx) { copyFrom(ctx); }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).enterLvaluePtr(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).exitLvaluePtr(this);
- }
- @Override
- public T accept(ParseTreeVisitor extends T> visitor) {
- if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitLvaluePtr(this);
- else return visitor.visitChildren(this);
- }
- }
- public static class LvaluePtrExprContext extends LvalueContext {
- public ExprContext expr() {
- return getRuleContext(ExprContext.class,0);
- }
- public LvaluePtrExprContext(LvalueContext ctx) { copyFrom(ctx); }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).enterLvaluePtrExpr(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).exitLvaluePtrExpr(this);
- }
- @Override
- public T accept(ParseTreeVisitor extends T> visitor) {
- if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitLvaluePtrExpr(this);
- else return visitor.visitChildren(this);
- }
- }
- public static class LvalueArrayContext extends LvalueContext {
- public LvalueContext lvalue() {
- return getRuleContext(LvalueContext.class,0);
- }
- public ExprContext expr() {
- return getRuleContext(ExprContext.class,0);
- }
- public LvalueArrayContext(LvalueContext ctx) { copyFrom(ctx); }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).enterLvalueArray(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).exitLvalueArray(this);
- }
- @Override
- public T accept(ParseTreeVisitor extends T> visitor) {
- if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitLvalueArray(this);
- else return visitor.visitChildren(this);
- }
- }
- public static class LvalueLoHiContext extends LvalueContext {
- public LvalueContext lvalue() {
- return getRuleContext(LvalueContext.class,0);
- }
- public LvalueLoHiContext(LvalueContext ctx) { copyFrom(ctx); }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).enterLvalueLoHi(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof KickCListener ) ((KickCListener)listener).exitLvalueLoHi(this);
- }
- @Override
- public T accept(ParseTreeVisitor extends T> visitor) {
- if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitLvalueLoHi(this);
- else return visitor.visitChildren(this);
- }
- }
-
- public final LvalueContext lvalue() throws RecognitionException {
- return lvalue(0);
- }
-
- private LvalueContext lvalue(int _p) throws RecognitionException {
- ParserRuleContext _parentctx = _ctx;
- int _parentState = getState();
- LvalueContext _localctx = new LvalueContext(_ctx, _parentState);
- LvalueContext _prevctx = _localctx;
- int _startState = 28;
- enterRecursionRule(_localctx, 28, RULE_lvalue, _p);
- int _la;
- try {
- int _alt;
- enterOuterAlt(_localctx, 1);
- {
- setState(219);
- _errHandler.sync(this);
- switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) {
- case 1:
- {
- _localctx = new LvalueNameContext(_localctx);
- _ctx = _localctx;
- _prevctx = _localctx;
-
- setState(209);
- match(NAME);
- }
- break;
- case 2:
- {
- _localctx = new LvaluePtrContext(_localctx);
- _ctx = _localctx;
- _prevctx = _localctx;
- setState(210);
- match(T__19);
- setState(211);
- match(NAME);
- }
- break;
- case 3:
- {
- _localctx = new LvaluePtrExprContext(_localctx);
- _ctx = _localctx;
- _prevctx = _localctx;
- setState(212);
- match(T__19);
- setState(213);
- match(T__1);
- setState(214);
- expr(0);
- setState(215);
- match(T__2);
- }
- break;
- case 4:
- {
- _localctx = new LvalueLoHiContext(_localctx);
- _ctx = _localctx;
- _prevctx = _localctx;
- setState(217);
- _la = _input.LA(1);
- if ( !(_la==T__22 || _la==T__23) ) {
- _errHandler.recoverInline(this);
- }
- else {
- if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
- _errHandler.reportMatch(this);
- consume();
- }
- setState(218);
- lvalue(2);
- }
- break;
- }
- _ctx.stop = _input.LT(-1);
- setState(228);
- _errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,23,_ctx);
- while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
- if ( _alt==1 ) {
- if ( _parseListeners!=null ) triggerExitRuleEvent();
- _prevctx = _localctx;
- {
- {
- _localctx = new LvalueArrayContext(new LvalueContext(_parentctx, _parentState));
- pushNewRecursionContext(_localctx, _startState, RULE_lvalue);
- setState(221);
- if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
- setState(222);
- match(T__20);
- setState(223);
- expr(0);
- setState(224);
- match(T__21);
- }
- }
- }
- setState(230);
- _errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,23,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,20,_ctx);
}
}
}
@@ -1783,6 +1517,25 @@ public class KickCParser extends Parser {
super.copyFrom(ctx);
}
}
+ public static class ExprPtrContext extends ExprContext {
+ public ExprContext expr() {
+ return getRuleContext(ExprContext.class,0);
+ }
+ public ExprPtrContext(ExprContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof KickCListener ) ((KickCListener)listener).enterExprPtr(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof KickCListener ) ((KickCListener)listener).exitExprPtr(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitExprPtr(this);
+ else return visitor.visitChildren(this);
+ }
+ }
public static class ExprPreModContext extends ExprContext {
public ExprContext expr() {
return getRuleContext(ExprContext.class,0);
@@ -2030,6 +1783,28 @@ public class KickCParser extends Parser {
else return visitor.visitChildren(this);
}
}
+ public static class ExprAssignmentContext extends ExprContext {
+ public List expr() {
+ return getRuleContexts(ExprContext.class);
+ }
+ public ExprContext expr(int i) {
+ return getRuleContext(ExprContext.class,i);
+ }
+ public ExprAssignmentContext(ExprContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof KickCListener ) ((KickCListener)listener).enterExprAssignment(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof KickCListener ) ((KickCListener)listener).exitExprAssignment(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof KickCVisitor ) return ((KickCVisitor extends T>)visitor).visitExprAssignment(this);
+ else return visitor.visitChildren(this);
+ }
+ }
public static class ExprArrayContext extends ExprContext {
public List expr() {
return getRuleContexts(ExprContext.class);
@@ -2062,27 +1837,27 @@ public class KickCParser extends Parser {
int _parentState = getState();
ExprContext _localctx = new ExprContext(_ctx, _parentState);
ExprContext _prevctx = _localctx;
- int _startState = 30;
- enterRecursionRule(_localctx, 30, RULE_expr, _p);
+ int _startState = 28;
+ enterRecursionRule(_localctx, 28, RULE_expr, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
- setState(269);
+ setState(240);
_errHandler.sync(this);
- switch ( getInterpreter().adaptivePredict(_input,26,_ctx) ) {
+ switch ( getInterpreter().adaptivePredict(_input,23,_ctx) ) {
case 1:
{
_localctx = new ExprParContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(232);
+ setState(201);
match(T__1);
- setState(233);
+ setState(202);
expr(0);
- setState(234);
+ setState(203);
match(T__2);
}
break;
@@ -2091,21 +1866,21 @@ public class KickCParser extends Parser {
_localctx = new ExprCallContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(236);
+ setState(205);
match(NAME);
- setState(237);
+ setState(206);
match(T__1);
- setState(239);
+ setState(208);
_errHandler.sync(this);
_la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__3) | (1L << T__19) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__33) | (1L << T__34) | (1L << STRING) | (1L << CHAR) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME))) != 0)) {
{
- setState(238);
+ setState(207);
parameterList();
}
}
- setState(241);
+ setState(210);
match(T__2);
}
break;
@@ -2114,14 +1889,14 @@ public class KickCParser extends Parser {
_localctx = new ExprCastContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(242);
+ setState(211);
match(T__1);
- setState(243);
+ setState(212);
typeDecl(0);
- setState(244);
+ setState(213);
match(T__2);
- setState(245);
- expr(21);
+ setState(214);
+ expr(23);
}
break;
case 4:
@@ -2129,45 +1904,7 @@ public class KickCParser extends Parser {
_localctx = new ExprPreModContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(247);
- _la = _input.LA(1);
- if ( !(_la==T__24 || _la==T__25) ) {
- _errHandler.recoverInline(this);
- }
- else {
- if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
- _errHandler.reportMatch(this);
- consume();
- }
- setState(248);
- expr(19);
- }
- break;
- case 5:
- {
- _localctx = new ExprUnaryContext(_localctx);
- _ctx = _localctx;
- _prevctx = _localctx;
- setState(249);
- _la = _input.LA(1);
- if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__19) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30))) != 0)) ) {
- _errHandler.recoverInline(this);
- }
- else {
- if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
- _errHandler.reportMatch(this);
- consume();
- }
- setState(250);
- expr(17);
- }
- break;
- case 6:
- {
- _localctx = new ExprUnaryContext(_localctx);
- _ctx = _localctx;
- _prevctx = _localctx;
- setState(251);
+ setState(216);
_la = _input.LA(1);
if ( !(_la==T__22 || _la==T__23) ) {
_errHandler.recoverInline(this);
@@ -2177,106 +1914,155 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(252);
- expr(13);
+ setState(217);
+ expr(21);
+ }
+ break;
+ case 5:
+ {
+ _localctx = new ExprPtrContext(_localctx);
+ _ctx = _localctx;
+ _prevctx = _localctx;
+ setState(218);
+ match(T__19);
+ setState(219);
+ expr(19);
+ }
+ break;
+ case 6:
+ {
+ _localctx = new ExprUnaryContext(_localctx);
+ _ctx = _localctx;
+ _prevctx = _localctx;
+ setState(220);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28))) != 0)) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(221);
+ expr(18);
}
break;
case 7:
+ {
+ _localctx = new ExprUnaryContext(_localctx);
+ _ctx = _localctx;
+ _prevctx = _localctx;
+ setState(222);
+ _la = _input.LA(1);
+ if ( !(_la==T__33 || _la==T__34) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(223);
+ expr(14);
+ }
+ break;
+ case 8:
{
_localctx = new InitListContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(253);
+ setState(224);
match(T__3);
- setState(254);
+ setState(225);
expr(0);
- setState(259);
+ setState(230);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__5) {
{
{
- setState(255);
+ setState(226);
match(T__5);
- setState(256);
+ setState(227);
expr(0);
}
}
- setState(261);
+ setState(232);
_errHandler.sync(this);
_la = _input.LA(1);
}
- setState(262);
+ setState(233);
match(T__4);
}
break;
- case 8:
- {
- _localctx = new ExprIdContext(_localctx);
- _ctx = _localctx;
- _prevctx = _localctx;
- setState(264);
- match(NAME);
- }
- break;
case 9:
{
- _localctx = new ExprNumberContext(_localctx);
+ _localctx = new ExprIdContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(265);
- match(NUMBER);
+ setState(235);
+ match(NAME);
}
break;
case 10:
{
- _localctx = new ExprStringContext(_localctx);
+ _localctx = new ExprNumberContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(266);
- match(STRING);
+ setState(236);
+ match(NUMBER);
}
break;
case 11:
{
- _localctx = new ExprCharContext(_localctx);
+ _localctx = new ExprStringContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(267);
- match(CHAR);
+ setState(237);
+ match(STRING);
}
break;
case 12:
+ {
+ _localctx = new ExprCharContext(_localctx);
+ _ctx = _localctx;
+ _prevctx = _localctx;
+ setState(238);
+ match(CHAR);
+ }
+ break;
+ case 13:
{
_localctx = new ExprBoolContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(268);
+ setState(239);
match(BOOLEAN);
}
break;
}
_ctx.stop = _input.LT(-1);
- setState(307);
+ setState(281);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,28,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,25,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
- setState(305);
+ setState(279);
_errHandler.sync(this);
- switch ( getInterpreter().adaptivePredict(_input,27,_ctx) ) {
+ switch ( getInterpreter().adaptivePredict(_input,24,_ctx) ) {
case 1:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(271);
- if (!(precpred(_ctx, 16))) throw new FailedPredicateException(this, "precpred(_ctx, 16)");
- setState(272);
+ setState(242);
+ if (!(precpred(_ctx, 17))) throw new FailedPredicateException(this, "precpred(_ctx, 17)");
+ setState(243);
_la = _input.LA(1);
- if ( !(_la==T__31 || _la==T__32) ) {
+ if ( !(_la==T__29 || _la==T__30) ) {
_errHandler.recoverInline(this);
}
else {
@@ -2284,19 +2070,19 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(273);
- expr(17);
+ setState(244);
+ expr(18);
}
break;
case 2:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(274);
- if (!(precpred(_ctx, 15))) throw new FailedPredicateException(this, "precpred(_ctx, 15)");
- setState(275);
+ setState(245);
+ if (!(precpred(_ctx, 16))) throw new FailedPredicateException(this, "precpred(_ctx, 16)");
+ setState(246);
_la = _input.LA(1);
- if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__19) | (1L << T__33) | (1L << T__34))) != 0)) ) {
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__19) | (1L << T__31) | (1L << T__32))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
@@ -2304,19 +2090,19 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(276);
- expr(16);
+ setState(247);
+ expr(17);
}
break;
case 3:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(277);
- if (!(precpred(_ctx, 14))) throw new FailedPredicateException(this, "precpred(_ctx, 14)");
- setState(278);
+ setState(248);
+ if (!(precpred(_ctx, 15))) throw new FailedPredicateException(this, "precpred(_ctx, 15)");
+ setState(249);
_la = _input.LA(1);
- if ( !(_la==T__26 || _la==T__27) ) {
+ if ( !(_la==T__24 || _la==T__25) ) {
_errHandler.recoverInline(this);
}
else {
@@ -2324,19 +2110,19 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(279);
- expr(15);
+ setState(250);
+ expr(16);
}
break;
case 4:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(280);
- if (!(precpred(_ctx, 12))) throw new FailedPredicateException(this, "precpred(_ctx, 12)");
- setState(281);
+ setState(251);
+ if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)");
+ setState(252);
_la = _input.LA(1);
- if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__22) | (1L << T__23) | (1L << T__35) | (1L << T__36) | (1L << T__37) | (1L << T__38) | (1L << T__39) | (1L << T__40) | (1L << T__41))) != 0)) ) {
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__33) | (1L << T__34) | (1L << T__35) | (1L << T__36) | (1L << T__37) | (1L << T__38) | (1L << T__39) | (1L << T__40) | (1L << T__41))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
@@ -2344,103 +2130,115 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(282);
- expr(13);
+ setState(253);
+ expr(14);
}
break;
case 5:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(283);
- if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)");
+ setState(254);
+ if (!(precpred(_ctx, 12))) throw new FailedPredicateException(this, "precpred(_ctx, 12)");
{
- setState(284);
- match(T__29);
+ setState(255);
+ match(T__27);
}
- setState(285);
- expr(12);
+ setState(256);
+ expr(13);
}
break;
case 6:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(286);
- if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)");
+ setState(257);
+ if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)");
{
- setState(287);
+ setState(258);
match(T__42);
}
- setState(288);
- expr(11);
+ setState(259);
+ expr(12);
}
break;
case 7:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(289);
- if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)");
+ setState(260);
+ if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)");
{
- setState(290);
+ setState(261);
match(T__43);
}
- setState(291);
- expr(10);
+ setState(262);
+ expr(11);
}
break;
case 8:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(292);
- if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
+ setState(263);
+ if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)");
{
- setState(293);
+ setState(264);
match(T__44);
}
- setState(294);
- expr(9);
+ setState(265);
+ expr(10);
}
break;
case 9:
{
_localctx = new ExprBinaryContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(295);
- if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
+ setState(266);
+ if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
{
- setState(296);
+ setState(267);
match(T__45);
}
- setState(297);
- expr(8);
+ setState(268);
+ expr(9);
}
break;
case 10:
{
- _localctx = new ExprArrayContext(new ExprContext(_parentctx, _parentState));
+ _localctx = new ExprAssignmentContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(298);
- if (!(precpred(_ctx, 20))) throw new FailedPredicateException(this, "precpred(_ctx, 20)");
- setState(299);
- match(T__20);
- setState(300);
- expr(0);
- setState(301);
- match(T__21);
+ setState(269);
+ if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
+ setState(270);
+ match(T__7);
+ setState(271);
+ expr(7);
}
break;
case 11:
+ {
+ _localctx = new ExprArrayContext(new ExprContext(_parentctx, _parentState));
+ pushNewRecursionContext(_localctx, _startState, RULE_expr);
+ setState(272);
+ if (!(precpred(_ctx, 22))) throw new FailedPredicateException(this, "precpred(_ctx, 22)");
+ setState(273);
+ match(T__20);
+ setState(274);
+ expr(0);
+ setState(275);
+ match(T__21);
+ }
+ break;
+ case 12:
{
_localctx = new ExprPostModContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
- setState(303);
- if (!(precpred(_ctx, 18))) throw new FailedPredicateException(this, "precpred(_ctx, 18)");
- setState(304);
+ setState(277);
+ if (!(precpred(_ctx, 20))) throw new FailedPredicateException(this, "precpred(_ctx, 20)");
+ setState(278);
_la = _input.LA(1);
- if ( !(_la==T__24 || _la==T__25) ) {
+ if ( !(_la==T__22 || _la==T__23) ) {
_errHandler.recoverInline(this);
}
else {
@@ -2453,9 +2251,9 @@ public class KickCParser extends Parser {
}
}
}
- setState(309);
+ setState(283);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,28,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,25,_ctx);
}
}
}
@@ -2498,26 +2296,26 @@ public class KickCParser extends Parser {
public final ParameterListContext parameterList() throws RecognitionException {
ParameterListContext _localctx = new ParameterListContext(_ctx, getState());
- enterRule(_localctx, 32, RULE_parameterList);
+ enterRule(_localctx, 30, RULE_parameterList);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
- setState(310);
+ setState(284);
expr(0);
- setState(315);
+ setState(289);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__5) {
{
{
- setState(311);
+ setState(285);
match(T__5);
- setState(312);
+ setState(286);
expr(0);
}
}
- setState(317);
+ setState(291);
_errHandler.sync(this);
_la = _input.LA(1);
}
@@ -2562,22 +2360,22 @@ public class KickCParser extends Parser {
public final AsmLinesContext asmLines() throws RecognitionException {
AsmLinesContext _localctx = new AsmLinesContext(_ctx, getState());
- enterRule(_localctx, 34, RULE_asmLines);
+ enterRule(_localctx, 32, RULE_asmLines);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
- setState(321);
+ setState(295);
_errHandler.sync(this);
_la = _input.LA(1);
- while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__28) | (1L << MNEMONIC) | (1L << NAME))) != 0)) {
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__26) | (1L << MNEMONIC) | (1L << NAME))) != 0)) {
{
{
- setState(318);
+ setState(292);
asmLine();
}
}
- setState(323);
+ setState(297);
_errHandler.sync(this);
_la = _input.LA(1);
}
@@ -2622,23 +2420,23 @@ public class KickCParser extends Parser {
public final AsmLineContext asmLine() throws RecognitionException {
AsmLineContext _localctx = new AsmLineContext(_ctx, getState());
- enterRule(_localctx, 36, RULE_asmLine);
+ enterRule(_localctx, 34, RULE_asmLine);
try {
- setState(326);
+ setState(300);
_errHandler.sync(this);
switch (_input.LA(1)) {
- case T__28:
+ case T__26:
case NAME:
enterOuterAlt(_localctx, 1);
{
- setState(324);
+ setState(298);
asmLabel();
}
break;
case MNEMONIC:
enterOuterAlt(_localctx, 2);
{
- setState(325);
+ setState(299);
asmInstruction();
}
break;
@@ -2680,26 +2478,26 @@ public class KickCParser extends Parser {
public final AsmLabelContext asmLabel() throws RecognitionException {
AsmLabelContext _localctx = new AsmLabelContext(_ctx, getState());
- enterRule(_localctx, 38, RULE_asmLabel);
+ enterRule(_localctx, 36, RULE_asmLabel);
try {
- setState(332);
+ setState(306);
_errHandler.sync(this);
switch (_input.LA(1)) {
case NAME:
enterOuterAlt(_localctx, 1);
{
- setState(328);
+ setState(302);
match(NAME);
- setState(329);
+ setState(303);
match(T__16);
}
break;
- case T__28:
+ case T__26:
enterOuterAlt(_localctx, 2);
{
- setState(330);
- match(T__28);
- setState(331);
+ setState(304);
+ match(T__26);
+ setState(305);
match(T__16);
}
break;
@@ -2744,18 +2542,18 @@ public class KickCParser extends Parser {
public final AsmInstructionContext asmInstruction() throws RecognitionException {
AsmInstructionContext _localctx = new AsmInstructionContext(_ctx, getState());
- enterRule(_localctx, 40, RULE_asmInstruction);
+ enterRule(_localctx, 38, RULE_asmInstruction);
try {
enterOuterAlt(_localctx, 1);
{
- setState(334);
+ setState(308);
match(MNEMONIC);
- setState(336);
+ setState(310);
_errHandler.sync(this);
- switch ( getInterpreter().adaptivePredict(_input,33,_ctx) ) {
+ switch ( getInterpreter().adaptivePredict(_input,30,_ctx) ) {
case 1:
{
- setState(335);
+ setState(309);
asmParamMode();
}
break;
@@ -2904,16 +2702,16 @@ public class KickCParser extends Parser {
public final AsmParamModeContext asmParamMode() throws RecognitionException {
AsmParamModeContext _localctx = new AsmParamModeContext(_ctx, getState());
- enterRule(_localctx, 42, RULE_asmParamMode);
+ enterRule(_localctx, 40, RULE_asmParamMode);
try {
- setState(361);
+ setState(335);
_errHandler.sync(this);
- switch ( getInterpreter().adaptivePredict(_input,34,_ctx) ) {
+ switch ( getInterpreter().adaptivePredict(_input,31,_ctx) ) {
case 1:
_localctx = new AsmModeAbsContext(_localctx);
enterOuterAlt(_localctx, 1);
{
- setState(338);
+ setState(312);
asmExpr(0);
}
break;
@@ -2921,9 +2719,9 @@ public class KickCParser extends Parser {
_localctx = new AsmModeImmContext(_localctx);
enterOuterAlt(_localctx, 2);
{
- setState(339);
+ setState(313);
match(T__46);
- setState(340);
+ setState(314);
asmExpr(0);
}
break;
@@ -2931,11 +2729,11 @@ public class KickCParser extends Parser {
_localctx = new AsmModeAbsXYContext(_localctx);
enterOuterAlt(_localctx, 3);
{
- setState(341);
+ setState(315);
asmExpr(0);
- setState(342);
+ setState(316);
match(T__5);
- setState(343);
+ setState(317);
match(NAME);
}
break;
@@ -2943,15 +2741,15 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIndIdxXYContext(_localctx);
enterOuterAlt(_localctx, 4);
{
- setState(345);
+ setState(319);
match(T__1);
- setState(346);
+ setState(320);
asmExpr(0);
- setState(347);
+ setState(321);
match(T__2);
- setState(348);
+ setState(322);
match(T__5);
- setState(349);
+ setState(323);
match(NAME);
}
break;
@@ -2959,15 +2757,15 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIdxIndXYContext(_localctx);
enterOuterAlt(_localctx, 5);
{
- setState(351);
+ setState(325);
match(T__1);
- setState(352);
+ setState(326);
asmExpr(0);
- setState(353);
+ setState(327);
match(T__5);
- setState(354);
+ setState(328);
match(NAME);
- setState(355);
+ setState(329);
match(T__2);
}
break;
@@ -2975,11 +2773,11 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIndContext(_localctx);
enterOuterAlt(_localctx, 6);
{
- setState(357);
+ setState(331);
match(T__1);
- setState(358);
+ setState(332);
asmExpr(0);
- setState(359);
+ setState(333);
match(T__2);
}
break;
@@ -3143,28 +2941,28 @@ public class KickCParser extends Parser {
int _parentState = getState();
AsmExprContext _localctx = new AsmExprContext(_ctx, _parentState);
AsmExprContext _prevctx = _localctx;
- int _startState = 44;
- enterRecursionRule(_localctx, 44, RULE_asmExpr, _p);
+ int _startState = 42;
+ enterRecursionRule(_localctx, 42, RULE_asmExpr, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
- setState(373);
+ setState(347);
_errHandler.sync(this);
switch (_input.LA(1)) {
- case T__22:
- case T__23:
- case T__26:
- case T__27:
+ case T__24:
+ case T__25:
+ case T__33:
+ case T__34:
{
_localctx = new AsmExprUnaryContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(364);
+ setState(338);
_la = _input.LA(1);
- if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__22) | (1L << T__23) | (1L << T__26) | (1L << T__27))) != 0)) ) {
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__24) | (1L << T__25) | (1L << T__33) | (1L << T__34))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
@@ -3172,7 +2970,7 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(365);
+ setState(339);
asmExpr(8);
}
break;
@@ -3181,7 +2979,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprLabelContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(366);
+ setState(340);
match(NAME);
}
break;
@@ -3190,7 +2988,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprLabelRelContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(367);
+ setState(341);
match(ASMREL);
}
break;
@@ -3199,11 +2997,11 @@ public class KickCParser extends Parser {
_localctx = new AsmExprReplaceContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(368);
+ setState(342);
match(T__3);
- setState(369);
+ setState(343);
match(NAME);
- setState(370);
+ setState(344);
match(T__4);
}
break;
@@ -3212,7 +3010,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprIntContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(371);
+ setState(345);
match(NUMBER);
}
break;
@@ -3221,7 +3019,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprCharContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
- setState(372);
+ setState(346);
match(CHAR);
}
break;
@@ -3229,26 +3027,26 @@ public class KickCParser extends Parser {
throw new NoViableAltException(this);
}
_ctx.stop = _input.LT(-1);
- setState(383);
+ setState(357);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,37,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,34,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
- setState(381);
+ setState(355);
_errHandler.sync(this);
- switch ( getInterpreter().adaptivePredict(_input,36,_ctx) ) {
+ switch ( getInterpreter().adaptivePredict(_input,33,_ctx) ) {
case 1:
{
_localctx = new AsmExprBinaryContext(new AsmExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_asmExpr);
- setState(375);
+ setState(349);
if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
- setState(376);
+ setState(350);
_la = _input.LA(1);
- if ( !(_la==T__19 || _la==T__33) ) {
+ if ( !(_la==T__19 || _la==T__31) ) {
_errHandler.recoverInline(this);
}
else {
@@ -3256,7 +3054,7 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(377);
+ setState(351);
asmExpr(8);
}
break;
@@ -3264,11 +3062,11 @@ public class KickCParser extends Parser {
{
_localctx = new AsmExprBinaryContext(new AsmExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_asmExpr);
- setState(378);
+ setState(352);
if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
- setState(379);
+ setState(353);
_la = _input.LA(1);
- if ( !(_la==T__26 || _la==T__27) ) {
+ if ( !(_la==T__24 || _la==T__25) ) {
_errHandler.recoverInline(this);
}
else {
@@ -3276,16 +3074,16 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
- setState(380);
+ setState(354);
asmExpr(7);
}
break;
}
}
}
- setState(385);
+ setState(359);
_errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,37,_ctx);
+ _alt = getInterpreter().adaptivePredict(_input,34,_ctx);
}
}
}
@@ -3305,10 +3103,8 @@ public class KickCParser extends Parser {
case 13:
return typeDecl_sempred((TypeDeclContext)_localctx, predIndex);
case 14:
- return lvalue_sempred((LvalueContext)_localctx, predIndex);
- case 15:
return expr_sempred((ExprContext)_localctx, predIndex);
- case 22:
+ case 21:
return asmExpr_sempred((AsmExprContext)_localctx, predIndex);
}
return true;
@@ -3322,21 +3118,16 @@ public class KickCParser extends Parser {
}
return true;
}
- private boolean lvalue_sempred(LvalueContext _localctx, int predIndex) {
- switch (predIndex) {
- case 2:
- return precpred(_ctx, 1);
- }
- return true;
- }
private boolean expr_sempred(ExprContext _localctx, int predIndex) {
switch (predIndex) {
+ case 2:
+ return precpred(_ctx, 17);
case 3:
return precpred(_ctx, 16);
case 4:
return precpred(_ctx, 15);
case 5:
- return precpred(_ctx, 14);
+ return precpred(_ctx, 13);
case 6:
return precpred(_ctx, 12);
case 7:
@@ -3350,9 +3141,9 @@ public class KickCParser extends Parser {
case 11:
return precpred(_ctx, 7);
case 12:
- return precpred(_ctx, 20);
+ return precpred(_ctx, 22);
case 13:
- return precpred(_ctx, 18);
+ return precpred(_ctx, 20);
}
return true;
}
@@ -3367,152 +3158,142 @@ public class KickCParser extends Parser {
}
public static final String _serializedATN =
- "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3D\u0185\4\2\t\2\4"+
+ "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3D\u016b\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\3\2\3\2\3"+
- "\2\3\2\3\3\3\3\3\3\3\4\7\49\n\4\f\4\16\4<\13\4\3\5\3\5\3\5\3\6\6\6B\n"+
- "\6\r\6\16\6C\3\7\3\7\3\7\3\7\5\7J\n\7\3\7\3\7\3\7\5\7O\n\7\3\7\3\7\3\7"+
- "\5\7T\n\7\3\b\3\b\3\b\7\bY\n\b\f\b\16\b\\\13\b\3\t\3\t\3\t\3\n\5\nb\n"+
- "\n\3\n\3\n\3\n\3\n\5\nh\n\n\3\n\3\n\3\13\6\13m\n\13\r\13\16\13n\3\f\3"+
- "\f\3\f\5\ft\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\5\f\u0086\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\5\f\u0099\n\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f\u00a1"+
- "\n\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f\u00a9\n\f\3\r\5\r\u00ac\n\r\3\r\3\r\3"+
- "\r\5\r\u00b1\n\r\3\16\3\16\3\16\3\16\5\16\u00b7\n\16\3\16\3\16\3\16\3"+
- "\16\3\16\5\16\u00be\n\16\3\17\3\17\3\17\3\17\5\17\u00c4\n\17\3\17\3\17"+
- "\3\17\3\17\3\17\5\17\u00cb\n\17\3\17\7\17\u00ce\n\17\f\17\16\17\u00d1"+
- "\13\17\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\5\20\u00de"+
- "\n\20\3\20\3\20\3\20\3\20\3\20\7\20\u00e5\n\20\f\20\16\20\u00e8\13\20"+
- "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\5\21\u00f2\n\21\3\21\3\21\3\21"+
- "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\7\21"+
- "\u0104\n\21\f\21\16\21\u0107\13\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21"+
- "\5\21\u0110\n\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21"+
- "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21"+
- "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\7\21\u0134\n\21\f\21\16"+
- "\21\u0137\13\21\3\22\3\22\3\22\7\22\u013c\n\22\f\22\16\22\u013f\13\22"+
- "\3\23\7\23\u0142\n\23\f\23\16\23\u0145\13\23\3\24\3\24\5\24\u0149\n\24"+
- "\3\25\3\25\3\25\3\25\5\25\u014f\n\25\3\26\3\26\5\26\u0153\n\26\3\27\3"+
- "\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3"+
- "\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\5\27\u016c\n\27\3\30\3\30\3\30"+
- "\3\30\3\30\3\30\3\30\3\30\3\30\3\30\5\30\u0178\n\30\3\30\3\30\3\30\3\30"+
- "\3\30\3\30\7\30\u0180\n\30\f\30\16\30\u0183\13\30\3\30\2\6\34\36 .\31"+
- "\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\2\13\3\2\31\32\3\2\33"+
- "\34\4\2\26\26\35!\3\2\"#\4\2\26\26$%\3\2\35\36\4\2\31\32&,\4\2\31\32\35"+
- "\36\4\2\26\26$$\2\u01b8\2\60\3\2\2\2\4\64\3\2\2\2\6:\3\2\2\2\b=\3\2\2"+
- "\2\nA\3\2\2\2\fS\3\2\2\2\16U\3\2\2\2\20]\3\2\2\2\22a\3\2\2\2\24l\3\2\2"+
- "\2\26\u00a8\3\2\2\2\30\u00ab\3\2\2\2\32\u00bd\3\2\2\2\34\u00c3\3\2\2\2"+
- "\36\u00dd\3\2\2\2 \u010f\3\2\2\2\"\u0138\3\2\2\2$\u0143\3\2\2\2&\u0148"+
- "\3\2\2\2(\u014e\3\2\2\2*\u0150\3\2\2\2,\u016b\3\2\2\2.\u0177\3\2\2\2\60"+
- "\61\5\6\4\2\61\62\5\n\6\2\62\63\7\2\2\3\63\3\3\2\2\2\64\65\5$\23\2\65"+
- "\66\7\2\2\3\66\5\3\2\2\2\679\5\b\5\28\67\3\2\2\29<\3\2\2\2:8\3\2\2\2:"+
- ";\3\2\2\2;\7\3\2\2\2<:\3\2\2\2=>\7\3\2\2>?\7\64\2\2?\t\3\2\2\2@B\5\f\7"+
- "\2A@\3\2\2\2BC\3\2\2\2CA\3\2\2\2CD\3\2\2\2D\13\3\2\2\2EF\5\34\17\2FG\7"+
- "@\2\2GI\7\4\2\2HJ\5\16\b\2IH\3\2\2\2IJ\3\2\2\2JK\3\2\2\2KL\7\5\2\2LN\7"+
- "\6\2\2MO\5\24\13\2NM\3\2\2\2NO\3\2\2\2OP\3\2\2\2PQ\7\7\2\2QT\3\2\2\2R"+
- "T\5\22\n\2SE\3\2\2\2SR\3\2\2\2T\r\3\2\2\2UZ\5\20\t\2VW\7\b\2\2WY\5\20"+
- "\t\2XV\3\2\2\2Y\\\3\2\2\2ZX\3\2\2\2Z[\3\2\2\2[\17\3\2\2\2\\Z\3\2\2\2]"+
- "^\5\34\17\2^_\7@\2\2_\21\3\2\2\2`b\7\t\2\2a`\3\2\2\2ab\3\2\2\2bc\3\2\2"+
- "\2cd\5\34\17\2dg\7@\2\2ef\7\n\2\2fh\5 \21\2ge\3\2\2\2gh\3\2\2\2hi\3\2"+
- "\2\2ij\7\13\2\2j\23\3\2\2\2km\5\26\f\2lk\3\2\2\2mn\3\2\2\2nl\3\2\2\2n"+
- "o\3\2\2\2o\25\3\2\2\2p\u00a9\5\22\n\2qs\7\6\2\2rt\5\24\13\2sr\3\2\2\2"+
- "st\3\2\2\2tu\3\2\2\2u\u00a9\7\7\2\2vw\5\36\20\2wx\7\n\2\2xy\5 \21\2yz"+
- "\7\13\2\2z\u00a9\3\2\2\2{|\5 \21\2|}\7\13\2\2}\u00a9\3\2\2\2~\177\7\f"+
- "\2\2\177\u0080\7\4\2\2\u0080\u0081\5 \21\2\u0081\u0082\7\5\2\2\u0082\u0085"+
- "\5\26\f\2\u0083\u0084\7\r\2\2\u0084\u0086\5\26\f\2\u0085\u0083\3\2\2\2"+
- "\u0085\u0086\3\2\2\2\u0086\u00a9\3\2\2\2\u0087\u0088\7\16\2\2\u0088\u0089"+
- "\7\4\2\2\u0089\u008a\5 \21\2\u008a\u008b\7\5\2\2\u008b\u008c\5\26\f\2"+
- "\u008c\u00a9\3\2\2\2\u008d\u008e\7\17\2\2\u008e\u008f\5\26\f\2\u008f\u0090"+
- "\7\16\2\2\u0090\u0091\7\4\2\2\u0091\u0092\5 \21\2\u0092\u0093\7\5\2\2"+
- "\u0093\u0094\7\13\2\2\u0094\u00a9\3\2\2\2\u0095\u0096\7\20\2\2\u0096\u0098"+
- "\7\4\2\2\u0097\u0099\5\30\r\2\u0098\u0097\3\2\2\2\u0098\u0099\3\2\2\2"+
- "\u0099\u009a\3\2\2\2\u009a\u009b\5\32\16\2\u009b\u009c\7\5\2\2\u009c\u009d"+
- "\5\26\f\2\u009d\u00a9\3\2\2\2\u009e\u00a0\7\21\2\2\u009f\u00a1\5 \21\2"+
- "\u00a0\u009f\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u00a2\3\2\2\2\u00a2\u00a9"+
- "\7\13\2\2\u00a3\u00a4\7\22\2\2\u00a4\u00a5\7\6\2\2\u00a5\u00a6\5$\23\2"+
- "\u00a6\u00a7\7\7\2\2\u00a7\u00a9\3\2\2\2\u00a8p\3\2\2\2\u00a8q\3\2\2\2"+
- "\u00a8v\3\2\2\2\u00a8{\3\2\2\2\u00a8~\3\2\2\2\u00a8\u0087\3\2\2\2\u00a8"+
- "\u008d\3\2\2\2\u00a8\u0095\3\2\2\2\u00a8\u009e\3\2\2\2\u00a8\u00a3\3\2"+
- "\2\2\u00a9\27\3\2\2\2\u00aa\u00ac\5\34\17\2\u00ab\u00aa\3\2\2\2\u00ab"+
- "\u00ac\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad\u00b0\7@\2\2\u00ae\u00af\7\n"+
- "\2\2\u00af\u00b1\5 \21\2\u00b0\u00ae\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1"+
- "\31\3\2\2\2\u00b2\u00b3\7\13\2\2\u00b3\u00b4\5 \21\2\u00b4\u00b6\7\13"+
- "\2\2\u00b5\u00b7\5 \21\2\u00b6\u00b5\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b7"+
- "\u00be\3\2\2\2\u00b8\u00b9\7\23\2\2\u00b9\u00ba\5 \21\2\u00ba\u00bb\7"+
- "\24\2\2\u00bb\u00bc\5 \21\2\u00bc\u00be\3\2\2\2\u00bd\u00b2\3\2\2\2\u00bd"+
- "\u00b8\3\2\2\2\u00be\33\3\2\2\2\u00bf\u00c0\b\17\1\2\u00c0\u00c4\7\63"+
- "\2\2\u00c1\u00c2\7\25\2\2\u00c2\u00c4\7\63\2\2\u00c3\u00bf\3\2\2\2\u00c3"+
- "\u00c1\3\2\2\2\u00c4\u00cf\3\2\2\2\u00c5\u00c6\f\4\2\2\u00c6\u00ce\7\26"+
- "\2\2\u00c7\u00c8\f\3\2\2\u00c8\u00ca\7\27\2\2\u00c9\u00cb\5 \21\2\u00ca"+
- "\u00c9\3\2\2\2\u00ca\u00cb\3\2\2\2\u00cb\u00cc\3\2\2\2\u00cc\u00ce\7\30"+
- "\2\2\u00cd\u00c5\3\2\2\2\u00cd\u00c7\3\2\2\2\u00ce\u00d1\3\2\2\2\u00cf"+
- "\u00cd\3\2\2\2\u00cf\u00d0\3\2\2\2\u00d0\35\3\2\2\2\u00d1\u00cf\3\2\2"+
- "\2\u00d2\u00d3\b\20\1\2\u00d3\u00de\7@\2\2\u00d4\u00d5\7\26\2\2\u00d5"+
- "\u00de\7@\2\2\u00d6\u00d7\7\26\2\2\u00d7\u00d8\7\4\2\2\u00d8\u00d9\5 "+
- "\21\2\u00d9\u00da\7\5\2\2\u00da\u00de\3\2\2\2\u00db\u00dc\t\2\2\2\u00dc"+
- "\u00de\5\36\20\4\u00dd\u00d2\3\2\2\2\u00dd\u00d4\3\2\2\2\u00dd\u00d6\3"+
- "\2\2\2\u00dd\u00db\3\2\2\2\u00de\u00e6\3\2\2\2\u00df\u00e0\f\3\2\2\u00e0"+
- "\u00e1\7\27\2\2\u00e1\u00e2\5 \21\2\u00e2\u00e3\7\30\2\2\u00e3\u00e5\3"+
- "\2\2\2\u00e4\u00df\3\2\2\2\u00e5\u00e8\3\2\2\2\u00e6\u00e4\3\2\2\2\u00e6"+
- "\u00e7\3\2\2\2\u00e7\37\3\2\2\2\u00e8\u00e6\3\2\2\2\u00e9\u00ea\b\21\1"+
- "\2\u00ea\u00eb\7\4\2\2\u00eb\u00ec\5 \21\2\u00ec\u00ed\7\5\2\2\u00ed\u0110"+
- "\3\2\2\2\u00ee\u00ef\7@\2\2\u00ef\u00f1\7\4\2\2\u00f0\u00f2\5\"\22\2\u00f1"+
- "\u00f0\3\2\2\2\u00f1\u00f2\3\2\2\2\u00f2\u00f3\3\2\2\2\u00f3\u0110\7\5"+
- "\2\2\u00f4\u00f5\7\4\2\2\u00f5\u00f6\5\34\17\2\u00f6\u00f7\7\5\2\2\u00f7"+
- "\u00f8\5 \21\27\u00f8\u0110\3\2\2\2\u00f9\u00fa\t\3\2\2\u00fa\u0110\5"+
- " \21\25\u00fb\u00fc\t\4\2\2\u00fc\u0110\5 \21\23\u00fd\u00fe\t\2\2\2\u00fe"+
- "\u0110\5 \21\17\u00ff\u0100\7\6\2\2\u0100\u0105\5 \21\2\u0101\u0102\7"+
- "\b\2\2\u0102\u0104\5 \21\2\u0103\u0101\3\2\2\2\u0104\u0107\3\2\2\2\u0105"+
- "\u0103\3\2\2\2\u0105\u0106\3\2\2\2\u0106\u0108\3\2\2\2\u0107\u0105\3\2"+
- "\2\2\u0108\u0109\7\7\2\2\u0109\u0110\3\2\2\2\u010a\u0110\7@\2\2\u010b"+
- "\u0110\7\67\2\2\u010c\u0110\7\64\2\2\u010d\u0110\7\65\2\2\u010e\u0110"+
- "\7\66\2\2\u010f\u00e9\3\2\2\2\u010f\u00ee\3\2\2\2\u010f\u00f4\3\2\2\2"+
- "\u010f\u00f9\3\2\2\2\u010f\u00fb\3\2\2\2\u010f\u00fd\3\2\2\2\u010f\u00ff"+
- "\3\2\2\2\u010f\u010a\3\2\2\2\u010f\u010b\3\2\2\2\u010f\u010c\3\2\2\2\u010f"+
- "\u010d\3\2\2\2\u010f\u010e\3\2\2\2\u0110\u0135\3\2\2\2\u0111\u0112\f\22"+
- "\2\2\u0112\u0113\t\5\2\2\u0113\u0134\5 \21\23\u0114\u0115\f\21\2\2\u0115"+
- "\u0116\t\6\2\2\u0116\u0134\5 \21\22\u0117\u0118\f\20\2\2\u0118\u0119\t"+
- "\7\2\2\u0119\u0134\5 \21\21\u011a\u011b\f\16\2\2\u011b\u011c\t\b\2\2\u011c"+
- "\u0134\5 \21\17\u011d\u011e\f\r\2\2\u011e\u011f\7 \2\2\u011f\u0134\5 "+
- "\21\16\u0120\u0121\f\f\2\2\u0121\u0122\7-\2\2\u0122\u0134\5 \21\r\u0123"+
- "\u0124\f\13\2\2\u0124\u0125\7.\2\2\u0125\u0134\5 \21\f\u0126\u0127\f\n"+
- "\2\2\u0127\u0128\7/\2\2\u0128\u0134\5 \21\13\u0129\u012a\f\t\2\2\u012a"+
- "\u012b\7\60\2\2\u012b\u0134\5 \21\n\u012c\u012d\f\26\2\2\u012d\u012e\7"+
- "\27\2\2\u012e\u012f\5 \21\2\u012f\u0130\7\30\2\2\u0130\u0134\3\2\2\2\u0131"+
- "\u0132\f\24\2\2\u0132\u0134\t\3\2\2\u0133\u0111\3\2\2\2\u0133\u0114\3"+
- "\2\2\2\u0133\u0117\3\2\2\2\u0133\u011a\3\2\2\2\u0133\u011d\3\2\2\2\u0133"+
- "\u0120\3\2\2\2\u0133\u0123\3\2\2\2\u0133\u0126\3\2\2\2\u0133\u0129\3\2"+
- "\2\2\u0133\u012c\3\2\2\2\u0133\u0131\3\2\2\2\u0134\u0137\3\2\2\2\u0135"+
- "\u0133\3\2\2\2\u0135\u0136\3\2\2\2\u0136!\3\2\2\2\u0137\u0135\3\2\2\2"+
- "\u0138\u013d\5 \21\2\u0139\u013a\7\b\2\2\u013a\u013c\5 \21\2\u013b\u0139"+
- "\3\2\2\2\u013c\u013f\3\2\2\2\u013d\u013b\3\2\2\2\u013d\u013e\3\2\2\2\u013e"+
- "#\3\2\2\2\u013f\u013d\3\2\2\2\u0140\u0142\5&\24\2\u0141\u0140\3\2\2\2"+
- "\u0142\u0145\3\2\2\2\u0143\u0141\3\2\2\2\u0143\u0144\3\2\2\2\u0144%\3"+
- "\2\2\2\u0145\u0143\3\2\2\2\u0146\u0149\5(\25\2\u0147\u0149\5*\26\2\u0148"+
- "\u0146\3\2\2\2\u0148\u0147\3\2\2\2\u0149\'\3\2\2\2\u014a\u014b\7@\2\2"+
- "\u014b\u014f\7\23\2\2\u014c\u014d\7\37\2\2\u014d\u014f\7\23\2\2\u014e"+
- "\u014a\3\2\2\2\u014e\u014c\3\2\2\2\u014f)\3\2\2\2\u0150\u0152\7\62\2\2"+
- "\u0151\u0153\5,\27\2\u0152\u0151\3\2\2\2\u0152\u0153\3\2\2\2\u0153+\3"+
- "\2\2\2\u0154\u016c\5.\30\2\u0155\u0156\7\61\2\2\u0156\u016c\5.\30\2\u0157"+
- "\u0158\5.\30\2\u0158\u0159\7\b\2\2\u0159\u015a\7@\2\2\u015a\u016c\3\2"+
- "\2\2\u015b\u015c\7\4\2\2\u015c\u015d\5.\30\2\u015d\u015e\7\5\2\2\u015e"+
- "\u015f\7\b\2\2\u015f\u0160\7@\2\2\u0160\u016c\3\2\2\2\u0161\u0162\7\4"+
- "\2\2\u0162\u0163\5.\30\2\u0163\u0164\7\b\2\2\u0164\u0165\7@\2\2\u0165"+
- "\u0166\7\5\2\2\u0166\u016c\3\2\2\2\u0167\u0168\7\4\2\2\u0168\u0169\5."+
- "\30\2\u0169\u016a\7\5\2\2\u016a\u016c\3\2\2\2\u016b\u0154\3\2\2\2\u016b"+
- "\u0155\3\2\2\2\u016b\u0157\3\2\2\2\u016b\u015b\3\2\2\2\u016b\u0161\3\2"+
- "\2\2\u016b\u0167\3\2\2\2\u016c-\3\2\2\2\u016d\u016e\b\30\1\2\u016e\u016f"+
- "\t\t\2\2\u016f\u0178\5.\30\n\u0170\u0178\7@\2\2\u0171\u0178\7A\2\2\u0172"+
- "\u0173\7\6\2\2\u0173\u0174\7@\2\2\u0174\u0178\7\7\2\2\u0175\u0178\7\67"+
- "\2\2\u0176\u0178\7\65\2\2\u0177\u016d\3\2\2\2\u0177\u0170\3\2\2\2\u0177"+
- "\u0171\3\2\2\2\u0177\u0172\3\2\2\2\u0177\u0175\3\2\2\2\u0177\u0176\3\2"+
- "\2\2\u0178\u0181\3\2\2\2\u0179\u017a\f\t\2\2\u017a\u017b\t\n\2\2\u017b"+
- "\u0180\5.\30\n\u017c\u017d\f\b\2\2\u017d\u017e\t\7\2\2\u017e\u0180\5."+
- "\30\t\u017f\u0179\3\2\2\2\u017f\u017c\3\2\2\2\u0180\u0183\3\2\2\2\u0181"+
- "\u017f\3\2\2\2\u0181\u0182\3\2\2\2\u0182/\3\2\2\2\u0183\u0181\3\2\2\2"+
- "(:CINSZagns\u0085\u0098\u00a0\u00a8\u00ab\u00b0\u00b6\u00bd\u00c3\u00ca"+
- "\u00cd\u00cf\u00dd\u00e6\u00f1\u0105\u010f\u0133\u0135\u013d\u0143\u0148"+
- "\u014e\u0152\u016b\u0177\u017f\u0181";
+ "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\3\2\3\2\3\2\3\2\3\3"+
+ "\3\3\3\3\3\4\7\4\67\n\4\f\4\16\4:\13\4\3\5\3\5\3\5\3\6\6\6@\n\6\r\6\16"+
+ "\6A\3\7\3\7\3\7\3\7\5\7H\n\7\3\7\3\7\3\7\5\7M\n\7\3\7\3\7\3\7\5\7R\n\7"+
+ "\3\b\3\b\3\b\7\bW\n\b\f\b\16\bZ\13\b\3\t\3\t\3\t\3\n\5\n`\n\n\3\n\3\n"+
+ "\3\n\3\n\5\nf\n\n\3\n\3\n\3\13\6\13k\n\13\r\13\16\13l\3\f\3\f\3\f\5\f"+
+ "r\n\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\177\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\5\f\u0092"+
+ "\n\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f\u009a\n\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f"+
+ "\u00a2\n\f\3\r\5\r\u00a5\n\r\3\r\3\r\3\r\5\r\u00aa\n\r\3\16\3\16\3\16"+
+ "\3\16\3\16\3\16\3\16\3\16\3\16\3\16\5\16\u00b6\n\16\3\17\3\17\3\17\3\17"+
+ "\5\17\u00bc\n\17\3\17\3\17\3\17\3\17\3\17\5\17\u00c3\n\17\3\17\7\17\u00c6"+
+ "\n\17\f\17\16\17\u00c9\13\17\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\5"+
+ "\20\u00d3\n\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20"+
+ "\3\20\3\20\3\20\3\20\3\20\3\20\3\20\7\20\u00e7\n\20\f\20\16\20\u00ea\13"+
+ "\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\5\20\u00f3\n\20\3\20\3\20\3\20"+
+ "\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20"+
+ "\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20"+
+ "\3\20\3\20\3\20\3\20\3\20\3\20\7\20\u011a\n\20\f\20\16\20\u011d\13\20"+
+ "\3\21\3\21\3\21\7\21\u0122\n\21\f\21\16\21\u0125\13\21\3\22\7\22\u0128"+
+ "\n\22\f\22\16\22\u012b\13\22\3\23\3\23\5\23\u012f\n\23\3\24\3\24\3\24"+
+ "\3\24\5\24\u0135\n\24\3\25\3\25\5\25\u0139\n\25\3\26\3\26\3\26\3\26\3"+
+ "\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3"+
+ "\26\3\26\3\26\3\26\3\26\5\26\u0152\n\26\3\27\3\27\3\27\3\27\3\27\3\27"+
+ "\3\27\3\27\3\27\3\27\5\27\u015e\n\27\3\27\3\27\3\27\3\27\3\27\3\27\7\27"+
+ "\u0166\n\27\f\27\16\27\u0169\13\27\3\27\2\5\34\36,\30\2\4\6\b\n\f\16\20"+
+ "\22\24\26\30\32\34\36 \"$&(*,\2\13\3\2\31\32\3\2\33\37\3\2$%\3\2 !\4\2"+
+ "\26\26\"#\3\2\33\34\3\2$,\4\2\33\34$%\4\2\26\26\"\"\2\u019b\2.\3\2\2\2"+
+ "\4\62\3\2\2\2\68\3\2\2\2\b;\3\2\2\2\n?\3\2\2\2\fQ\3\2\2\2\16S\3\2\2\2"+
+ "\20[\3\2\2\2\22_\3\2\2\2\24j\3\2\2\2\26\u00a1\3\2\2\2\30\u00a4\3\2\2\2"+
+ "\32\u00b5\3\2\2\2\34\u00bb\3\2\2\2\36\u00f2\3\2\2\2 \u011e\3\2\2\2\"\u0129"+
+ "\3\2\2\2$\u012e\3\2\2\2&\u0134\3\2\2\2(\u0136\3\2\2\2*\u0151\3\2\2\2,"+
+ "\u015d\3\2\2\2./\5\6\4\2/\60\5\n\6\2\60\61\7\2\2\3\61\3\3\2\2\2\62\63"+
+ "\5\"\22\2\63\64\7\2\2\3\64\5\3\2\2\2\65\67\5\b\5\2\66\65\3\2\2\2\67:\3"+
+ "\2\2\28\66\3\2\2\289\3\2\2\29\7\3\2\2\2:8\3\2\2\2;<\7\3\2\2<=\7\64\2\2"+
+ "=\t\3\2\2\2>@\5\f\7\2?>\3\2\2\2@A\3\2\2\2A?\3\2\2\2AB\3\2\2\2B\13\3\2"+
+ "\2\2CD\5\34\17\2DE\7@\2\2EG\7\4\2\2FH\5\16\b\2GF\3\2\2\2GH\3\2\2\2HI\3"+
+ "\2\2\2IJ\7\5\2\2JL\7\6\2\2KM\5\24\13\2LK\3\2\2\2LM\3\2\2\2MN\3\2\2\2N"+
+ "O\7\7\2\2OR\3\2\2\2PR\5\22\n\2QC\3\2\2\2QP\3\2\2\2R\r\3\2\2\2SX\5\20\t"+
+ "\2TU\7\b\2\2UW\5\20\t\2VT\3\2\2\2WZ\3\2\2\2XV\3\2\2\2XY\3\2\2\2Y\17\3"+
+ "\2\2\2ZX\3\2\2\2[\\\5\34\17\2\\]\7@\2\2]\21\3\2\2\2^`\7\t\2\2_^\3\2\2"+
+ "\2_`\3\2\2\2`a\3\2\2\2ab\5\34\17\2be\7@\2\2cd\7\n\2\2df\5\36\20\2ec\3"+
+ "\2\2\2ef\3\2\2\2fg\3\2\2\2gh\7\13\2\2h\23\3\2\2\2ik\5\26\f\2ji\3\2\2\2"+
+ "kl\3\2\2\2lj\3\2\2\2lm\3\2\2\2m\25\3\2\2\2n\u00a2\5\22\n\2oq\7\6\2\2p"+
+ "r\5\24\13\2qp\3\2\2\2qr\3\2\2\2rs\3\2\2\2s\u00a2\7\7\2\2tu\5\36\20\2u"+
+ "v\7\13\2\2v\u00a2\3\2\2\2wx\7\f\2\2xy\7\4\2\2yz\5\36\20\2z{\7\5\2\2{~"+
+ "\5\26\f\2|}\7\r\2\2}\177\5\26\f\2~|\3\2\2\2~\177\3\2\2\2\177\u00a2\3\2"+
+ "\2\2\u0080\u0081\7\16\2\2\u0081\u0082\7\4\2\2\u0082\u0083\5\36\20\2\u0083"+
+ "\u0084\7\5\2\2\u0084\u0085\5\26\f\2\u0085\u00a2\3\2\2\2\u0086\u0087\7"+
+ "\17\2\2\u0087\u0088\5\26\f\2\u0088\u0089\7\16\2\2\u0089\u008a\7\4\2\2"+
+ "\u008a\u008b\5\36\20\2\u008b\u008c\7\5\2\2\u008c\u008d\7\13\2\2\u008d"+
+ "\u00a2\3\2\2\2\u008e\u008f\7\20\2\2\u008f\u0091\7\4\2\2\u0090\u0092\5"+
+ "\30\r\2\u0091\u0090\3\2\2\2\u0091\u0092\3\2\2\2\u0092\u0093\3\2\2\2\u0093"+
+ "\u0094\5\32\16\2\u0094\u0095\7\5\2\2\u0095\u0096\5\26\f\2\u0096\u00a2"+
+ "\3\2\2\2\u0097\u0099\7\21\2\2\u0098\u009a\5\36\20\2\u0099\u0098\3\2\2"+
+ "\2\u0099\u009a\3\2\2\2\u009a\u009b\3\2\2\2\u009b\u00a2\7\13\2\2\u009c"+
+ "\u009d\7\22\2\2\u009d\u009e\7\6\2\2\u009e\u009f\5\"\22\2\u009f\u00a0\7"+
+ "\7\2\2\u00a0\u00a2\3\2\2\2\u00a1n\3\2\2\2\u00a1o\3\2\2\2\u00a1t\3\2\2"+
+ "\2\u00a1w\3\2\2\2\u00a1\u0080\3\2\2\2\u00a1\u0086\3\2\2\2\u00a1\u008e"+
+ "\3\2\2\2\u00a1\u0097\3\2\2\2\u00a1\u009c\3\2\2\2\u00a2\27\3\2\2\2\u00a3"+
+ "\u00a5\5\34\17\2\u00a4\u00a3\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\u00a6\3"+
+ "\2\2\2\u00a6\u00a9\7@\2\2\u00a7\u00a8\7\n\2\2\u00a8\u00aa\5\36\20\2\u00a9"+
+ "\u00a7\3\2\2\2\u00a9\u00aa\3\2\2\2\u00aa\31\3\2\2\2\u00ab\u00ac\7\13\2"+
+ "\2\u00ac\u00ad\5\36\20\2\u00ad\u00ae\7\13\2\2\u00ae\u00af\5\36\20\2\u00af"+
+ "\u00b6\3\2\2\2\u00b0\u00b1\7\23\2\2\u00b1\u00b2\5\36\20\2\u00b2\u00b3"+
+ "\7\24\2\2\u00b3\u00b4\5\36\20\2\u00b4\u00b6\3\2\2\2\u00b5\u00ab\3\2\2"+
+ "\2\u00b5\u00b0\3\2\2\2\u00b6\33\3\2\2\2\u00b7\u00b8\b\17\1\2\u00b8\u00bc"+
+ "\7\63\2\2\u00b9\u00ba\7\25\2\2\u00ba\u00bc\7\63\2\2\u00bb\u00b7\3\2\2"+
+ "\2\u00bb\u00b9\3\2\2\2\u00bc\u00c7\3\2\2\2\u00bd\u00be\f\4\2\2\u00be\u00c6"+
+ "\7\26\2\2\u00bf\u00c0\f\3\2\2\u00c0\u00c2\7\27\2\2\u00c1\u00c3\5\36\20"+
+ "\2\u00c2\u00c1\3\2\2\2\u00c2\u00c3\3\2\2\2\u00c3\u00c4\3\2\2\2\u00c4\u00c6"+
+ "\7\30\2\2\u00c5\u00bd\3\2\2\2\u00c5\u00bf\3\2\2\2\u00c6\u00c9\3\2\2\2"+
+ "\u00c7\u00c5\3\2\2\2\u00c7\u00c8\3\2\2\2\u00c8\35\3\2\2\2\u00c9\u00c7"+
+ "\3\2\2\2\u00ca\u00cb\b\20\1\2\u00cb\u00cc\7\4\2\2\u00cc\u00cd\5\36\20"+
+ "\2\u00cd\u00ce\7\5\2\2\u00ce\u00f3\3\2\2\2\u00cf\u00d0\7@\2\2\u00d0\u00d2"+
+ "\7\4\2\2\u00d1\u00d3\5 \21\2\u00d2\u00d1\3\2\2\2\u00d2\u00d3\3\2\2\2\u00d3"+
+ "\u00d4\3\2\2\2\u00d4\u00f3\7\5\2\2\u00d5\u00d6\7\4\2\2\u00d6\u00d7\5\34"+
+ "\17\2\u00d7\u00d8\7\5\2\2\u00d8\u00d9\5\36\20\31\u00d9\u00f3\3\2\2\2\u00da"+
+ "\u00db\t\2\2\2\u00db\u00f3\5\36\20\27\u00dc\u00dd\7\26\2\2\u00dd\u00f3"+
+ "\5\36\20\25\u00de\u00df\t\3\2\2\u00df\u00f3\5\36\20\24\u00e0\u00e1\t\4"+
+ "\2\2\u00e1\u00f3\5\36\20\20\u00e2\u00e3\7\6\2\2\u00e3\u00e8\5\36\20\2"+
+ "\u00e4\u00e5\7\b\2\2\u00e5\u00e7\5\36\20\2\u00e6\u00e4\3\2\2\2\u00e7\u00ea"+
+ "\3\2\2\2\u00e8\u00e6\3\2\2\2\u00e8\u00e9\3\2\2\2\u00e9\u00eb\3\2\2\2\u00ea"+
+ "\u00e8\3\2\2\2\u00eb\u00ec\7\7\2\2\u00ec\u00f3\3\2\2\2\u00ed\u00f3\7@"+
+ "\2\2\u00ee\u00f3\7\67\2\2\u00ef\u00f3\7\64\2\2\u00f0\u00f3\7\65\2\2\u00f1"+
+ "\u00f3\7\66\2\2\u00f2\u00ca\3\2\2\2\u00f2\u00cf\3\2\2\2\u00f2\u00d5\3"+
+ "\2\2\2\u00f2\u00da\3\2\2\2\u00f2\u00dc\3\2\2\2\u00f2\u00de\3\2\2\2\u00f2"+
+ "\u00e0\3\2\2\2\u00f2\u00e2\3\2\2\2\u00f2\u00ed\3\2\2\2\u00f2\u00ee\3\2"+
+ "\2\2\u00f2\u00ef\3\2\2\2\u00f2\u00f0\3\2\2\2\u00f2\u00f1\3\2\2\2\u00f3"+
+ "\u011b\3\2\2\2\u00f4\u00f5\f\23\2\2\u00f5\u00f6\t\5\2\2\u00f6\u011a\5"+
+ "\36\20\24\u00f7\u00f8\f\22\2\2\u00f8\u00f9\t\6\2\2\u00f9\u011a\5\36\20"+
+ "\23\u00fa\u00fb\f\21\2\2\u00fb\u00fc\t\7\2\2\u00fc\u011a\5\36\20\22\u00fd"+
+ "\u00fe\f\17\2\2\u00fe\u00ff\t\b\2\2\u00ff\u011a\5\36\20\20\u0100\u0101"+
+ "\f\16\2\2\u0101\u0102\7\36\2\2\u0102\u011a\5\36\20\17\u0103\u0104\f\r"+
+ "\2\2\u0104\u0105\7-\2\2\u0105\u011a\5\36\20\16\u0106\u0107\f\f\2\2\u0107"+
+ "\u0108\7.\2\2\u0108\u011a\5\36\20\r\u0109\u010a\f\13\2\2\u010a\u010b\7"+
+ "/\2\2\u010b\u011a\5\36\20\f\u010c\u010d\f\n\2\2\u010d\u010e\7\60\2\2\u010e"+
+ "\u011a\5\36\20\13\u010f\u0110\f\t\2\2\u0110\u0111\7\n\2\2\u0111\u011a"+
+ "\5\36\20\t\u0112\u0113\f\30\2\2\u0113\u0114\7\27\2\2\u0114\u0115\5\36"+
+ "\20\2\u0115\u0116\7\30\2\2\u0116\u011a\3\2\2\2\u0117\u0118\f\26\2\2\u0118"+
+ "\u011a\t\2\2\2\u0119\u00f4\3\2\2\2\u0119\u00f7\3\2\2\2\u0119\u00fa\3\2"+
+ "\2\2\u0119\u00fd\3\2\2\2\u0119\u0100\3\2\2\2\u0119\u0103\3\2\2\2\u0119"+
+ "\u0106\3\2\2\2\u0119\u0109\3\2\2\2\u0119\u010c\3\2\2\2\u0119\u010f\3\2"+
+ "\2\2\u0119\u0112\3\2\2\2\u0119\u0117\3\2\2\2\u011a\u011d\3\2\2\2\u011b"+
+ "\u0119\3\2\2\2\u011b\u011c\3\2\2\2\u011c\37\3\2\2\2\u011d\u011b\3\2\2"+
+ "\2\u011e\u0123\5\36\20\2\u011f\u0120\7\b\2\2\u0120\u0122\5\36\20\2\u0121"+
+ "\u011f\3\2\2\2\u0122\u0125\3\2\2\2\u0123\u0121\3\2\2\2\u0123\u0124\3\2"+
+ "\2\2\u0124!\3\2\2\2\u0125\u0123\3\2\2\2\u0126\u0128\5$\23\2\u0127\u0126"+
+ "\3\2\2\2\u0128\u012b\3\2\2\2\u0129\u0127\3\2\2\2\u0129\u012a\3\2\2\2\u012a"+
+ "#\3\2\2\2\u012b\u0129\3\2\2\2\u012c\u012f\5&\24\2\u012d\u012f\5(\25\2"+
+ "\u012e\u012c\3\2\2\2\u012e\u012d\3\2\2\2\u012f%\3\2\2\2\u0130\u0131\7"+
+ "@\2\2\u0131\u0135\7\23\2\2\u0132\u0133\7\35\2\2\u0133\u0135\7\23\2\2\u0134"+
+ "\u0130\3\2\2\2\u0134\u0132\3\2\2\2\u0135\'\3\2\2\2\u0136\u0138\7\62\2"+
+ "\2\u0137\u0139\5*\26\2\u0138\u0137\3\2\2\2\u0138\u0139\3\2\2\2\u0139)"+
+ "\3\2\2\2\u013a\u0152\5,\27\2\u013b\u013c\7\61\2\2\u013c\u0152\5,\27\2"+
+ "\u013d\u013e\5,\27\2\u013e\u013f\7\b\2\2\u013f\u0140\7@\2\2\u0140\u0152"+
+ "\3\2\2\2\u0141\u0142\7\4\2\2\u0142\u0143\5,\27\2\u0143\u0144\7\5\2\2\u0144"+
+ "\u0145\7\b\2\2\u0145\u0146\7@\2\2\u0146\u0152\3\2\2\2\u0147\u0148\7\4"+
+ "\2\2\u0148\u0149\5,\27\2\u0149\u014a\7\b\2\2\u014a\u014b\7@\2\2\u014b"+
+ "\u014c\7\5\2\2\u014c\u0152\3\2\2\2\u014d\u014e\7\4\2\2\u014e\u014f\5,"+
+ "\27\2\u014f\u0150\7\5\2\2\u0150\u0152\3\2\2\2\u0151\u013a\3\2\2\2\u0151"+
+ "\u013b\3\2\2\2\u0151\u013d\3\2\2\2\u0151\u0141\3\2\2\2\u0151\u0147\3\2"+
+ "\2\2\u0151\u014d\3\2\2\2\u0152+\3\2\2\2\u0153\u0154\b\27\1\2\u0154\u0155"+
+ "\t\t\2\2\u0155\u015e\5,\27\n\u0156\u015e\7@\2\2\u0157\u015e\7A\2\2\u0158"+
+ "\u0159\7\6\2\2\u0159\u015a\7@\2\2\u015a\u015e\7\7\2\2\u015b\u015e\7\67"+
+ "\2\2\u015c\u015e\7\65\2\2\u015d\u0153\3\2\2\2\u015d\u0156\3\2\2\2\u015d"+
+ "\u0157\3\2\2\2\u015d\u0158\3\2\2\2\u015d\u015b\3\2\2\2\u015d\u015c\3\2"+
+ "\2\2\u015e\u0167\3\2\2\2\u015f\u0160\f\t\2\2\u0160\u0161\t\n\2\2\u0161"+
+ "\u0166\5,\27\n\u0162\u0163\f\b\2\2\u0163\u0164\t\7\2\2\u0164\u0166\5,"+
+ "\27\t\u0165\u015f\3\2\2\2\u0165\u0162\3\2\2\2\u0166\u0169\3\2\2\2\u0167"+
+ "\u0165\3\2\2\2\u0167\u0168\3\2\2\2\u0168-\3\2\2\2\u0169\u0167\3\2\2\2"+
+ "%8AGLQX_elq~\u0091\u0099\u00a1\u00a4\u00a9\u00b5\u00bb\u00c2\u00c5\u00c7"+
+ "\u00d2\u00e8\u00f2\u0119\u011b\u0123\u0129\u012e\u0134\u0138\u0151\u015d"+
+ "\u0165\u0167";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
diff --git a/src/main/java/dk/camelot64/kickc/parser/KickCVisitor.java b/src/main/java/dk/camelot64/kickc/parser/KickCVisitor.java
index ddc08d25d..16ee589c2 100644
--- a/src/main/java/dk/camelot64/kickc/parser/KickCVisitor.java
+++ b/src/main/java/dk/camelot64/kickc/parser/KickCVisitor.java
@@ -92,13 +92,6 @@ public interface KickCVisitor extends ParseTreeVisitor {
* @return the visitor result
*/
T visitStmtBlock(KickCParser.StmtBlockContext ctx);
- /**
- * Visit a parse tree produced by the {@code stmtAssignment}
- * labeled alternative in {@link KickCParser#stmt}.
- * @param ctx the parse tree
- * @return the visitor result
- */
- T visitStmtAssignment(KickCParser.StmtAssignmentContext ctx);
/**
* Visit a parse tree produced by the {@code stmtExpr}
* labeled alternative in {@link KickCParser#stmt}.
@@ -198,40 +191,12 @@ public interface KickCVisitor extends ParseTreeVisitor {
*/
T visitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
- * Visit a parse tree produced by the {@code lvalueName}
- * labeled alternative in {@link KickCParser#lvalue}.
+ * Visit a parse tree produced by the {@code exprPtr}
+ * labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
- T visitLvalueName(KickCParser.LvalueNameContext ctx);
- /**
- * Visit a parse tree produced by the {@code lvaluePtr}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- * @return the visitor result
- */
- T visitLvaluePtr(KickCParser.LvaluePtrContext ctx);
- /**
- * Visit a parse tree produced by the {@code lvaluePtrExpr}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- * @return the visitor result
- */
- T visitLvaluePtrExpr(KickCParser.LvaluePtrExprContext ctx);
- /**
- * Visit a parse tree produced by the {@code lvalueArray}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- * @return the visitor result
- */
- T visitLvalueArray(KickCParser.LvalueArrayContext ctx);
- /**
- * Visit a parse tree produced by the {@code lvalueLoHi}
- * labeled alternative in {@link KickCParser#lvalue}.
- * @param ctx the parse tree
- * @return the visitor result
- */
- T visitLvalueLoHi(KickCParser.LvalueLoHiContext ctx);
+ T visitExprPtr(KickCParser.ExprPtrContext ctx);
/**
* Visit a parse tree produced by the {@code exprPreMod}
* labeled alternative in {@link KickCParser#expr}.
@@ -323,6 +288,13 @@ public interface KickCVisitor extends ParseTreeVisitor {
* @return the visitor result
*/
T visitExprId(KickCParser.ExprIdContext ctx);
+ /**
+ * Visit a parse tree produced by the {@code exprAssignment}
+ * labeled alternative in {@link KickCParser#expr}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitExprAssignment(KickCParser.ExprAssignmentContext ctx);
/**
* Visit a parse tree produced by the {@code exprArray}
* labeled alternative in {@link KickCParser#expr}.
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1AssertNoLValueIntermediate.java b/src/main/java/dk/camelot64/kickc/passes/Pass1AssertNoLValueIntermediate.java
new file mode 100644
index 000000000..bb50e5a08
--- /dev/null
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass1AssertNoLValueIntermediate.java
@@ -0,0 +1,32 @@
+package dk.camelot64.kickc.passes;
+
+import dk.camelot64.kickc.model.*;
+
+/**
+ * Asserts that all intermediate lvalues have been replaced by something else
+ */
+public class Pass1AssertNoLValueIntermediate extends Pass1Base {
+
+ public Pass1AssertNoLValueIntermediate(Program program) {
+ super(program);
+ }
+
+ @Override
+ public boolean executeStep() {
+ for (ControlFlowBlock block : getGraph().getAllBlocks()) {
+ for (Statement statement : block.getStatements()) {
+ if(statement instanceof StatementLValue) {
+ LValue lValue = ((StatementLValue) statement).getlValue();
+ if(lValue instanceof LvalueIntermediate) {
+ VariableRef intermediateVar = ((LvalueIntermediate) lValue).getVariable();
+ StatementAssignment assignment = getGraph().getAssignment(intermediateVar);
+ throw new CompileError("Error! LValue is illegal. "+statement+" - definition of lValue "+assignment);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+
+}
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1FixLValuesLoHi.java b/src/main/java/dk/camelot64/kickc/passes/Pass1FixLValuesLoHi.java
new file mode 100644
index 000000000..4e93d29bc
--- /dev/null
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass1FixLValuesLoHi.java
@@ -0,0 +1,65 @@
+package dk.camelot64.kickc.passes;
+
+import dk.camelot64.kickc.model.*;
+
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * Replaces all LValue intermediate lo/hi-assignments with a separate assignment to the modified variable.
+ *
Example: <plotter = x & 8
+ *
Becomes: $1 =x & 8 , plotter = plotter lo= $1
+ */
+public class Pass1FixLValuesLoHi extends Pass1Base {
+
+ public Pass1FixLValuesLoHi(Program program) {
+ super(program);
+ }
+
+ @Override
+ boolean executeStep() {
+ ProgramScope programScope = getProgram().getScope();
+ for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) {
+ List statements = block.getStatements();
+ ListIterator statementsIt = statements.listIterator();
+ while (statementsIt.hasNext()) {
+ Statement statement = statementsIt.next();
+ if (statement instanceof StatementLValue && ((StatementLValue) statement).getlValue() instanceof LvalueIntermediate) {
+ StatementLValue statementLValue = (StatementLValue) statement;
+ LvalueIntermediate intermediate = (LvalueIntermediate) statementLValue.getlValue();
+ StatementAssignment intermediateAssignment = getProgram().getGraph().getAssignment(intermediate.getVariable());
+ if (Operator.LOWBYTE.equals(intermediateAssignment.getOperator()) && intermediateAssignment.getrValue1() == null) {
+ // Found assignment to an intermediate low byte lValue x = ...
+ fixLoHiLValue(programScope, statementsIt, statementLValue, intermediate, intermediateAssignment, Operator.SET_HIBYTE);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private void fixLoHiLValue(
+ ProgramScope programScope,
+ ListIterator statementsIt,
+ StatementLValue statementLValue,
+ LvalueIntermediate intermediate,
+ StatementAssignment intermediateAssignment,
+ Operator loHiOperator) {
+ VariableRef loHiVar = (VariableRef) intermediateAssignment.getrValue2();
+ Variable intermediateVar = programScope.getVariable(intermediate.getVariable());
+ Scope currentScope = intermediateVar.getScope();
+ // Let assignment put value into a tmp Var
+ VariableIntermediate tmpVar = currentScope.addVariableIntermediate();
+ VariableRef tmpVarRef = tmpVar.getRef();
+ statementLValue.setlValue(tmpVarRef);
+ SymbolTypeInference.inferLValue(programScope, statementLValue);
+ // Insert an extra "set low" assignment statement
+ Statement setLoHiAssignment = new StatementAssignment(loHiVar, loHiVar, loHiOperator, tmpVarRef);
+ statementsIt.add(setLoHiAssignment);
+ getLog().append("Fixing lo/hi-lvalue with new tmpVar " + tmpVarRef + " " + statementLValue.toString());
+ }
+
+}
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1FixLvalueLoHi.java b/src/main/java/dk/camelot64/kickc/passes/Pass1FixLvalueLoHi.java
deleted file mode 100644
index c8f4d5766..000000000
--- a/src/main/java/dk/camelot64/kickc/passes/Pass1FixLvalueLoHi.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package dk.camelot64.kickc.passes;
-
-import dk.camelot64.kickc.model.*;
-
-import java.util.Stack;
-
-/**
- * Replaces all LValueLoHi with a separate assignment to the modified variable.
- *
Example: <plotter = x & 8
- *
Becomes: $1 =x & 8 , plotter = plotter lo= $1
- */
-public class Pass1FixLvalueLoHi extends Pass1Base {
-
- public Pass1FixLvalueLoHi(Program program) {
- super(program);
- }
-
- @Override
- boolean executeStep() {
- Stack scopeStack = new Stack<>();
- scopeStack.push(getScope());
- StatementSequence fixedSequence = new StatementSequence();
- for (Statement statement : getProgram().getStatementSequence().getStatements()) {
- if (statement instanceof StatementAssignment) {
- StatementAssignment assignment = (StatementAssignment) statement;
- if (assignment.getlValue() instanceof LvalueLoHiByte) {
- LvalueLoHiByte loHiByte = (LvalueLoHiByte) assignment.getlValue();
- if (assignment.getOperator() != null || assignment.getrValue1()!=null) {
- Scope currentScope = scopeStack.peek();
- VariableIntermediate tmpVar = currentScope.addVariableIntermediate();
- VariableRef tmpVarRef = tmpVar.getRef();
- Statement tmpAssignment = new StatementAssignment(tmpVarRef, assignment.getrValue1(), assignment.getOperator(), assignment.getrValue2());
- fixedSequence.addStatement(tmpAssignment);
- Statement setLoHiAssignment = new StatementAssignment(loHiByte.getVariable(), loHiByte.getVariable(), loHiByte.getOperator(), tmpVarRef);
- fixedSequence.addStatement(setLoHiAssignment);
- getLog().append("Fixing lo/hi-lvalue with new tmpVar " + tmpVarRef + " " + assignment.toString());
- } else {
- Statement setLoHiAssignment = new StatementAssignment(loHiByte.getVariable(), loHiByte.getVariable(), loHiByte.getOperator(), assignment.getrValue2());
- fixedSequence.addStatement(setLoHiAssignment);
- getLog().append("Fixing lo/hi-lvalue " + assignment.toString());
- }
- } else {
- fixedSequence.addStatement(statement);
- }
- } else {
- fixedSequence.addStatement(statement);
- }
- if (statement instanceof StatementProcedureBegin) {
- ProcedureRef procedureRef = ((StatementProcedureBegin) statement).getProcedure();
- Procedure procedure = getScope().getProcedure(procedureRef);
- scopeStack.push(procedure);
- } else if (statement instanceof StatementProcedureEnd) {
- scopeStack.pop();
- }
- }
- getProgram().setStatementSequence(fixedSequence);
- return false;
- }
-
-}
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1TypeInference.java b/src/main/java/dk/camelot64/kickc/passes/Pass1TypeInference.java
index 23f6817ad..0eddedf5f 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass1TypeInference.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass1TypeInference.java
@@ -29,27 +29,9 @@ public class Pass1TypeInference extends Pass1Base {
scopes.pop();
} else if (statement instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) statement;
- LValue lValue = assignment.getlValue();
- if (lValue instanceof VariableRef) {
- Variable symbol = programScope.getVariable((VariableRef) lValue);
- if (SymbolType.VAR.equals(symbol.getType())) {
- // Unresolved symbol - perform inference
- Operator operator = assignment.getOperator();
- if (operator == null || assignment.getrValue1() == null) {
- // Copy operation or Unary operation
- RValue rValue = assignment.getrValue2();
- SymbolType type = SymbolTypeInference.inferType(programScope, operator, rValue);
- symbol.setTypeInferred(type);
- } else {
- // Binary operation
- SymbolType type = SymbolTypeInference.inferType(programScope, assignment.getrValue1(), assignment.getOperator(), assignment.getrValue2());
- symbol.setTypeInferred(type);
- }
- }
- }
+ SymbolTypeInference.inferAssignmentLValue(programScope, assignment);
} else if(statement instanceof StatementCall) {
StatementCall call = (StatementCall) statement;
- LValue lValue = call.getlValue();
String procedureName = call.getProcedureName();
Procedure procedure = scopes.peek().getProcedure(procedureName);
if(procedure==null) {
@@ -59,10 +41,7 @@ public class Pass1TypeInference extends Pass1Base {
if(procedure.getParameters().size()!=call.getParameters().size()) {
throw new CompileError("Wrong number of parameters in call. Expected " +procedure.getParameters().size()+". "+statement.toString());
}
- if(lValue instanceof VariableRef) {
- Variable lValueVar = programScope.getVariable((VariableRef) lValue);
- lValueVar.setTypeInferred(procedure.getReturnType());
- }
+ SymbolTypeInference.inferCallLValue(programScope, (StatementCall) statement);
}
}
return false;
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantAdditionElimination.java b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantAdditionElimination.java
index feb5a393d..1501dce2f 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantAdditionElimination.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantAdditionElimination.java
@@ -39,8 +39,15 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
if (statement instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) statement;
if(assignment.getlValue() instanceof PointerDereferenceIndexed) {
- optimized |= optimizePointerDereferenceIndexed(assignment);
+ optimized |= optimizePointerDereferenceIndexed(new VariableReplacer.ReplacableLValue(assignment));
}
+ if(assignment.getrValue1() instanceof PointerDereferenceIndexed) {
+ optimized |= optimizePointerDereferenceIndexed(new VariableReplacer.ReplacableRValue1(assignment));
+ }
+ if(assignment.getrValue2() instanceof PointerDereferenceIndexed) {
+ optimized |= optimizePointerDereferenceIndexed(new VariableReplacer.ReplacableRValue2(assignment));
+ }
+
Operator operator = assignment.getOperator();
if (operator != null) {
switch (operator.getOperator()) {
@@ -52,20 +59,28 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
break;
}
}
+ } else if(statement instanceof StatementConditionalJump) {
+ StatementConditionalJump jump = (StatementConditionalJump) statement;
+ if(jump.getrValue1() instanceof PointerDereferenceIndexed) {
+ optimized |= optimizePointerDereferenceIndexed(new VariableReplacer.ReplacableCondRValue1(jump));
+ }
+ if(jump.getrValue2() instanceof PointerDereferenceIndexed) {
+ optimized |= optimizePointerDereferenceIndexed(new VariableReplacer.ReplacableCondRValue2(jump));
+ }
}
}
}
return optimized;
}
- private boolean optimizePointerDereferenceIndexed(StatementAssignment assignment) {
- PointerDereferenceIndexed pointerDereferenceIndexed = (PointerDereferenceIndexed) assignment.getlValue();
+ private boolean optimizePointerDereferenceIndexed(VariableReplacer.ReplacableValue value) {
+ PointerDereferenceIndexed pointerDereferenceIndexed = (PointerDereferenceIndexed) value.get();
if(pointerDereferenceIndexed.getPointer() instanceof ConstantValue && pointerDereferenceIndexed.getIndex() instanceof ConstantValue) {
ConstantValue ptrConstant = (ConstantValue) pointerDereferenceIndexed.getPointer();
ConstantValue idxConstant = (ConstantValue) pointerDereferenceIndexed.getIndex();
ConstantValue newPtr = new ConstantBinary(ptrConstant, Operator.PLUS, idxConstant);
- assignment.setlValue(new PointerDereferenceSimple(newPtr));
- getLog().append("Consolidated assigned array index constant in assignment " + assignment.getlValue());
+ value.set(new PointerDereferenceSimple(newPtr));
+ getLog().append("Consolidated array index constant in " + value.get().toString());
return true;
}
if(pointerDereferenceIndexed.getPointer() instanceof ConstantValue && pointerDereferenceIndexed.getIndex() instanceof VariableRef) {
@@ -75,7 +90,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
ConstantValue ptrConstant = (ConstantValue) pointerDereferenceIndexed.getPointer();
ConstantValue newPtr = new ConstantBinary(ptrConstant, Operator.PLUS, consolidated);
pointerDereferenceIndexed.setPointer(newPtr);
- getLog().append("Consolidated assigned array index constant in assignment " + assignment.getlValue());
+ getLog().append("Consolidated array index constant in assignment " + value.get().toString());
return true;
}
}
diff --git a/src/main/java/dk/camelot64/kickc/passes/StatementSequenceGenerator.java b/src/main/java/dk/camelot64/kickc/passes/StatementSequenceGenerator.java
index 122970785..1c6612746 100644
--- a/src/main/java/dk/camelot64/kickc/passes/StatementSequenceGenerator.java
+++ b/src/main/java/dk/camelot64/kickc/passes/StatementSequenceGenerator.java
@@ -396,58 +396,6 @@ public class StatementSequenceGenerator extends KickCBaseVisitor