|
|
|
@@ -124,38 +124,38 @@ typedef struct { |
|
|
|
|
|
|
|
typedef enum { |
|
|
|
Built_In_Addition, |
|
|
|
Built_In_Subtraction, |
|
|
|
Built_In_Multiplication, |
|
|
|
Built_In_And, |
|
|
|
Built_In_Breakpoint, |
|
|
|
Built_In_Define, |
|
|
|
Built_In_Division, |
|
|
|
Built_In_Greater, |
|
|
|
Built_In_Less, |
|
|
|
Built_In_Equal, |
|
|
|
Built_In_Eval, |
|
|
|
Built_In_Exit, |
|
|
|
Built_In_First, |
|
|
|
Built_In_Greater, |
|
|
|
Built_In_Greater_Equal, |
|
|
|
Built_In_Less_Equal, |
|
|
|
Built_In_If, |
|
|
|
Built_In_And, |
|
|
|
Built_In_Or, |
|
|
|
Built_In_Not, |
|
|
|
Built_In_Pair, |
|
|
|
Built_In_First, |
|
|
|
Built_In_Rest, |
|
|
|
Built_In_Load, |
|
|
|
Built_In_Define, |
|
|
|
Built_In_Info, |
|
|
|
Built_In_Lambda, |
|
|
|
Built_In_Less, |
|
|
|
Built_In_Less_Equal, |
|
|
|
Built_In_Let, |
|
|
|
Built_In_List, |
|
|
|
Built_In_Load, |
|
|
|
Built_In_Macro, |
|
|
|
Built_In_Macro_Define, |
|
|
|
Built_In_Breakpoint, |
|
|
|
Built_In_Multiplication, |
|
|
|
Built_In_Mutate, |
|
|
|
Built_In_Lambda, |
|
|
|
Built_In_Macro, |
|
|
|
Built_In_Eval, |
|
|
|
Built_In_Quote, |
|
|
|
Built_In_Prog, |
|
|
|
Built_In_List, |
|
|
|
Built_In_Not, |
|
|
|
Built_In_Or, |
|
|
|
Built_In_Pair, |
|
|
|
Built_In_Print, |
|
|
|
Built_In_Prog, |
|
|
|
Built_In_Quote, |
|
|
|
Built_In_Read, |
|
|
|
Built_In_Info, |
|
|
|
Built_In_Rest, |
|
|
|
Built_In_Subtraction, |
|
|
|
Built_In_Type, |
|
|
|
Built_In_Exit, |
|
|
|
} Built_In_Name; |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -165,9 +165,8 @@ char* Built_In_Name_to_string(Built_In_Name name) { |
|
|
|
switch (name) { |
|
|
|
case Built_In_Addition: return "+"; |
|
|
|
case Built_In_And: return "and"; |
|
|
|
case Built_In_Define: return "define"; |
|
|
|
case Built_In_Macro_Define: return "macro-define"; |
|
|
|
case Built_In_Breakpoint: return "breakpoint"; |
|
|
|
case Built_In_Define: return "define"; |
|
|
|
case Built_In_Division: return "/"; |
|
|
|
case Built_In_Equal: return "="; |
|
|
|
case Built_In_Eval: return "eval"; |
|
|
|
@@ -178,12 +177,13 @@ char* Built_In_Name_to_string(Built_In_Name name) { |
|
|
|
case Built_In_If: return "if"; |
|
|
|
case Built_In_Info: return "info"; |
|
|
|
case Built_In_Lambda: return "lambda"; |
|
|
|
case Built_In_Let: return "let"; |
|
|
|
case Built_In_Less: return "<"; |
|
|
|
case Built_In_Less_Equal: return "<="; |
|
|
|
case Built_In_Let: return "let"; |
|
|
|
case Built_In_List: return "list"; |
|
|
|
case Built_In_Load: return "load"; |
|
|
|
case Built_In_Macro: return "macro"; |
|
|
|
case Built_In_Macro_Define: return "macro-define"; |
|
|
|
case Built_In_Multiplication: return "*"; |
|
|
|
case Built_In_Mutate: return "mutate"; |
|
|
|
case Built_In_Not: return "not"; |
|
|
|
@@ -278,38 +278,39 @@ Ast_Node* create_ast_node_keyword(char* keyword) { |
|
|
|
Ast_Node* create_ast_node_built_in_function(char* name) { |
|
|
|
Built_In_Name type; |
|
|
|
if (string_equal(name, "+")) type = Built_In_Addition; |
|
|
|
else if (string_equal(name, "-")) type = Built_In_Subtraction; |
|
|
|
else if (string_equal(name, "*")) type = Built_In_Multiplication; |
|
|
|
else if (string_equal(name, "-")) type = Built_In_Subtraction; |
|
|
|
else if (string_equal(name, "/")) type = Built_In_Division; |
|
|
|
else if (string_equal(name, "<")) type = Built_In_Less; |
|
|
|
else if (string_equal(name, "<=")) type = Built_In_Less_Equal; |
|
|
|
else if (string_equal(name, "=")) type = Built_In_Equal; |
|
|
|
else if (string_equal(name, ">")) type = Built_In_Greater; |
|
|
|
else if (string_equal(name, ">=")) type = Built_In_Greater_Equal; |
|
|
|
else if (string_equal(name, "<")) type = Built_In_Less; |
|
|
|
else if (string_equal(name, "<=")) type = Built_In_Less_Equal; |
|
|
|
else if (string_equal(name, "if")) type = Built_In_If; |
|
|
|
else if (string_equal(name, "and")) type = Built_In_And; |
|
|
|
else if (string_equal(name, "or")) type = Built_In_Or; |
|
|
|
else if (string_equal(name, "not")) type = Built_In_Not; |
|
|
|
else if (string_equal(name, "pair")) type = Built_In_Pair; |
|
|
|
else if (string_equal(name, "breakpoint")) type = Built_In_Breakpoint; |
|
|
|
else if (string_equal(name, "define")) type = Built_In_Define; |
|
|
|
else if (string_equal(name, "eval")) type = Built_In_Eval; |
|
|
|
else if (string_equal(name, "exit")) type = Built_In_Exit; |
|
|
|
else if (string_equal(name, "first")) type = Built_In_First; |
|
|
|
else if (string_equal(name, "rest")) type = Built_In_Rest; |
|
|
|
else if (string_equal(name, "load")) type = Built_In_Load; |
|
|
|
else if (string_equal(name, "if")) type = Built_In_If; |
|
|
|
else if (string_equal(name, "info")) type = Built_In_Info; |
|
|
|
else if (string_equal(name, "info")) type = Built_In_Info; |
|
|
|
else if (string_equal(name, "lambda")) type = Built_In_Lambda; |
|
|
|
else if (string_equal(name, "let")) type = Built_In_Let; |
|
|
|
else if (string_equal(name, "define")) type = Built_In_Define; |
|
|
|
else if (string_equal(name, "list")) type = Built_In_List; |
|
|
|
else if (string_equal(name, "load")) type = Built_In_Load; |
|
|
|
else if (string_equal(name, "macro")) type = Built_In_Macro; |
|
|
|
else if (string_equal(name, "macro-define")) type = Built_In_Macro_Define; |
|
|
|
else if (string_equal(name, "breakpoint")) type = Built_In_Breakpoint; |
|
|
|
else if (string_equal(name, "mutate")) type = Built_In_Mutate; |
|
|
|
else if (string_equal(name, "lambda")) type = Built_In_Lambda; |
|
|
|
else if (string_equal(name, "macro")) type = Built_In_Macro; |
|
|
|
else if (string_equal(name, "eval")) type = Built_In_Eval; |
|
|
|
else if (string_equal(name, "quote")) type = Built_In_Quote; |
|
|
|
else if (string_equal(name, "prog")) type = Built_In_Prog; |
|
|
|
else if (string_equal(name, "list")) type = Built_In_List; |
|
|
|
else if (string_equal(name, "not")) type = Built_In_Not; |
|
|
|
else if (string_equal(name, "or")) type = Built_In_Or; |
|
|
|
else if (string_equal(name, "pair")) type = Built_In_Pair; |
|
|
|
else if (string_equal(name, "print")) type = Built_In_Print; |
|
|
|
else if (string_equal(name, "prog")) type = Built_In_Prog; |
|
|
|
else if (string_equal(name, "quote")) type = Built_In_Quote; |
|
|
|
else if (string_equal(name, "read")) type = Built_In_Read; |
|
|
|
else if (string_equal(name, "info")) type = Built_In_Info; |
|
|
|
else if (string_equal(name, "rest")) type = Built_In_Rest; |
|
|
|
else if (string_equal(name, "type")) type = Built_In_Type; |
|
|
|
else if (string_equal(name, "exit")) type = Built_In_Exit; |
|
|
|
else return nullptr; |
|
|
|
|
|
|
|
Ast_Node* node = new(Ast_Node); |
|
|
|
|