Experimenting...

This commit is contained in:
Ognjen Milan Robovic 2024-04-03 12:29:54 -04:00
parent 5e18ac75dc
commit 3d60a10e63

View File

@ -54,7 +54,7 @@ int main (void) {
int offset = 0;
int length = 0;
buffer = file_import ("./test_x.x");
buffer = record ();
for (offset = 0; buffer [offset] != '\0'; ++offset) {
int size = 0;
@ -148,8 +148,7 @@ int main (void) {
case coin_loop:
case coin_import:
case coin_system:
case coin_return:
printf ("\033[1;33m%s\033[0m ", coin_text [length]); break;
case coin_return: printf ("\033[1;33m%s\033[0m ", coin_text [length]); break;
default: printf ("\033[1;31m%s\033[0m ", coin_text [length]); break;
}
}
@ -159,56 +158,11 @@ int main (void) {
for (length = 0; length < coin_code; ++length) {
if ((coin_enum [length] == coin_return) && (coin_enum [length + 1] == coin_stop)) {
printf ("; return;\nxor rax, rax\nret\n\n");
} else if ((coin_enum [length] == coin_return) && (coin_enum [length + 1] == coin_number) && (coin_enum [length + 2] == coin_stop)) {
printf ("; return {number};\nmov rax, %s\nret\n\n", coin_text [length + 1]);
}
}
/*
for (length = 0; length < coin_code; ++length) {
if ((coin_enum [length] == coin_word) && (coin_data [length] == word_return)) {
++length;
if ((coin_enum [length] == coin_symbol) && (symbol_data [coin_data [length]] == '(')) {
echo ("return (\n");
++length;
} else if ((coin_enum [length] == coin_symbol) && (symbol_data [coin_data [length]] == ';')) {
echo ("; return;\nxor rax, rax\nret\n");
++length;
} else if (coin_enum [length] == coin_number && (coin_enum [length + 1] == coin_symbol) && (symbol_data [coin_data [length + 1]] == ';')) {
printf ("; return {number};\nmov rax, %i\nret\n", number_data [coin_data [length]]);
++length;
} else {
kill ("return ?\n");
}
} else if ((coin_enum [length] == coin_word) && (coin_data [length] == word_if)) {
++length;
if ((coin_enum [length] == coin_symbol) && (symbol_data [coin_data [length]] == '(')) {
echo ("if (\n");
++length;
} else {
kill ("if ?\n");
}
} else if ((coin_enum [length] == coin_word) && (coin_data [length] == word_else)) {
++length;
if ((coin_enum [length] == coin_symbol) && (symbol_data [coin_data [length]] == ':')) {
echo ("else :\n");
++length;
} else if ((coin_enum [length] == coin_word) && (coin_data [length] == word_if)) {
echo ("else if\n");
++length;
} else {
echo ("else expression\n");
}
} else if ((coin_enum [length] == coin_word) && (coin_data [length] == word_type)) {
++length;
if (coin_enum [length] == coin_type) {
echo ("type <name> -- ");
echo (marker_name [coin_data [length]]);
echo ("\n");
++length;
} else {
kill ("type ?\n");
}
}
}
*/
buffer = deallocate (buffer);
return (log_success);