Fixed importing not working in the test file
This commit is contained in:
+2549
-2496
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 277 KiB After Width: | Height: | Size: 139 KiB |
@@ -55,6 +55,7 @@ proc lookup_symbol(Lisp_Object* node, Environment* env) -> Lisp_Object* {
|
||||
|
||||
String* identifier = node->value.identifier;
|
||||
create_symbol_undefined_error("The symbol '%s' is not defined.", &identifier->data);
|
||||
print_environment(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
+9
-14
@@ -432,23 +432,18 @@ proc interprete_file (char* file_name) -> Lisp_Object* {
|
||||
Environment* user_env = Memory::create_child_environment(root_env);
|
||||
Parser::environment_for_macros = user_env;
|
||||
|
||||
char* file_content;
|
||||
try file_content = read_entire_file(file_name);
|
||||
// char* file_content;
|
||||
// try file_content = read_entire_file(file_name);
|
||||
|
||||
built_in_load(Memory::create_string("pre.slime"), root_env);
|
||||
built_in_import(Memory::create_string("pre.slime"), user_env);
|
||||
|
||||
Lisp_Object_Array_List* program;
|
||||
program = Parser::parse_program(Memory::create_string(file_name), file_content);
|
||||
Lisp_Object* result;
|
||||
result = built_in_load(Memory::create_string(file_name), user_env);
|
||||
|
||||
Lisp_Object* result = Memory::nil;
|
||||
for (int i = 0; i < program->next_index; ++i) {
|
||||
result = eval_expr(program->data[i], user_env);
|
||||
|
||||
if (Globals::error) {
|
||||
log_error();
|
||||
delete_error();
|
||||
return nullptr;
|
||||
}
|
||||
if (Globals::error) {
|
||||
log_error();
|
||||
delete_error();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
+10
-4
@@ -1,13 +1,21 @@
|
||||
namespace Memory {
|
||||
|
||||
// ------------------
|
||||
// lisp_object
|
||||
// lisp_objects
|
||||
// ------------------
|
||||
int object_memory_size;
|
||||
Int_Array_List* free_spots_in_object_memory;
|
||||
Lisp_Object* object_memory;
|
||||
int next_index_in_object_memory = 0;
|
||||
|
||||
// ------------------
|
||||
// environments
|
||||
// ------------------
|
||||
int environment_memory_size;
|
||||
Int_Array_List* free_spots_in_environment_memory;
|
||||
Lisp_Object* environment_memory;
|
||||
int next_index_in_environment_memory = 0;
|
||||
|
||||
// ------------------
|
||||
// strings
|
||||
// ------------------
|
||||
@@ -19,7 +27,6 @@ namespace Memory {
|
||||
String* string_memory;
|
||||
String* next_free_spot_in_string_memory;
|
||||
|
||||
|
||||
// ------------------
|
||||
// immutables
|
||||
// ------------------
|
||||
@@ -168,8 +175,7 @@ namespace Memory {
|
||||
next_index_in_object_memory = 2; // because t and nil are always there
|
||||
next_free_spot_in_string_memory = string_memory;
|
||||
|
||||
Globals::root_environment->next_index = 0;
|
||||
Globals::root_environment->parents->next_index = 0;
|
||||
Globals::root_environment = create_built_ins_environment();
|
||||
}
|
||||
|
||||
proc create_lisp_object_number(double number) -> Lisp_Object* {
|
||||
|
||||
+1
-1
@@ -570,7 +570,7 @@ proc test_file(const char* file) -> testresult {
|
||||
Environment* user_env = Memory::create_child_environment(root_env);
|
||||
assert_no_error();
|
||||
|
||||
Parser::environment_for_macros = root_env;
|
||||
Parser::environment_for_macros = user_env;
|
||||
|
||||
built_in_import(Memory::create_string("pre.slime"), user_env);
|
||||
assert_no_error();
|
||||
|
||||
@@ -414,7 +414,7 @@ proc visualize_lisp_machine() -> void {
|
||||
}
|
||||
|
||||
remove_doubles_from_lisp_object_array_list(pairs_to_filter);
|
||||
fprintf(stderr, "removing %d pairs\n", pairs_to_filter->next_index);
|
||||
// fprintf(stderr, "removing %d pairs\n", pairs_to_filter->next_index);
|
||||
// okay, so pairs_to_filter now only the pairs once each that
|
||||
// we want to filter from the pairs list
|
||||
for (int i = 0; i < pairs->next_index; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user