aboutsummaryrefslogtreecommitdiff
path: root/src/ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.h')
-rw-r--r--src/ast.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ast.h b/src/ast.h
index d764c13..75d8b12 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -118,6 +118,7 @@ enum StatementKind
STATEMENT_WHILE,
STATEMENT_CALL,
STATEMENT_STACK,
+ STATEMENT_INSTRUCTION,
};
struct AssignStatement
@@ -175,6 +176,17 @@ struct StackStatement
struct Expr* size;
};
+// a bare instruction: a mnemonic and its operands emitted verbatim, the escape
+// hatch for anything outside the assignment / control-flow model (int, hlt,
+// lgdt, in/out, ...)
+struct InstructionStatement
+{
+ struct Token mnemonic;
+ struct Expr** operands;
+ size_t operand_count;
+ size_t operand_capacity;
+};
+
struct Statement
{
enum StatementKind kind;
@@ -187,6 +199,7 @@ struct Statement
struct WhileStatement loop;
struct CallStatement call;
struct StackStatement stack;
+ struct InstructionStatement instruction;
};
};
@@ -202,12 +215,22 @@ struct ProcDecl
size_t body_capacity;
};
+enum OutputFormat
+{
+ OUTPUT_ELF,
+ OUTPUT_BIN,
+};
+
struct Config
{
uint32_t bits;
bool has_entry;
struct Token entry;
bool logical_registers;
+ enum OutputFormat format;
+ bool has_org;
+ struct Token org;
+ bool boot;
};
struct Program