Make nil and t parse to symbols and make the top level env look them up

This commit is contained in:
FelixBrendel
2018-10-27 23:14:19 +02:00
parent b3eccec1e3
commit ad7dd86667
2 changed files with 7 additions and 7 deletions
+7
View File
@@ -136,6 +136,13 @@ Ast_Node* lookup_symbol(Symbol* sym, Environment* env) {
return result;
}
if (string_equal(sym->identifier, "nil")) {
return create_ast_node_nil();
}
if (string_equal(sym->identifier, "t")) {
return create_ast_node_t();
}
result = create_ast_node_built_in_function(sym->identifier);
if (result)
return result;
-7
View File
@@ -101,13 +101,6 @@ Ast_Node* parse_keyword(char* text, int* index_in_text) {
Ast_Node* parse_symbol(char* text, int* index_in_text) {
// we are now at the first char of the symbol
char* str_symbol = read_atom(text, index_in_text);
if (string_equal(str_symbol, "nil")) {
return create_ast_node_nil();
}
if (string_equal(str_symbol, "t")) {
return create_ast_node_t();
}
return create_ast_node_symbol(str_symbol);
}