aboutsummaryrefslogtreecommitdiff
path: root/include/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/compiler.h')
-rw-r--r--include/compiler.h41
1 files changed, 26 insertions, 15 deletions
diff --git a/include/compiler.h b/include/compiler.h
index 0ae8532..a0ac17a 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -4,7 +4,7 @@
#include "std/misc.h"
#include "std/buffer.h"
#include "std/buffer_view.h"
-#include "std/scoped_allocator.h"
+#include "std/arena_allocator.h"
#include "std/thread.h"
#include "compiler_options.h"
#include "ast.h"
@@ -14,27 +14,38 @@
/* General error */
#define AMAL_COMPILER_ERR -1
+#define NUM_ARITHMETIC_TYPES 10
+
+typedef struct {
+ LhsExpr lhs_expr;
+ bool is_signed;
+} amal_default_type;
+
typedef struct {
- LhsExpr *i8;
- LhsExpr *i16;
- LhsExpr *i32;
- LhsExpr *i64;
- LhsExpr *u8;
- LhsExpr *u16;
- LhsExpr *u32;
- LhsExpr *u64;
- LhsExpr *isize;
- LhsExpr *usize;
- LhsExpr *f32;
- LhsExpr *f64;
- LhsExpr *str;
+ amal_default_type *i8;
+ amal_default_type *i16;
+ amal_default_type *i32;
+ amal_default_type *i64;
+ amal_default_type *u8;
+ amal_default_type *u16;
+ amal_default_type *u32;
+ amal_default_type *u64;
+ amal_default_type *isize;
+ amal_default_type *usize;
+ amal_default_type *f32;
+ amal_default_type *f64;
+ amal_default_type *str;
+
+ amal_default_type *arithmetic_types[NUM_ARITHMETIC_TYPES];
} amal_default_types;
+bool is_arithmetic_type(LhsExpr *expr, amal_compiler *compiler);
+
struct amal_compiler {
amal_default_types default_types;
amal_compiler_options options;
amal_program *program;
- ScopedAllocator allocator;
+ ArenaAllocator allocator;
Scope root_scope;
Buffer/*<Parser*>*/ parsers;
Buffer/*<FileScopeReference*>*/ queued_files;