mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-09 03:30:40 +00:00
Moved expression operators to separate classes.
This commit is contained in:
parent
7876b98573
commit
73afb3d1be
@ -1,53 +1,58 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
import dk.camelot64.kickc.model.operators.*;
|
||||
|
||||
/**
|
||||
* An Operator. The operation performed on the rvalues in a Statement.
|
||||
*/
|
||||
public class Operator {
|
||||
|
||||
public static final Operator INCREMENT = new Operator("++", "_inc_", Type.UNARY, 1);
|
||||
public static final Operator DECREMENT = new Operator("--", "_dec_", Type.UNARY, 1);
|
||||
public static final Operator POS = new Operator("+", "_pos_", Type.UNARY, 2);
|
||||
public static final Operator NEG = new Operator("-", "_neg_", Type.UNARY, 2);
|
||||
public static final Operator BOOL_NOT = new Operator("~", "_not_", Type.UNARY, 2);
|
||||
public static final Operator LOGIC_NOT = new Operator("!", "_not_", Type.UNARY, 2);
|
||||
public static final Operator DEREF = new Operator("*", "_deref_", Type.UNARY, 2);
|
||||
public static final Operator ADDRESS_OF = new Operator("&", "_addr_", Type.UNARY, 2);
|
||||
public static final Operator WORD = new Operator("w=", "_word_", Type.BINARY, 2);
|
||||
public static final Operator DWORD = new Operator("dw=", "_dword_", Type.BINARY, 2);
|
||||
public static final Operator DEREF_IDX = new Operator("*idx", "_derefidx_", Type.BINARY, 2);
|
||||
public static final Operator SET_LOWBYTE = new Operator("lo=", "_setlo_", Type.BINARY, 2);
|
||||
public static final Operator SET_HIBYTE = new Operator("hi=", "_sethi_", Type.BINARY, 2);
|
||||
public static final Operator CAST_BYTE = new Operator("((byte))", "_byte_", Type.UNARY, 2);
|
||||
public static final Operator CAST_SBYTE = new Operator("((signed byte))", "_sbyte_", Type.UNARY, 2);
|
||||
public static final Operator CAST_WORD = new Operator("((word))", "_word_", Type.UNARY, 2);
|
||||
public static final Operator CAST_SWORD = new Operator("((signed word))", "_sword_", Type.UNARY, 2);
|
||||
public static final Operator CAST_DWORD = new Operator("((dword))", "_dword_", Type.UNARY, 2);
|
||||
public static final Operator CAST_SDWORD = new Operator("((signed dword))", "_sdword_", Type.UNARY, 2);
|
||||
public static final Operator CAST_PTRBY = new Operator("((byte*))", "_ptrby_", Type.UNARY, 2);
|
||||
public static final Operator MULTIPLY = new Operator("*", "_mul_", Type.BINARY, 3);
|
||||
public static final Operator DIVIDE = new Operator("/", "_div_", Type.BINARY, 3);
|
||||
public static final Operator PLUS = new Operator("+", "_plus_", Type.BINARY, 4);
|
||||
public static final Operator MINUS = new Operator("-", "_minus_", Type.BINARY, 4);
|
||||
public static final Operator SHIFT_LEFT = new Operator("<<", "_rol_", Type.BINARY, 5);
|
||||
public static final Operator SHIFT_RIGHT = new Operator(">>", "_ror_", Type.BINARY, 5);
|
||||
public static final Operator LOWBYTE = new Operator("<", "_lo_", Type.UNARY, 6);
|
||||
public static final Operator HIBYTE = new Operator(">", "_hi_", Type.UNARY, 6);
|
||||
public static final Operator LT = new Operator("<", "_lt_", Type.BINARY, 7);
|
||||
public static final Operator LE = new Operator("<=", "_le_", Type.BINARY, 7);
|
||||
public static final Operator GT = new Operator(">", "_gt_", Type.BINARY, 7);
|
||||
public static final Operator GE = new Operator(">=", "_ge_", Type.BINARY, 7);
|
||||
public static final Operator EQ = new Operator("==", "_eq_", Type.BINARY, 8);
|
||||
public static final Operator NEQ = new Operator("!=", "_neq_", Type.BINARY, 8);
|
||||
public static final Operator BOOL_AND = new Operator("&", "_band_", Type.BINARY, 9);
|
||||
public static final Operator BOOL_XOR = new Operator("^", "_bxor_", Type.BINARY, 10);
|
||||
public static final Operator BOOL_OR = new Operator("|", "_bor_", Type.BINARY, 11);
|
||||
public static final Operator LOGIC_AND = new Operator("&&", "_and_", Type.BINARY, 12);
|
||||
public static final Operator LOGIC_OR = new Operator("||", "_or_", Type.BINARY, 13);
|
||||
public static final Operator INCREMENT = new OperatorIncrement(1);
|
||||
public static final Operator DECREMENT = new OperatorDecrement(1);
|
||||
public static final Operator POS = new OperatorPos(2);
|
||||
public static final Operator NEG = new OperatorNeg(2);
|
||||
public static final Operator BOOL_NOT = new OperatorBoolNot(2);
|
||||
public static final Operator LOGIC_NOT = new OperatorLogicNot(2);
|
||||
public static final Operator DEREF = new OperatorDeref(2);
|
||||
public static final Operator ADDRESS_OF = new OperatorAddressOf(2);
|
||||
public static final Operator WORD = new OperatorWord(2);
|
||||
public static final Operator DWORD = new OperatorDWord(2);
|
||||
public static final Operator DEREF_IDX = new OperatorDerefIdx(2);
|
||||
public static final Operator SET_LOWBYTE = new OperatorSetLow(2);
|
||||
public static final Operator SET_HIBYTE = new OperatorSetHigh(2);
|
||||
public static final Operator CAST_BYTE = new OperatorCastByte(2);
|
||||
public static final Operator CAST_SBYTE = new OperatorCastSByte(2);
|
||||
public static final Operator CAST_WORD = new OperatorCastWord(2);
|
||||
public static final Operator CAST_SWORD = new OperatorCastSWord(2);
|
||||
public static final Operator CAST_DWORD = new OperatorCastDWord(2);
|
||||
public static final Operator CAST_SDWORD = new OperatorCastSDWord(2);
|
||||
public static final Operator CAST_PTRBY = new OperatorCastPtrByte(2);
|
||||
public static final Operator MULTIPLY = new OperatorMultiply(3);
|
||||
public static final Operator DIVIDE = new OperatorDivide(3);
|
||||
public static final Operator PLUS = new OperatorPlus(4);
|
||||
public static final Operator MINUS = new OperatorMinus(4);
|
||||
public static final Operator SHIFT_LEFT = new OperatorShiftLeft(5);
|
||||
public static final Operator SHIFT_RIGHT = new OperatorShiftRight(5);
|
||||
public static final Operator LOWBYTE = new OperatorGetLow(6);
|
||||
public static final Operator HIBYTE = new OperatorGetHigh(6);
|
||||
public static final Operator LT = new OperatorLessThan(7);
|
||||
public static final Operator LE = new OperatorLessThanEqual(7);
|
||||
public static final Operator GT = new OperatorGreaterThan(7);
|
||||
public static final Operator GE = new OperatorGreaterThanEqual(7);
|
||||
public static final Operator EQ = new OperatorEqual(8);
|
||||
public static final Operator NEQ = new OperatorNotEqual(8);
|
||||
public static final Operator BOOL_AND = new OperatorBoolAnd(9);
|
||||
public static final Operator BOOL_XOR = new OperatorBoolXor(10);
|
||||
public static final Operator BOOL_OR = new OperatorBoolOr(11);
|
||||
public static final Operator LOGIC_AND = new OperatorLogicAnd(12);
|
||||
public static final Operator LOGIC_OR = new OperatorLogicOr(13);
|
||||
|
||||
|
||||
private String operator;
|
||||
private int precedence;
|
||||
private Type type;
|
||||
private String asmOperator;
|
||||
|
||||
public Operator(String operator, String asmOperator, Type type, int precedence) {
|
||||
this.operator = operator;
|
||||
this.precedence = precedence;
|
||||
|
@ -0,0 +1,8 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
/** A binary expression operator */
|
||||
public class OperatorBinary extends Operator {
|
||||
public OperatorBinary(String operator, String asmOperator, int precedence) {
|
||||
super(operator, asmOperator, Type.BINARY, precedence);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
/** A unary expression operator */
|
||||
public class OperatorUnary extends Operator {
|
||||
public OperatorUnary(String operator, String asmOperator, int precedence) {
|
||||
super(operator, asmOperator, Type.UNARY, precedence);
|
||||
}
|
||||
}
|
@ -123,12 +123,7 @@ public class PhiTransitions {
|
||||
Collections.reverse(phiVariables);
|
||||
for(StatementPhiBlock.PhiVariable phiVariable : phiVariables) {
|
||||
List<StatementPhiBlock.PhiRValue> phiRValues = new ArrayList<>(phiVariable.getValues());
|
||||
Collections.sort(phiRValues, new Comparator<StatementPhiBlock.PhiRValue>() {
|
||||
@Override
|
||||
public int compare(StatementPhiBlock.PhiRValue o1, StatementPhiBlock.PhiRValue o2) {
|
||||
return o1.getPredecessor().getFullName().compareTo(o2.getPredecessor().getFullName());
|
||||
}
|
||||
});
|
||||
Collections.sort(phiRValues, Comparator.comparing(o -> o.getPredecessor().getFullName()));
|
||||
for(StatementPhiBlock.PhiRValue phiRValue : phiRValues) {
|
||||
if(phiRValue.getPredecessor().equals(fromBlock.getLabel())) {
|
||||
this.assignments.add(new PhiTransition.PhiAssignment(phiVariable, phiRValue, nextIdx++));
|
||||
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Address-of Operator (&p) */
|
||||
public class OperatorAddressOf extends OperatorUnary {
|
||||
|
||||
public OperatorAddressOf(int precedence) {
|
||||
super("&", "_addr_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary boolean and Operator ( x & y ) */
|
||||
public class OperatorBoolAnd extends OperatorBinary {
|
||||
|
||||
public OperatorBoolAnd(int precedence) {
|
||||
super("&", "_band_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Boolean Not operator (~b) */
|
||||
public class OperatorBoolNot extends OperatorUnary {
|
||||
|
||||
public OperatorBoolNot(int precedence) {
|
||||
super("~", "_not_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary boolean or Operator ( x | y ) */
|
||||
public class OperatorBoolOr extends OperatorBinary {
|
||||
|
||||
public OperatorBoolOr(int precedence) {
|
||||
super("|", "_bor_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary boolean exclusive or Operator ( x ^ y ) */
|
||||
public class OperatorBoolXor extends OperatorBinary {
|
||||
|
||||
public OperatorBoolXor(int precedence) {
|
||||
super("^", "_bxor_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Cast to byte operator ( (byte) x ) */
|
||||
public class OperatorCastByte extends OperatorUnary {
|
||||
|
||||
public OperatorCastByte(int precedence) {
|
||||
super("((byte))", "_byte_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Cast to double word operator ( (dword) x ) */
|
||||
public class OperatorCastDWord extends OperatorUnary {
|
||||
|
||||
public OperatorCastDWord(int precedence) {
|
||||
super("((dword))", "_dword_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Cast to byte pointer operator ( (byte*) x ) */
|
||||
public class OperatorCastPtrByte extends OperatorUnary {
|
||||
|
||||
public OperatorCastPtrByte(int precedence) {
|
||||
super("((byte*))", "_ptrby_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Cast to signed byte operator ( (signed byte) x ) */
|
||||
public class OperatorCastSByte extends OperatorUnary {
|
||||
|
||||
public OperatorCastSByte(int precedence) {
|
||||
super("((signed byte))", "_sbyte_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Cast to signed double word operator ( (signed dword) x ) */
|
||||
public class OperatorCastSDWord extends OperatorUnary {
|
||||
|
||||
public OperatorCastSDWord(int precedence) {
|
||||
super("((signed dword))", "_sdword_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Cast to signed word operator ( (signed word) x ) */
|
||||
public class OperatorCastSWord extends OperatorUnary {
|
||||
|
||||
public OperatorCastSWord(int precedence) {
|
||||
super("((signed word))", "_sword_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Cast to word operator ( (word) x ) */
|
||||
public class OperatorCastWord extends OperatorUnary {
|
||||
|
||||
public OperatorCastWord(int precedence) {
|
||||
super("((word))", "_word_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary DWord Constructor operator (w dw= w) */
|
||||
public class OperatorDWord extends OperatorBinary {
|
||||
|
||||
public OperatorDWord(int precedence) {
|
||||
super("dw=", "_dword_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Decrement operator (--) */
|
||||
public class OperatorDecrement extends OperatorUnary {
|
||||
|
||||
public OperatorDecrement(int precedence) {
|
||||
super("--", "_dec_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Pointer Dereference Operator (*p) */
|
||||
public class OperatorDeref extends OperatorUnary {
|
||||
|
||||
public OperatorDeref(int precedence) {
|
||||
super("*", "_deref_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary Pointer Dereference with an index Operator ( p[i] / *(p+i) ) */
|
||||
public class OperatorDerefIdx extends OperatorBinary {
|
||||
|
||||
public OperatorDerefIdx(int precedence) {
|
||||
super("*idx=", "_derefidx_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary division Operator ( x / y ) */
|
||||
public class OperatorDivide extends OperatorBinary {
|
||||
|
||||
public OperatorDivide(int precedence) {
|
||||
super("/", "_div_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary equal Operator ( x == y ) */
|
||||
public class OperatorEqual extends OperatorBinary {
|
||||
|
||||
public OperatorEqual(int precedence) {
|
||||
super("==", "_eq_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary get high operator (>b) */
|
||||
public class OperatorGetHigh extends OperatorUnary {
|
||||
|
||||
public OperatorGetHigh(int precedence) {
|
||||
super(">", "_hi_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary get low operator (<b) */
|
||||
public class OperatorGetLow extends OperatorUnary {
|
||||
|
||||
public OperatorGetLow(int precedence) {
|
||||
super("<", "_lo_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary greater-than Operator ( x > y ) */
|
||||
public class OperatorGreaterThan extends OperatorBinary {
|
||||
|
||||
public OperatorGreaterThan(int precedence) {
|
||||
super(">", "_gt_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary greater-than-equal Operator ( x >= y ) */
|
||||
public class OperatorGreaterThanEqual extends OperatorBinary {
|
||||
|
||||
public OperatorGreaterThanEqual(int precedence) {
|
||||
super(">=", "_ge_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Increment operator (++) */
|
||||
public class OperatorIncrement extends OperatorUnary {
|
||||
|
||||
public OperatorIncrement(int precedence) {
|
||||
super("++", "_inc_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary less-than Operator ( x < y ) */
|
||||
public class OperatorLessThan extends OperatorBinary {
|
||||
|
||||
public OperatorLessThan(int precedence) {
|
||||
super("<", "_lt_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary less-than-equal Operator ( x <= y ) */
|
||||
public class OperatorLessThanEqual extends OperatorBinary {
|
||||
|
||||
public OperatorLessThanEqual(int precedence) {
|
||||
super("<=", "_le_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary logic and Operator ( x && y ) */
|
||||
public class OperatorLogicAnd extends OperatorBinary {
|
||||
|
||||
public OperatorLogicAnd(int precedence) {
|
||||
super("&&", "_and_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Logic Not operator (!b) */
|
||||
public class OperatorLogicNot extends OperatorUnary {
|
||||
|
||||
public OperatorLogicNot(int precedence) {
|
||||
super("!", "_not_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary logic or Operator ( x || y ) */
|
||||
public class OperatorLogicOr extends OperatorBinary {
|
||||
|
||||
public OperatorLogicOr(int precedence) {
|
||||
super("||", "_or_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary minus Operator ( x - y ) */
|
||||
public class OperatorMinus extends OperatorBinary {
|
||||
|
||||
public OperatorMinus(int precedence) {
|
||||
super("-", "_minus_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary multiply Operator ( x * y ) */
|
||||
public class OperatorMultiply extends OperatorBinary {
|
||||
|
||||
public OperatorMultiply(int precedence) {
|
||||
super("*", "_mul_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Negative operator (-) */
|
||||
public class OperatorNeg extends OperatorUnary {
|
||||
|
||||
public OperatorNeg(int precedence) {
|
||||
super("-", "_neg_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary not-equal Operator ( x != y ) */
|
||||
public class OperatorNotEqual extends OperatorBinary {
|
||||
|
||||
public OperatorNotEqual(int precedence) {
|
||||
super("!=", "_neq_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary plus Operator ( x + y ) */
|
||||
public class OperatorPlus extends OperatorBinary {
|
||||
|
||||
public OperatorPlus(int precedence) {
|
||||
super("+", "_plus_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorUnary;
|
||||
|
||||
/** Unary Positive operator (+) */
|
||||
public class OperatorPos extends OperatorUnary {
|
||||
|
||||
public OperatorPos(int precedence) {
|
||||
super("+", "_pos_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary SetHighByte Operator ( w hi= b ) */
|
||||
public class OperatorSetHigh extends OperatorBinary {
|
||||
|
||||
public OperatorSetHigh(int precedence) {
|
||||
super("hi=", "_sethi_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary SetLowByte Operator ( w lo= b ) */
|
||||
public class OperatorSetLow extends OperatorBinary {
|
||||
|
||||
public OperatorSetLow(int precedence) {
|
||||
super("lo=", "_setlo_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary shift left Operator ( x << n ) */
|
||||
public class OperatorShiftLeft extends OperatorBinary {
|
||||
|
||||
public OperatorShiftLeft(int precedence) {
|
||||
super("<<", "_rol_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary shift right Operator ( x >> n ) */
|
||||
public class OperatorShiftRight extends OperatorBinary {
|
||||
|
||||
public OperatorShiftRight(int precedence) {
|
||||
super(">>", "_ror_", precedence);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.OperatorBinary;
|
||||
|
||||
/** Binary Word Constructor operator (b w= b) */
|
||||
public class OperatorWord extends OperatorBinary {
|
||||
|
||||
public OperatorWord(int precedence) {
|
||||
super("w=", "_word_", precedence);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user