Work in progress push...
This commit is contained in:
parent
d420564aa9
commit
40917b92c1
13
heyo.x
13
heyo.x
@ -1,9 +1,20 @@
|
|||||||
одреди слово = 1;
|
одреди слово = 1;
|
||||||
одреди број = 4;
|
одреди број = 4;
|
||||||
|
|
||||||
|
одреди системски_позив (
|
||||||
|
читај = 0,
|
||||||
|
пиши = 1,
|
||||||
|
отвори = 2,
|
||||||
|
затвори = 3,
|
||||||
|
изађи = 60)
|
||||||
|
|
||||||
|
одреди описивач (
|
||||||
|
улаз,
|
||||||
|
излаз)
|
||||||
|
|
||||||
текст: слово = "Здраво свете!";
|
текст: слово = "Здраво свете!";
|
||||||
дужина: број = 12;
|
дужина: број = 12;
|
||||||
|
|
||||||
главна_процедура ():
|
главна_процедура ():
|
||||||
изврши (1, 1, #текст, дужина);
|
изврши (пиши, излаз, #текст, дужина);
|
||||||
врати;;
|
врати;;
|
||||||
|
8
test.asm
8
test.asm
@ -16,9 +16,9 @@ _start:
|
|||||||
mov [echo_0], text_data ; text);
|
mov [echo_0], text_data ; text);
|
||||||
call echo ; echo (
|
call echo ; echo (
|
||||||
|
|
||||||
loop_1:
|
лоопаа:
|
||||||
cmp [main_x], 51
|
cmp [main_x], 51
|
||||||
jnb loop_1e
|
jnb лоопааe
|
||||||
xor rdx, rdx
|
xor rdx, rdx
|
||||||
mov eax, [main_x]
|
mov eax, [main_x]
|
||||||
mov ebx, 15
|
mov ebx, 15
|
||||||
@ -53,8 +53,8 @@ _start:
|
|||||||
call echo
|
call echo
|
||||||
n0:
|
n0:
|
||||||
inc [main_x]
|
inc [main_x]
|
||||||
jmp loop_1
|
jmp лоопаа
|
||||||
loop_1e:
|
лоопааe:
|
||||||
;
|
;
|
||||||
mov rax, linux_exit_system_call ; <main> return;;
|
mov rax, linux_exit_system_call ; <main> return;;
|
||||||
xor rdi, rdi
|
xor rdi, rdi
|
||||||
|
52
xiranda.c
52
xiranda.c
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
static int coin_code = 0;
|
static int coin_code = 0;
|
||||||
static int type_code = 0;
|
static int type_code = 0;
|
||||||
static int variable_code = 0;/*
|
static int variable_code = 0;
|
||||||
static int constant_code = 0;
|
static int constant_code = 0;/*
|
||||||
static int function_code = 0;*/
|
static int function_code = 0;*/
|
||||||
|
|
||||||
static int coin_data [240] = { 0 };
|
static int coin_data [240] = { 0 };
|
||||||
@ -17,11 +17,11 @@ static int type_size [27] = { 0 };
|
|||||||
static char variable_name [27] [40] = { "" };
|
static char variable_name [27] [40] = { "" };
|
||||||
static int variable_type [27] = { 0 };
|
static int variable_type [27] = { 0 };
|
||||||
static int variable_data [27] = { 0 };
|
static int variable_data [27] = { 0 };
|
||||||
/*
|
|
||||||
static char constant_name [30] [40] = { "" };
|
static char constant_name [30] [40] = { "" };
|
||||||
static int constant_type [30] = { 0 };
|
static int constant_type [30] = { 0 };
|
||||||
static int constant_data [30] = { 0 };
|
static int constant_data [30] = { 0 };
|
||||||
|
/*
|
||||||
static char function_name [9] [40] = { "" };
|
static char function_name [9] [40] = { "" };
|
||||||
static int function_type [9] = { 0 };
|
static int function_type [9] = { 0 };
|
||||||
static char function_argument_name [9] [6] [40] = { { "" } };
|
static char function_argument_name [9] [6] [40] = { { "" } };
|
||||||
@ -68,7 +68,7 @@ int main (void) {
|
|||||||
int coin_import = syntax_define (false, true, "учитај", " \t\n", '\0', colour_yellow, effect_normal);
|
int coin_import = syntax_define (false, true, "учитај", " \t\n", '\0', colour_yellow, effect_normal);
|
||||||
int coin_system = syntax_define (false, true, "изврши", " \t\n(", '\0', colour_yellow, effect_normal);
|
int coin_system = syntax_define (false, true, "изврши", " \t\n(", '\0', colour_yellow, effect_normal);
|
||||||
int coin_number = syntax_define (true, true, "0123456789", " \t\n,.;:()[]#", '\0', colour_blue, effect_normal);
|
int coin_number = syntax_define (true, true, "0123456789", " \t\n,.;:()[]#", '\0', colour_blue, effect_normal);
|
||||||
int coin_marker = syntax_define (true, true, "љњертзуиопшђасдфгхјклчћжџцвбнм_", " \t\n,.;:()[]#", '\0', colour_white, effect_normal);
|
int coin_marker = syntax_define (true, true, "абвгдђежзијклљмнљопрстћуфхцчџш_", " \t\n,.;:()[]#", '\0', colour_white, effect_normal);
|
||||||
int coin_symbol = syntax_define (true, false, ",.;:=#[]()+-*/%&|!", "", '\0', colour_cyan, effect_normal);
|
int coin_symbol = syntax_define (true, false, ",.;:=#[]()+-*/%&|!", "", '\0', colour_cyan, effect_normal);
|
||||||
|
|
||||||
buffer = record ();
|
buffer = record ();
|
||||||
@ -103,7 +103,34 @@ int main (void) {
|
|||||||
++type_code;
|
++type_code;
|
||||||
} else kill ("Expected semicolon symbol: ", offset);
|
} else kill ("Expected semicolon symbol: ", offset);
|
||||||
} else kill ("Expected number: ", offset);
|
} else kill ("Expected number: ", offset);
|
||||||
} else kill ("Expected equal symbol: ", offset);
|
} else if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == '(')) {
|
||||||
|
int counter = 0;
|
||||||
|
type_size [type_code] = 4;
|
||||||
|
for (++offset; offset < coin_code; ++offset) {
|
||||||
|
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ')')) {
|
||||||
|
++offset;
|
||||||
|
break;
|
||||||
|
} else if (coin_data [offset] == coin_marker) {
|
||||||
|
string_copy (constant_name [constant_code], coin_text [offset]);
|
||||||
|
constant_type [constant_code] = type_code;
|
||||||
|
++offset;
|
||||||
|
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ',')) {
|
||||||
|
constant_data [constant_code] = counter;
|
||||||
|
++counter;
|
||||||
|
++constant_code;
|
||||||
|
} else if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == '=')) {
|
||||||
|
++offset;
|
||||||
|
if (coin_data [offset] == coin_number) {
|
||||||
|
int number = atoi (coin_text [offset]);
|
||||||
|
constant_data [constant_code] = number;
|
||||||
|
counter = number + 1;
|
||||||
|
++constant_code;
|
||||||
|
} else kill ("Expected number:", offset);
|
||||||
|
} else kill ("Expected = or ,:", offset);
|
||||||
|
} else kill ("Expected either marker or close symbol: ", offset);
|
||||||
|
}
|
||||||
|
++type_code;
|
||||||
|
} else kill ("Expected equal or open bracket symbol: ", offset);
|
||||||
} else kill ("Expected marker: ", offset);
|
} else kill ("Expected marker: ", offset);
|
||||||
} else if (coin_data [offset] == coin_marker) {
|
} else if (coin_data [offset] == coin_marker) {
|
||||||
++offset;
|
++offset;
|
||||||
@ -128,18 +155,30 @@ int main (void) {
|
|||||||
variable_data [variable_code] = atoi (coin_text [offset]);
|
variable_data [variable_code] = atoi (coin_text [offset]);
|
||||||
++offset;
|
++offset;
|
||||||
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ';')) {
|
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ';')) {
|
||||||
|
printf ("\033[1;32m%s: %s %i\033[0m\n",
|
||||||
|
variable_name [variable_code],
|
||||||
|
(type_size [variable_type [variable_code]] == 1) ? "db" : "dd",
|
||||||
|
variable_data [variable_code]);
|
||||||
++variable_code;
|
++variable_code;
|
||||||
} else kill ("Expected semicolon symbol: ", offset);
|
} else kill ("Expected semicolon symbol: ", offset);
|
||||||
} else if (coin_data [offset] == coin_string) {
|
} else if (coin_data [offset] == coin_string) {
|
||||||
variable_data [variable_code] = 33;
|
variable_data [variable_code] = 33;
|
||||||
++offset;
|
++offset;
|
||||||
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ';')) {
|
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ';')) {
|
||||||
|
printf ("\033[1;32m%s: %s %i\033[0m\n",
|
||||||
|
variable_name [variable_code],
|
||||||
|
(type_size [variable_type [variable_code]] == 1) ? "db" : "dd",
|
||||||
|
variable_data [variable_code]);
|
||||||
++variable_code;
|
++variable_code;
|
||||||
} else kill ("Expected semicolon symbol: ", offset);
|
} else kill ("Expected semicolon symbol: ", offset);
|
||||||
} else if (coin_data [offset] == coin_marker) {
|
} else if (coin_data [offset] == coin_marker) {
|
||||||
variable_data [variable_code] = 66;
|
variable_data [variable_code] = 66;
|
||||||
++offset;
|
++offset;
|
||||||
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ';')) {
|
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ';')) {
|
||||||
|
printf ("\033[1;32m%s: %s %i\033[0m\n",
|
||||||
|
variable_name [variable_code],
|
||||||
|
(type_size [variable_type [variable_code]] == 1) ? "db" : "dd",
|
||||||
|
variable_data [variable_code]);
|
||||||
++variable_code;
|
++variable_code;
|
||||||
} else kill ("Expected semicolon symbol: ", offset);
|
} else kill ("Expected semicolon symbol: ", offset);
|
||||||
} else kill ("Expected marker, number or string: ", offset);
|
} else kill ("Expected marker, number or string: ", offset);
|
||||||
@ -151,6 +190,7 @@ int main (void) {
|
|||||||
|
|
||||||
/**/for (i = 0; i < type_code; ++i) printf ("-type- %s = %i;\n", type_name [i], type_size [i]);
|
/**/for (i = 0; i < type_code; ++i) printf ("-type- %s = %i;\n", type_name [i], type_size [i]);
|
||||||
/**/for (i = 0; i < variable_code; ++i) printf ("-variable- %s : %s = %i;\n", variable_name [i], type_name [variable_type [i]], variable_data [i]);
|
/**/for (i = 0; i < variable_code; ++i) printf ("-variable- %s : %s = %i;\n", variable_name [i], type_name [variable_type [i]], variable_data [i]);
|
||||||
|
/**/for (i = 0; i < constant_code; ++i) printf ("-constant- %s : %s = %i;\n", constant_name [i], type_name [constant_type [i]], constant_data [i]);
|
||||||
|
|
||||||
buffer = deallocate (buffer);
|
buffer = deallocate (buffer);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user