|
|
@@ -7,7 +7,7 @@ enum { |
|
|
|
|
|
|
|
enum { |
|
|
|
word_type, word_loop, word_if, word_else, word_case, |
|
|
|
word_return, word_import, word_export, word_define, word_system |
|
|
|
word_return, word_import, word_system |
|
|
|
}; |
|
|
|
|
|
|
|
#define STRING_LIMIT (80) |
|
|
@@ -31,12 +31,16 @@ static char * * marker_name = null; |
|
|
|
static char * * type_name = null; |
|
|
|
static int * marker_type = null; |
|
|
|
static char * symbol_data = null; |
|
|
|
|
|
|
|
/* |
|
|
|
static int * function_name = null; |
|
|
|
static int * function_type = null; |
|
|
|
static int * * function_argument_name = null; |
|
|
|
static int * * function_argument_type = null; |
|
|
|
*/ |
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
static char * word_list [] = { |
|
|
|
"type", "loop", "if", "else", "case", "return", |
|
|
|
"import", "export", "define", "system" |
|
|
|
"type", "loop", "if", "else", "case", "return", "import", "system" |
|
|
|
}; |
|
|
|
|
|
|
|
static void add_token (int type, int data) { |
|
|
@@ -128,7 +132,7 @@ int main (void) { |
|
|
|
name [size++] = buffer [offset]; |
|
|
|
} |
|
|
|
name [size] = '\0'; |
|
|
|
for (length = 0; length < 10; ++length) { |
|
|
|
for (length = 0; length < (int) (sizeof (word_list) / sizeof (word_list [0])); ++length) { |
|
|
|
if (string_compare_limit (name, word_list [length], string_length (word_list [length]) + 1) == true) { |
|
|
|
add_token (core_word, length); |
|
|
|
goto here; |
|
|
@@ -136,12 +140,12 @@ int main (void) { |
|
|
|
} |
|
|
|
add_token (core_marker, marker_code); |
|
|
|
add_marker (name, token_type [token_count - 1]); |
|
|
|
if ((token_type [token_count - 2] == core_word) && (token_data [token_count - 2] == word_type)) { // NEW TYPE |
|
|
|
if ((token_type [token_count - 2] == core_word) && (token_data [token_count - 2] == word_type)) { |
|
|
|
token_type [token_count - 1] = core_type; |
|
|
|
add_type (name); |
|
|
|
} |
|
|
|
for (length = 0; length < type_code; ++length) { |
|
|
|
if (string_compare_limit (name, type_name [length], string_length (type_name [length]) + 1) == true) { // EXISTING TYPE |
|
|
|
if (string_compare_limit (name, type_name [length], string_length (type_name [length]) + 1) == true) { |
|
|
|
token_type [token_count - 1] = core_type; |
|
|
|
} |
|
|
|
} |
|
|
@@ -180,7 +184,7 @@ int main (void) { |
|
|
|
echo ("return (\n"); |
|
|
|
++length; |
|
|
|
} else if ((token_type [length] == core_symbol) && (symbol_data [token_data [length]] == ';')) { |
|
|
|
echo ("return ; -- 48 33 C0 3C -- xor rax rax ret\n"); |
|
|
|
echo ("; return;\nxor rax, rax\nret\n"); |
|
|
|
++length; |
|
|
|
} else { |
|
|
|
kill ("return ?\n"); |
|
|
@@ -202,7 +206,7 @@ int main (void) { |
|
|
|
echo ("else if\n"); |
|
|
|
++length; |
|
|
|
} else { |
|
|
|
kill ("else ?\n"); |
|
|
|
echo ("expression\n"); |
|
|
|
} |
|
|
|
} else if ((token_type [length] == core_word) && (token_data [length] == word_type)) { |
|
|
|
++length; |
|
|
|