Disallow sharing files between modules
This commit is contained in:
22
main.cpp
22
main.cpp
@@ -31,6 +31,7 @@ For now I don't thing it should be overloadable.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Imports
|
||||
We compile lot's of files, we keep track of them in Parse_Ctx, making sure we don't
|
||||
parse same thing twice. Files belong to a module, files can be loaded #load "file".
|
||||
All the files see all the decls from all the files in that module. We can import
|
||||
@@ -38,6 +39,21 @@ other modules using a different directive #import. #import perhaps should be laz
|
||||
evaluated, making sure we don't resolve stuff we don't require. Currently probably
|
||||
want to export all the symbols, we can namespace them optionally.
|
||||
|
||||
2022.06.26 - import revision
|
||||
Current design is a bit weird, there can be situations where you have colissions and stuff.
|
||||
That's not cool. I was thinking of bringing back this idea where you have modules, implicit or
|
||||
explicit(module directive at top of the file). Then each file that belongs to a module sees other
|
||||
decls in that module and stuff like that. Other modules would be imported using a single keyword.
|
||||
BUT on second thought I don't really like that design. It's not really clear how files that
|
||||
belong to a module are found and concatenated. Then you would need to specify a directory to
|
||||
compile instead of a single file and stuff like that which seems annoying! Current idea is
|
||||
to just disallow having same file loaded twice! It's the same result as with the module stuff,
|
||||
we cant reuse files, but we avoid file colissions where we load a file and a module we import loads
|
||||
a file. I like the load files approach to a module cause we specify which files to compile and load.
|
||||
Imports also could be this other thing where we load lazily and we decrease the amount of code
|
||||
that we output. Code in our project shouldn't be evaluated lazily cause that's counter intuitive.
|
||||
For modules it's a bit different cause they should be distributed as valid.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@todo
|
||||
@@ -171,7 +187,7 @@ want to export all the symbols, we can namespace them optionally.
|
||||
#include "c_language_codegen.cpp"
|
||||
#include "intermediate_representation.cpp"
|
||||
// #include "bytecode_interpreter.cpp"
|
||||
#include "bytecode_codegen.cpp"
|
||||
// #include "bytecode.cpp"
|
||||
|
||||
|
||||
int main(int argument_count, char **arguments){
|
||||
@@ -205,7 +221,7 @@ int main(int argument_count, char **arguments){
|
||||
test_bucket_arrays();
|
||||
|
||||
emit_line_directives = true;
|
||||
String program_name = "vm.kl"_s;
|
||||
String program_name = "main.kl"_s;
|
||||
if(argument_count > 1){
|
||||
program_name = string_from_cstring(arguments[1]);
|
||||
}
|
||||
@@ -236,7 +252,7 @@ int main(int argument_count, char **arguments){
|
||||
|
||||
|
||||
arena_clear(&pctx->stage_arena);
|
||||
build_bytecode();
|
||||
// build_bytecode();
|
||||
// compile_to_bc();
|
||||
// __debugbreak();
|
||||
String result = get_compilation_result();
|
||||
|
||||
Reference in New Issue
Block a user