Very ugly work in progress...

This commit is contained in:
Ognjen Milan Robovic 2024-04-06 20:33:13 -04:00
parent 40917b92c1
commit 423ed1f29e
3 changed files with 43 additions and 16 deletions

7
heyo.x
View File

@ -1,13 +1,6 @@
одреди слово = 1; одреди слово = 1;
одреди број = 4; одреди број = 4;
одреди системски_позив (
читај = 0,
пиши = 1,
отвори = 2,
затвори = 3,
изађи = 60)
одреди описивач ( одреди описивач (
улаз, улаз,
излаз) излаз)

View File

@ -42,12 +42,24 @@ static void add_coin (int data, int size, char * text) {
} }
static void kill (char * text, int offset) { static void kill (char * text, int offset) {
int i;
terminal_colour (colour_red, effect_bold); terminal_colour (colour_red, effect_bold);
echo (text); echo (text);
terminal_cancel (); terminal_cancel ();
echo (coin_text [offset]); echo (coin_text [offset]);
echo ("\n"); echo ("\n");
/*exit (log_failure);*/ for (i = 0; i < offset + 3; ++i) {
if (i == offset) {
terminal_colour (colour_red, effect_bold);
echo (coin_text [i]);
echo (" ");
terminal_cancel ();
} else {
echo (coin_text [i]);
echo (" ");
}
}
echo ("\n");
} }
int main (void) { int main (void) {
@ -107,14 +119,13 @@ int main (void) {
int counter = 0; int counter = 0;
type_size [type_code] = 4; type_size [type_code] = 4;
for (++offset; offset < coin_code; ++offset) { for (++offset; offset < coin_code; ++offset) {
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ')')) { if (coin_data [offset] == coin_marker) {
++offset;
break;
} else if (coin_data [offset] == coin_marker) {
string_copy (constant_name [constant_code], coin_text [offset]); string_copy (constant_name [constant_code], coin_text [offset]);
constant_type [constant_code] = type_code; constant_type [constant_code] = type_code;
++offset; ++offset;
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ',')) { if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ')')) {
break;
} else if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ',')) {
constant_data [constant_code] = counter; constant_data [constant_code] = counter;
++counter; ++counter;
++constant_code; ++constant_code;
@ -125,9 +136,9 @@ int main (void) {
constant_data [constant_code] = number; constant_data [constant_code] = number;
counter = number + 1; counter = number + 1;
++constant_code; ++constant_code;
} else kill ("Expected number:", offset); } else kill ("Expected constant data number:", offset);
} else kill ("Expected = or ,:", offset); } else kill ("Expected = or , or ) ", offset);
} else kill ("Expected either marker or close symbol: ", offset); } else kill ("Expected constant name marker: ", offset);
} }
++type_code; ++type_code;
} else kill ("Expected equal or open bracket symbol: ", offset); } else kill ("Expected equal or open bracket symbol: ", offset);

View File

@ -49,3 +49,26 @@
видимо_се видимо_се
врати 60 врати 60
крај крај
-----------------------------------------------
одреди слово = 1;
одреди број = 4;
одреди описивач (
улаз,
излаз)
одреди системски_позив (
читај = 0,
пиши = 1,
отвори = 2,
затвори = 3,
изађи = 60)
текст: слово = "Здраво свете!";
дужина: број = 12;
главна_процедура ():
изврши (пиши, излаз, #текст, дужина);
врати;;