Skip to content

Commit

Permalink
Operators
Browse files Browse the repository at this point in the history
  • Loading branch information
ParfenovIgor committed Nov 27, 2024
1 parent e511ba8 commit 50980e7
Show file tree
Hide file tree
Showing 12 changed files with 671 additions and 171 deletions.
44 changes: 26 additions & 18 deletions compiler/include/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ enum NodeType {
NodeAs,
NodeAssignment,
NodeMovement,
NodeAssumption,
NodeIdentifier,
NodeInteger,
NodeChar,
Expand All @@ -33,12 +32,27 @@ enum NodeType {
NodeDereference,
NodeIndex,
NodeGetField,

NodeAnd,
NodeOr,
NodeNot,
NodeBitwiseAnd,
NodeBitwiseOr,
NodeBitwiseXor,
NodeBitwiseNot,
NodeBitwiseLeft,
NodeBitwiseRight,
NodeAddition,
NodeSubtraction,
NodeMultiplication,
NodeDivision,
NodeModulo,
NodeLess,
NodeGreater,
NodeEqual,
NodeLessEqual,
NodeGreaterEqual,
NodeNotEqual,
};

struct Node;
Expand Down Expand Up @@ -72,12 +86,6 @@ struct FunctionCall;
struct Dereference;
struct Index;
struct GetField;
struct Addition;
struct Subtraction;
struct Multiplication;
struct Division;
struct Less;
struct Equal;


struct FunctionSignature {
Expand Down Expand Up @@ -164,17 +172,6 @@ struct As {
struct TypeNode *type;
};

struct Index {
struct Node *left, *right;
bool address;
};

struct GetField {
struct Node *left;
const char *field;
bool address;
};

struct Assignment {
struct Node *dst, *src;
};
Expand Down Expand Up @@ -227,6 +224,17 @@ struct Dereference {
struct Node *expression;
};

struct Index {
struct Node *left, *right;
bool address;
};

struct GetField {
struct Node *left;
const char *field;
bool address;
};

struct BinaryOperator {
struct Node *left, *right;
};
15 changes: 12 additions & 3 deletions compiler/include/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ enum TokenType {
TokenAs,
TokenConst,
TokenTest,
TokenAnd,
TokenOr,
TokenNot,
TokenAssign,
TokenMove,
TokenDot,
Expand All @@ -32,20 +35,26 @@ enum TokenType {
TokenBracketOpen,
TokenBracketClose,
TokenBackslash,
TokenAmpersand,
TokenPipe,
TokenAddress,
TokenCaret,
TokenTilde,
TokenBitwiseLeft,
TokenBitwiseRight,
TokenDereference,
TokenIndex,
TokenGetField,
TokenCaret,
TokenSharp,
TokenPlus,
TokenMinus,
TokenMult,
TokenDiv,
TokenMod,
TokenLess,
TokenGreater,
TokenEqual,
TokenLessEqual,
TokenGreaterEqual,
TokenNotEqual,
TokenInteger,
TokenChar,
TokenString,
Expand Down
Loading

0 comments on commit 50980e7

Please sign in to comment.