test out profiling

This commit is contained in:
Felix Brendel
2019-08-30 01:30:24 +02:00
parent aea0e9dc94
commit 6c80382cd0
30 changed files with 564 additions and 123 deletions
+24 -16
View File
@@ -4,23 +4,31 @@ namespace Parser {
int parser_line;
int parser_col;
// NOTE(Felix): In this environment, the build in functions will
// be loaded, and the macros will be stored in form of
// special-lambdas, that get executed in this environment at
// read-time. This should always be the global environment.
Environment* environment_for_macros;
proc maybe_expand_reader_macro() -> Lisp_Object* {
// static Lisp_Object* quote_sym = Memory::get_or_create_lisp_object_symbol("quote");
// static Lisp_Object* qquote_sym = Memory::get_or_create_lisp_object_symbol("quasiquote");
// static Lisp_Object* unquote_sym = Memory::get_or_create_lisp_object_symbol("unquote");
// static Lisp_Object* us_sym = Memory::get_or_create_lisp_object_symbol("unquote-splicing");
// proc set_environment_for_macros(Environment* env) -> void {
// // NOTE(Felix): it is important to keep the parser environment
// // up to date with the global environment. When doing tests,
// // or running a programm we have to reload it.
// if (text[*index_in_text] == '\'') {
// *index_in_text++;
// return quote_sym;
// }
// if (text[*index_in_text] == '`') {
// *index_in_text++;
// return qquote_sym;
// }
// if (text[*index_in_text] == ',') {
// *index_in_text++;
// return unquote_sym;
// }
// if (text[*index_in_text] == ',' && text[*index_in_text] == '@') {
// *index_in_text += 2;
// return us_sym;
// }
// // NOTE(Felix): For now we just allow executing built-ins at
// // read-time (while creating macros). If later we want to
// // change that, we have to define some funcions in this
// // environment.
// environment_for_macros = env;
// }
return nullptr;
}
proc inject_scl(Lisp_Object* lo) -> void {
lo->sourceCodeLocation = new(Source_Code_Location);
@@ -387,7 +395,7 @@ namespace Parser {
Lisp_Object* macro;
try macro = Memory::create_lisp_object();
Memory::set_type(macro, Lisp_Object_Type::Function);
macro->value.function.parent_environment = environment_for_macros;
macro->value.function.parent_environment = get_current_environment();
macro->value.function.type = Function_Type::Macro;
// if parameters were specified