aboutsummaryrefslogtreecommitdiff
path: root/include/compiler.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-03-18 23:47:45 +0100
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit2323ca6c9ec3c8ee76b9acf13745b80b92952a6a (patch)
tree93013237dbcb0fa96ceb5f3c026fd040aff464cf /include/compiler.h
parent5a93c32a59775cd1be4b4f450e8230016b434366 (diff)
Add struct, import caching, binop ops etc
Diffstat (limited to 'include/compiler.h')
-rw-r--r--include/compiler.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/compiler.h b/include/compiler.h
index 32a5eab..47d4471 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -7,6 +7,7 @@
#include "std/scoped_allocator.h"
#include "std/thread.h"
#include "defs.h"
+#include "ast.h"
#define AMAL_COMPILER_OK 0
/* General error */
@@ -14,9 +15,10 @@
struct amal_compiler {
ScopedAllocator allocator;
- ScopedAllocator main_thread_allocator;
+ Scope root_scope;
Buffer/*<Parser*>*/ parsers;
- Buffer queued_files;
+ Buffer/*<BufferView>*/ queued_files;
+ HashMap/*<BufferView, FileScopeReference*>*/ file_scopes;
ParserThreadData *threads;
int usable_thread_count;
bool started;
@@ -26,8 +28,11 @@ struct amal_compiler {
CHECK_RESULT int amal_compiler_init(amal_compiler *self);
CHECK_RESULT int amal_compiler_deinit(amal_compiler *self);
-/* Not thread-safe */
-CHECK_RESULT int amal_compiler_load_file(amal_compiler *self, BufferView filepath);
+/*
+This function creates a copy of @filepath in the same thread it's called from
+so it doesn't have to survive longer than this function call.
+*/
+CHECK_RESULT int amal_compiler_load_file(amal_compiler *self, const char *filepath, FileScopeReference **file_scope);
/* TODO: amal_compiler_unload_file */
#endif