Kaynağa Gözat

Added functions and enumeration assignment, I should sleep...

master
ebeveyn
işleme
691a6a5e11
2 değiştirilmiş dosya ile 30 ekleme ve 7 silme
  1. +7
    -0
      heyo.x
  2. +23
    -7
      xiranda.c

+ 7
- 0
heyo.x Dosyayı Görüntüle

@@ -5,6 +5,13 @@
улаз,
излаз)

одреди системски_позив (
читај = 0,
пиши = 1,
отвори = 2,
затвори = 3,
изађи = 60)

текст: слово = "Здраво свете!";
дужина: број = 12;



+ 23
- 7
xiranda.c Dosyayı Görüntüle

@@ -4,8 +4,8 @@
static int coin_code = 0;
static int type_code = 0;
static int variable_code = 0;
static int constant_code = 0;/*
static int function_code = 0;*/
static int constant_code = 0;
static int function_code = 0;

static int coin_data [240] = { 0 };
static int coin_size [240] = { 0 };
@@ -21,12 +21,12 @@ static int variable_data [27] = { 0 };
static char constant_name [30] [40] = { "" };
static int constant_type [30] = { 0 };
static int constant_data [30] = { 0 };
/*
static char function_name [9] [40] = { "" };
static int function_type [9] = { 0 };
static char function_argument_name [9] [6] [40] = { { "" } };
static int function_argument_type [9] [6] = { { 0 } };
*/
#include <stdio.h>
#include <stdlib.h>
/*
@@ -127,7 +127,6 @@ int main (void) {
constant_data [constant_code] = counter;
++counter;
++constant_code;
/*++offset;*/
break;
} else if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ',')) {
constant_data [constant_code] = counter;
@@ -140,6 +139,12 @@ int main (void) {
constant_data [constant_code] = number;
counter = number + 1;
++constant_code;
++offset;
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ')')) {
break;
} else if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ',')) {
++counter; /* Should I replace this? */
} else kill ("Expected , or ) ", offset);
} else kill ("Expected constant data number:", offset);
} else kill ("Expected = or , or ) ", offset);
} else kill ("Expected constant name marker: ", offset);
@@ -180,10 +185,10 @@ int main (void) {
variable_data [variable_code] = 33;
++offset;
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ';')) {
printf ("\033[1;32m%s: %s %i\033[0m\n",
printf ("\033[1;32m%s: %s %s, 0\033[0m\n",
variable_name [variable_code],
(type_size [variable_type [variable_code]] == 1) ? "db" : "dd",
variable_data [variable_code]);
coin_text [offset - 1]);
++variable_code;
} else kill ("Expected semicolon symbol: ", offset);
} else if (coin_data [offset] == coin_marker) {
@@ -199,6 +204,16 @@ int main (void) {
} else kill ("Expected marker, number or string: ", offset);
} else kill ("Expected equal symbol: ", offset);
} else kill ("Expected type: ", offset);
} else if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == '(')) {
string_copy (function_name [function_code], coin_text [offset - 1]);
++offset;
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ')')) {
++offset;
if ((coin_data [offset] == coin_symbol) && (* coin_text [offset] == ':')) {
echo ("PROCESSING FUNCTION...\n");
++function_code;
} else kill ("Expected void function, symbol :: ", offset);
} else kill ("Expected void function, symbol (): ", offset);
} else kill ("Expected colon, open bracket or equal symbol: ", offset);
}
}
@@ -206,6 +221,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 < 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]);
/**/for (i = 0; i < function_code; ++i) printf ("-function- %s;\n", function_name [i]);

buffer = deallocate (buffer);



Yükleniyor…
İptal
Kaydet