Jelajahi Sumber

新增整除和求模

SongZihuan 5 tahun lalu
induk
melakukan
56e5dc7ace
9 mengubah file dengan 813 tambahan dan 526 penghapusan
  1. TEMPAT SAMPAH
      gwarf
  2. 95 3
      inter/cfunc.c
  3. 149 8
      inter/interpreter.c
  4. 8 0
      inter/interpreter.h
  5. 2 0
      paser/gwarf_lex.l
  6. 19 1
      paser/gwarf_yacc.y
  7. 235 222
      paser/lex.yy.c
  8. 299 290
      paser/y.tab.c
  9. 6 2
      paser/y.tab.h

TEMPAT SAMPAH
gwarf


+ 95 - 3
inter/cfunc.c

@@ -388,9 +388,9 @@ class_object *gobject_login_official(var_list *the_var, GWARF_result (*paser)(fu
     puts("----stop set class----");
     puts("----stop set class----");
 
 
     // 注册函数
     // 注册函数
-    int a[][2] = {{2,1}, {3,1}, {4,1}, {5,1}, {6,1}, {7,1}, {8,1}, {9,1}, {10,1}, {11,1}, {12,1}, {13,1}, {14,1}, {15,1}, {16,1}, {17,1}, {3,1}, {21,1}, {22,1}, {18,1}, {19,1}, {20,1}};
+    int a[][2] = {{2,1}, {3,1}, {4,1}, {5,1}, {6,1}, {7,1}, {8,1}, {9,1}, {10,1}, {11,1}, {12,1}, {13,1}, {14,1}, {15,1}, {16,1}, {17,1}, {3,1}, {21,1}, {22,1}, {18,1}, {19,1}, {20,1}, {29,1}, {30,1}, {31,1}, {32,1}};
     char *name[] = {"__init__", "__value__", "__add__", "__sub__", "__mul__","__div__","__eq__", "__more__", "__less__", "__eqmore__", "__eqless__","__noteq__", "__pow__", "__log__","__sqrt__","__negative__","__bool__","__subr__",
     char *name[] = {"__init__", "__value__", "__add__", "__sub__", "__mul__","__div__","__eq__", "__more__", "__less__", "__eqmore__", "__eqless__","__noteq__", "__pow__", "__log__","__sqrt__","__negative__","__bool__","__subr__",
-                    "__divr__", "__powr__", "__logr__","__sqrtr__"};
+                    "__divr__", "__powr__", "__logr__","__sqrtr__", "__idiv__","__idivr__", "__mod__","__modr__"};
 
 
     int lenth = sizeof(a)/sizeof(a[0]);
     int lenth = sizeof(a)/sizeof(a[0]);
     for(int i = 0;i < lenth;i+=1){
     for(int i = 0;i < lenth;i+=1){
@@ -861,6 +861,98 @@ GWARF_result gobject_official_func(func *the_func, parameter *tmp_s, var_list *t
             return_value = negative_func(left_tmp, out_var);
             return_value = negative_func(left_tmp, out_var);
             break;
             break;
         }
         }
+        case __idiv__func:{
+            GWARF_result reight_tmp, left_tmp, tmp_result = traverse(tmp_s->u.value, out_var, false);
+            if(is_error(&tmp_result)){  // Name Error错误
+                return_value = tmp_result;
+                goto return_result;
+            }
+            else if(is_space(&tmp_result)){
+                return_value = tmp_result;
+                goto return_result;
+            }
+            GWARF_value base_the_var = tmp_result.value;  // 只有一个参数
+            reight_tmp = get__value__(&base_the_var, the_var);
+            var *tmp = find_var(login_var, 0, "value");
+            if(tmp != NULL){
+                left_tmp.value = tmp->value;
+            }
+            else{
+                left_tmp.value.type = NULL_value;
+                left_tmp.value.value.int_value = 0;
+            }
+            return_value = int_div_func(left_tmp, reight_tmp, out_var);
+            break;
+        }
+        case __idivr__func:{
+            GWARF_result reight_tmp, left_tmp, tmp_result = traverse(tmp_s->u.value, out_var, false);
+            if(is_error(&tmp_result)){  // Name Error错误
+                return_value = tmp_result;
+                goto return_result;
+            }
+            else if(is_space(&tmp_result)){
+                return_value = tmp_result;
+                goto return_result;
+            }
+            GWARF_value base_the_var = tmp_result.value;  // 只有一个参数
+            reight_tmp = get__value__(&base_the_var, the_var);
+            var *tmp = find_var(login_var, 0, "value");
+            if(tmp != NULL){
+                left_tmp.value = tmp->value;
+            }
+            else{
+                left_tmp.value.type = NULL_value;
+                left_tmp.value.value.int_value = 0;
+            }
+            return_value = int_div_func(reight_tmp, left_tmp, out_var);
+            break;
+        }
+        case __mod__func:{
+            GWARF_result reight_tmp, left_tmp, tmp_result = traverse(tmp_s->u.value, out_var, false);
+            if(is_error(&tmp_result)){  // Name Error错误
+                return_value = tmp_result;
+                goto return_result;
+            }
+            else if(is_space(&tmp_result)){
+                return_value = tmp_result;
+                goto return_result;
+            }
+            GWARF_value base_the_var = tmp_result.value;  // 只有一个参数
+            reight_tmp = get__value__(&base_the_var, the_var);
+            var *tmp = find_var(login_var, 0, "value");
+            if(tmp != NULL){
+                left_tmp.value = tmp->value;
+            }
+            else{
+                left_tmp.value.type = NULL_value;
+                left_tmp.value.value.int_value = 0;
+            }
+            return_value = mod_func(left_tmp, reight_tmp, out_var);
+            break;
+        }
+        case __modr__func:{
+            GWARF_result reight_tmp, left_tmp, tmp_result = traverse(tmp_s->u.value, out_var, false);
+            if(is_error(&tmp_result)){  // Name Error错误
+                return_value = tmp_result;
+                goto return_result;
+            }
+            else if(is_space(&tmp_result)){
+                return_value = tmp_result;
+                goto return_result;
+            }
+            GWARF_value base_the_var = tmp_result.value;  // 只有一个参数
+            reight_tmp = get__value__(&base_the_var, the_var);
+            var *tmp = find_var(login_var, 0, "value");
+            if(tmp != NULL){
+                left_tmp.value = tmp->value;
+            }
+            else{
+                left_tmp.value.type = NULL_value;
+                left_tmp.value.value.int_value = 0;
+            }
+            return_value = mod_func(reight_tmp, left_tmp, out_var);
+            break;
+        }
         default:
         default:
             break;
             break;
     }
     }
@@ -1151,7 +1243,7 @@ GWARF_value to_str(GWARF_value value, var_list *the_var){
             snprintf(return_number.value.string, size, "<-class on %u->", value.value.class_value);
             snprintf(return_number.value.string, size, "<-class on %u->", value.value.class_value);
         }
         }
         else{
         else{
-            printf("var value = other\n");
+            return_number.value.string = "other";
         }
         }
     }
     }
     return return_number;
     return return_number;

+ 149 - 8
inter/interpreter.c

@@ -1486,6 +1486,12 @@ GWARF_result operation_func(statement *the_statement, var_list *the_var, var_lis
         case NOT_func:
         case NOT_func:
             value = not_func(right_result, the_var);
             value = not_func(right_result, the_var);
             break;
             break;
+        case MOD_func:
+            value = mod_func(left_result, right_result, the_var);
+            break;
+        case INTDIV_func:
+            value = int_div_func(left_result, right_result, the_var);
+            break;
         default:
         default:
             break;
             break;
     }
     }
@@ -2041,7 +2047,7 @@ GWARF_result sub_func(GWARF_result left_result, GWARF_result right_result, var_l
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         var_list *call_var = base_the_var.value.object_value->the_var;
         var_list *call_var = base_the_var.value.object_value->the_var;
 
 
-        var *tmp = find_var(call_var, 0, "__sub__");
+        var *tmp = find_var(call_var, 0, "__subr__");
         if(tmp != NULL){
         if(tmp != NULL){
             get.value = tmp->value;
             get.value = tmp->value;
             get.father = &base_the_var;  // 设置father
             get.father = &base_the_var;  // 设置father
@@ -2294,7 +2300,7 @@ GWARF_result div_func(GWARF_result left_result, GWARF_result right_result, var_l
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         var_list *call_var = base_the_var.value.object_value->the_var;
         var_list *call_var = base_the_var.value.object_value->the_var;
 
 
-        var *tmp = find_var(call_var, 0, "__div__");
+        var *tmp = find_var(call_var, 0, "__divr__");
         if(tmp != NULL){
         if(tmp != NULL){
             get.value = tmp->value;
             get.value = tmp->value;
             get.father = &base_the_var;  // 设置father
             get.father = &base_the_var;  // 设置father
@@ -2340,6 +2346,140 @@ GWARF_result div_func(GWARF_result left_result, GWARF_result right_result, var_l
     return_back: return_result: return return_value;
     return_back: return_result: return return_value;
 }
 }
 
 
+// ---------  MOD_func
+GWARF_result mod_func(GWARF_result left_result, GWARF_result right_result, var_list *the_var){  // the func for div and call from read_statement_list
+    GWARF_result return_value;  // the result by call read_statement_list with left and right; value is the result for div
+    if(left_result.value.type == OBJECT_value){  // 调用左div方法
+        GWARF_result get;
+        GWARF_value base_the_var = left_result.value;  // 只有一个参数
+        var_list *call_var = base_the_var.value.object_value->the_var;
+
+        var *tmp = find_var(call_var, 0, "__mod__");
+        if(tmp != NULL){
+            get.value = tmp->value;
+            get.father = &base_the_var;  // 设置father
+            return_value = call_back_core(get, the_var, pack_value_parameter(right_result.value));
+            goto return_back;
+        }
+    }
+    if(right_result.value.type == OBJECT_value){  // 调用右div方法
+        GWARF_result get;
+        GWARF_value base_the_var = right_result.value;  // 只有一个参数
+        var_list *call_var = base_the_var.value.object_value->the_var;
+
+        var *tmp = find_var(call_var, 0, "__modr__");
+        if(tmp != NULL){
+            get.value = tmp->value;
+            get.father = &base_the_var;  // 设置father
+            return_value = call_back_core(get, the_var, pack_value_parameter(left_result.value));
+        }
+        else{
+            return_value.u = statement_end;
+            return_value.value = left_result.value;
+        }
+        goto return_back;
+    }
+    {
+        if(left_result.value.type == NULL_value){
+            left_result.value.type = INT_value;
+            left_result.value.value.int_value = 1;
+        }
+        else if(right_result.value.type == NULL_value){
+            return_value.value = left_result.value;  // NULL除 相当于1
+            goto return_result;
+        }
+        // 此处不是else if
+        if((left_result.value.type == INT_value || left_result.value.type == BOOL_value) && (right_result.value.type == INT_value || right_result.value.type == BOOL_value)){  // all is INT
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;
+            return_value.value.value.int_value = (left_result.value.value.int_value % right_result.value.value.int_value);
+        }
+        else if((left_result.value.type == NUMBER_value) && (right_result.value.type == NUMBER_value)){  // all is NUMBER
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;
+            return_value.value.value.int_value = ((int)left_result.value.value.double_value % (int)right_result.value.value.double_value);
+        }
+        else if((left_result.value.type == INT_value || left_result.value.type == BOOL_value) && (right_result.value.type == NUMBER_value)){  // all is NUMBER
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;
+            return_value.value.value.int_value = (left_result.value.value.int_value % (int)right_result.value.value.double_value);
+        }
+        else if((left_result.value.type == NUMBER_value) && (right_result.value.type == INT_value || right_result.value.type == BOOL_value)){  // all is NUMBER
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;
+            return_value.value.value.int_value = ((int)left_result.value.value.double_value % right_result.value.value.int_value);
+        }
+    }
+    return_back: return_result: return return_value;
+}
+
+// ---------  int_div[整除]
+GWARF_result int_div_func(GWARF_result left_result, GWARF_result right_result, var_list *the_var){  // the func for div and call from read_statement_list
+    GWARF_result return_value;  // the result by call read_statement_list with left and right; value is the result for div
+    if(left_result.value.type == OBJECT_value){  // 调用左div方法
+        GWARF_result get;
+        GWARF_value base_the_var = left_result.value;  // 只有一个参数
+        var_list *call_var = base_the_var.value.object_value->the_var;
+
+        var *tmp = find_var(call_var, 0, "__idiv__");
+        if(tmp != NULL){
+            get.value = tmp->value;
+            get.father = &base_the_var;  // 设置father
+            return_value = call_back_core(get, the_var, pack_value_parameter(right_result.value));
+            goto return_back;
+        }
+    }
+    if(right_result.value.type == OBJECT_value){  // 调用右div方法
+        GWARF_result get;
+        GWARF_value base_the_var = right_result.value;  // 只有一个参数
+        var_list *call_var = base_the_var.value.object_value->the_var;
+
+        var *tmp = find_var(call_var, 0, "__idivr__");  // 整除
+        if(tmp != NULL){
+            get.value = tmp->value;
+            get.father = &base_the_var;  // 设置father
+            return_value = call_back_core(get, the_var, pack_value_parameter(left_result.value));
+        }
+        else{
+            return_value.u = statement_end;
+            return_value.value = left_result.value;
+        }
+        goto return_back;
+    }
+    {
+        if(left_result.value.type == NULL_value){
+            left_result.value.type = INT_value;
+            left_result.value.value.int_value = 1;
+        }
+        else if(right_result.value.type == NULL_value){
+            return_value.value = left_result.value;  // NULL除发相当于1
+            goto return_result;
+        }
+        // 此处不是else if
+        if((left_result.value.type == INT_value || left_result.value.type == BOOL_value) && (right_result.value.type == INT_value || right_result.value.type == BOOL_value)){  // all is INT
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;  // 除 无int
+            return_value.value.value.int_value = ((int)left_result.value.value.int_value / (int)right_result.value.value.int_value);
+        }
+        else if((left_result.value.type == NUMBER_value) && (right_result.value.type == NUMBER_value)){  // all is NUMBER
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;
+            return_value.value.value.int_value = ((int)left_result.value.value.double_value / (int)right_result.value.value.double_value);
+        }
+        else if((left_result.value.type == INT_value || left_result.value.type == BOOL_value) && (right_result.value.type == NUMBER_value)){  // all is NUMBER
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;
+            return_value.value.value.int_value = ((int)left_result.value.value.int_value / (int)right_result.value.value.double_value);
+        }
+        else if((left_result.value.type == NUMBER_value) && (right_result.value.type == INT_value || right_result.value.type == BOOL_value)){  // all is NUMBER
+            return_value.u = statement_end;
+            return_value.value.type = INT_value;
+            return_value.value.value.int_value = ((int)left_result.value.value.double_value / (int)right_result.value.value.int_value);
+        }
+    }
+    return_back: return_result: return return_value;
+}
+
 // ---------  POW
 // ---------  POW
 GWARF_result pow_func(GWARF_result left_result, GWARF_result right_result, var_list *the_var){  // the func for div and call from read_statement_list
 GWARF_result pow_func(GWARF_result left_result, GWARF_result right_result, var_list *the_var){  // the func for div and call from read_statement_list
     GWARF_result return_value;  // the result by call read_statement_list with left and right; value is the result for div
     GWARF_result return_value;  // the result by call read_statement_list with left and right; value is the result for div
@@ -2361,7 +2501,7 @@ GWARF_result pow_func(GWARF_result left_result, GWARF_result right_result, var_l
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         var_list *call_var = base_the_var.value.object_value->the_var;
         var_list *call_var = base_the_var.value.object_value->the_var;
 
 
-        var *tmp = find_var(call_var, 0, "__pow__");
+        var *tmp = find_var(call_var, 0, "__powr__");
         if(tmp != NULL){
         if(tmp != NULL){
             get.value = tmp->value;
             get.value = tmp->value;
             get.father = &base_the_var;  // 设置father
             get.father = &base_the_var;  // 设置father
@@ -2427,7 +2567,7 @@ GWARF_result log_func(GWARF_result left_result, GWARF_result right_result, var_l
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         var_list *call_var = base_the_var.value.object_value->the_var;
         var_list *call_var = base_the_var.value.object_value->the_var;
 
 
-        var *tmp = find_var(call_var, 0, "__log__");
+        var *tmp = find_var(call_var, 0, "__logr__");
         if(tmp != NULL){
         if(tmp != NULL){
             get.value = tmp->value;
             get.value = tmp->value;
             get.father = &base_the_var;  // 设置father
             get.father = &base_the_var;  // 设置father
@@ -2493,7 +2633,7 @@ GWARF_result sqrt_func(GWARF_result left_result, GWARF_result right_result, var_
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         var_list *call_var = base_the_var.value.object_value->the_var;
         var_list *call_var = base_the_var.value.object_value->the_var;
 
 
-        var *tmp = find_var(call_var, 0, "__sqrt__");
+        var *tmp = find_var(call_var, 0, "__sqrtr__");
         if(tmp != NULL){
         if(tmp != NULL){
             get.value = tmp->value;
             get.value = tmp->value;
             get.father = &base_the_var;  // 设置father
             get.father = &base_the_var;  // 设置father
@@ -2548,14 +2688,15 @@ GWARF_result assigment_func(char *left, GWARF_result right_result, var_list *the
 GWARF_result equal_func(GWARF_result left_result, GWARF_result right_result, var_list *the_var, int type){  // the func for equal and call from read_statement_list
 GWARF_result equal_func(GWARF_result left_result, GWARF_result right_result, var_list *the_var, int type){  // the func for equal and call from read_statement_list
     GWARF_result return_value;
     GWARF_result return_value;
     int return_bool = false;
     int return_bool = false;
-    char *func_list[] = {"__eq__", "__more__", "__less__", "__eqmore__", "__eqless__","__noteq__"};  // bool 运算符
+    char *left_func_list[] = {"__eq__", "__more__", "__less__", "__eqmore__", "__eqless__","__noteq__"};  // bool 运算符
+    char *right_func_list[] = {"__eq__", "__more__", "__less__", "__eqmore__", "__eqless__","__noteq__"};  // bool 运算符
 
 
     if(left_result.value.type == OBJECT_value){  // 调用左div方法
     if(left_result.value.type == OBJECT_value){  // 调用左div方法
         GWARF_result get;
         GWARF_result get;
         GWARF_value base_the_var = left_result.value;  // 只有一个参数
         GWARF_value base_the_var = left_result.value;  // 只有一个参数
         var_list *call_var = base_the_var.value.object_value->the_var;
         var_list *call_var = base_the_var.value.object_value->the_var;
 
 
-        var *tmp = find_var(call_var, 0, func_list[type]);
+        var *tmp = find_var(call_var, 0, left_func_list[type]);
         if(tmp != NULL){
         if(tmp != NULL){
             get.value = tmp->value;
             get.value = tmp->value;
             get.father = &base_the_var;  // 设置father
             get.father = &base_the_var;  // 设置father
@@ -2568,7 +2709,7 @@ GWARF_result equal_func(GWARF_result left_result, GWARF_result right_result, var
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         GWARF_value base_the_var = right_result.value;  // 只有一个参数
         var_list *call_var = base_the_var.value.object_value->the_var;
         var_list *call_var = base_the_var.value.object_value->the_var;
 
 
-        var *tmp = find_var(call_var, 0, func_list[type]);
+        var *tmp = find_var(call_var, 0, right_func_list[type]);
         if(tmp != NULL){
         if(tmp != NULL){
             get.value = tmp->value;
             get.value = tmp->value;
             get.father = &base_the_var;  // 设置father
             get.father = &base_the_var;  // 设置father

+ 8 - 0
inter/interpreter.h

@@ -121,6 +121,8 @@ typedef struct statement{
                 AND_func,  // -a
                 AND_func,  // -a
                 OR_func,  // -a
                 OR_func,  // -a
                 NOT_func,  // -a
                 NOT_func,  // -a
+                MOD_func,
+                INTDIV_func,
             } type;
             } type;
             struct statement *right_exp;  // the right exp
             struct statement *right_exp;  // the right exp
             struct statement *left_exp;  // the left exp
             struct statement *left_exp;  // the left exp
@@ -374,6 +376,10 @@ typedef enum{
     __slice__func = 26,
     __slice__func = 26,
     __iter__func = 27,
     __iter__func = 27,
     __next__func = 28,
     __next__func = 28,
+    __idiv__func = 29,
+    __idivr__func = 30,
+    __mod__func = 31,
+    __modr__func = 32,
 } official_func_type;
 } official_func_type;
 
 
 typedef struct func{
 typedef struct func{
@@ -430,6 +436,8 @@ GWARF_result assigment_statement(statement *, var_list *, var_list *, GWARF_resu
 GWARF_result not_func(GWARF_result, var_list *);
 GWARF_result not_func(GWARF_result, var_list *);
 GWARF_result or_func(statement *, statement *, var_list *);
 GWARF_result or_func(statement *, statement *, var_list *);
 GWARF_result and_func(statement *, statement *, var_list *);
 GWARF_result and_func(statement *, statement *, var_list *);
+GWARF_result int_div_func(GWARF_result, GWARF_result, var_list *);
+GWARF_result mod_func(GWARF_result, GWARF_result, var_list *);
 
 
 double sqrt_(double, double);
 double sqrt_(double, double);
 double log_(double, double);
 double log_(double, double);

+ 2 - 0
paser/gwarf_lex.l

@@ -66,6 +66,8 @@
 <INITIAL>"+" {return ADD;}
 <INITIAL>"+" {return ADD;}
 <INITIAL>"-" {return SUB;}
 <INITIAL>"-" {return SUB;}
 <INITIAL>"*" {return MUL;}
 <INITIAL>"*" {return MUL;}
+<INITIAL>"%" {return MOD;}
+<INITIAL>"//" {return INTDIV;}
 <INITIAL>"/" {return DIV;}
 <INITIAL>"/" {return DIV;}
 <INITIAL>"[" {return LI;}
 <INITIAL>"[" {return LI;}
 <INITIAL>"]" {return RI;}
 <INITIAL>"]" {return RI;}

+ 19 - 1
paser/gwarf_yacc.y

@@ -23,7 +23,7 @@
 %token <string_value> STRING VAR
 %token <string_value> STRING VAR
 
 
 %token ADD SUB DIV MUL EQ LESS MORE RB LB RP LP WHILE POW LOG SQRT EQUAL MOREEQ LESSEQ NOTEQ BREAK IF ELSE ELIF BROKEN CONTINUE CONTINUED RESTART RESTARTED REGO REWENT RI LI DEFAULT FOR COMMA GLOBAL NONLOCAL INDENTA STOPN STOPF BLOCK FALSE TRUE
 %token ADD SUB DIV MUL EQ LESS MORE RB LB RP LP WHILE POW LOG SQRT EQUAL MOREEQ LESSEQ NOTEQ BREAK IF ELSE ELIF BROKEN CONTINUE CONTINUED RESTART RESTARTED REGO REWENT RI LI DEFAULT FOR COMMA GLOBAL NONLOCAL INDENTA STOPN STOPF BLOCK FALSE TRUE
-%token NULL_token DEF RETURN CLASS POINT COLON TRY EXCEPT AS RAISE THROW IMPORT INCLUDE IN AND OR NOT
+%token NULL_token DEF RETURN CLASS POINT COLON TRY EXCEPT AS RAISE THROW IMPORT INCLUDE IN AND OR NOT MOD INTDIV
 
 
 %type <statement_value> base_value base_var_token base_var_ element second_number first_number zero_number top_exp command third_number while_block while_exp break_exp if_block if_exp broken_exp break_token broken_token continue_token continue_exp
 %type <statement_value> base_value base_var_token base_var_ element second_number first_number zero_number top_exp command third_number while_block while_exp break_exp if_block if_exp broken_exp break_token broken_token continue_token continue_exp
 %type <statement_value> continued_exp continued_token restart_exp restart_token restarted_exp restarted_token default_token for_exp for_block global_token nonlocal_token block_exp block_block call_number def_block def_exp return_exp return_token
 %type <statement_value> continued_exp continued_token restart_exp restart_token restarted_exp restarted_token default_token for_exp for_block global_token nonlocal_token block_exp block_block call_number def_block def_exp return_exp return_token
@@ -307,6 +307,24 @@ first_number
         code_tmp->code.operation.right_exp = $3;
         code_tmp->code.operation.right_exp = $3;
         $$ = code_tmp;
         $$ = code_tmp;
     }
     }
+    | first_number MOD zero_number
+    {
+        statement *code_tmp =  make_statement();
+        code_tmp->type = operation;
+        code_tmp->code.operation.type = MOD_func;
+        code_tmp->code.operation.left_exp = $1;
+        code_tmp->code.operation.right_exp = $3;
+        $$ = code_tmp;
+    }
+    | first_number INTDIV zero_number
+    {
+        statement *code_tmp =  make_statement();
+        code_tmp->type = operation;
+        code_tmp->code.operation.type = INTDIV_func;
+        code_tmp->code.operation.left_exp = $1;
+        code_tmp->code.operation.right_exp = $3;
+        $$ = code_tmp;
+    }
     ;
     ;
 
 
 zero_number
 zero_number

+ 235 - 222
paser/lex.yy.c

@@ -351,8 +351,8 @@ static void yynoreturn yy_fatal_error ( const char* msg  );
 	(yy_hold_char) = *yy_cp; \
 	(yy_hold_char) = *yy_cp; \
 	*yy_cp = '\0'; \
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 	(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 80
-#define YY_END_OF_BUFFER 81
+#define YY_NUM_RULES 82
+#define YY_END_OF_BUFFER 83
 /* This struct is not used in this scanner,
 /* This struct is not used in this scanner,
    but its presence is necessary. */
    but its presence is necessary. */
 struct yy_trans_info
 struct yy_trans_info
@@ -360,32 +360,33 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	flex_int32_t yy_nxt;
 	};
 	};
-static const flex_int16_t yy_accept[220] =
+static const flex_int16_t yy_accept[222] =
     {   0,
     {   0,
-        0,    0,    0,    0,    0,    0,    0,    0,   81,   72,
-       69,   71,   64,   50,   48,   72,   49,   26,   27,   44,
-       42,   17,   43,   65,   45,   67,   67,   18,   70,   34,
-       36,   33,   68,   68,   68,   68,   46,   47,   38,   68,
-       68,   68,   68,   68,   68,   68,   68,   68,   68,   68,
-       68,   68,   68,   28,   72,   29,   39,   71,   75,   73,
-       74,   79,   78,   77,   76,   80,    0,    0,    0,   28,
-        0,   32,   62,   37,    0,   67,   31,   35,   30,   68,
-       68,   68,   68,   53,   68,   68,   68,   68,   68,   68,
-       68,   68,   68,    5,   68,   23,   68,   68,   68,   68,
-
-       68,   68,   68,   68,   28,   63,    0,    0,    0,    0,
-        0,   66,   68,   68,   68,   68,   68,   68,   68,   68,
-       59,   68,   68,   68,   16,   68,   68,   68,   40,   68,
-       68,   68,   68,   68,   68,   68,   68,   51,   68,    0,
-        0,    0,    0,    0,    3,   68,   58,   56,   68,   68,
-       68,   68,   68,   68,    6,    7,   68,   68,   68,   68,
-       68,   68,   14,   68,   68,   68,   41,   68,   68,    1,
-        2,    6,    7,    0,   57,   22,    8,   68,   61,   68,
-       68,    0,   68,   68,   68,   68,   68,   54,   68,   68,
-       68,   55,    4,    2,    0,    9,   68,   68,    7,   52,
-
-       20,   24,   68,   68,   68,   60,   15,   52,   68,   19,
-       25,   68,   11,   10,   21,   68,   13,   12,    0
+        0,    0,    0,    0,    0,    0,    0,    0,   83,   74,
+       71,   73,   66,   52,   50,   45,   74,   51,   26,   27,
+       44,   42,   17,   43,   67,   47,   69,   69,   18,   72,
+       34,   36,   33,   70,   70,   70,   70,   48,   49,   38,
+       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
+       70,   70,   70,   70,   28,   74,   29,   39,   73,   77,
+       75,   76,   81,   80,   79,   78,   82,    0,    0,    0,
+       28,    0,   32,   64,   37,   46,    0,   69,   31,   35,
+       30,   70,   70,   70,   70,   55,   70,   70,   70,   70,
+       70,   70,   70,   70,   70,    5,   70,   23,   70,   70,
+
+       70,   70,   70,   70,   70,   70,   28,   65,    0,    0,
+        0,    0,    0,   68,   70,   70,   70,   70,   70,   70,
+       70,   70,   61,   70,   70,   70,   16,   70,   70,   70,
+       40,   70,   70,   70,   70,   70,   70,   70,   70,   53,
+       70,    0,    0,    0,    0,    0,    3,   70,   60,   58,
+       70,   70,   70,   70,   70,   70,    6,    7,   70,   70,
+       70,   70,   70,   70,   14,   70,   70,   70,   41,   70,
+       70,    1,    2,    6,    7,    0,   59,   22,    8,   70,
+       63,   70,   70,    0,   70,   70,   70,   70,   70,   56,
+       70,   70,   70,   57,    4,    2,    0,    9,   70,   70,
+
+        7,   54,   20,   24,   70,   70,   70,   62,   15,   54,
+       70,   19,   25,   70,   11,   10,   21,   70,   13,   12,
+        0
     } ;
     } ;
 
 
 static const YY_CHAR yy_ec[256] =
 static const YY_CHAR yy_ec[256] =
@@ -393,17 +394,17 @@ static const YY_CHAR yy_ec[256] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    3,    4,    5,    6,    1,    1,    7,    8,    9,
-       10,   11,   12,   13,   14,   15,   16,   17,   18,   18,
-       18,   18,   18,   18,   18,   18,   18,   19,   20,   21,
-       22,   23,    1,    1,   24,   24,   24,   24,   24,   25,
-       24,   24,   24,   24,   24,   24,   24,   26,   24,   24,
-       24,   24,   24,   27,   24,   24,   24,   24,   24,   24,
-       28,    1,   29,   30,   24,    1,   31,   32,   33,   34,
-
-       35,   36,   37,   38,   39,   24,   40,   41,   42,   43,
-       44,   45,   46,   47,   48,   49,   50,   24,   51,   52,
-       53,   24,   54,   55,   56,   57,    1,    1,    1,    1,
+        1,    3,    4,    5,    6,    1,    7,    8,    9,   10,
+       11,   12,   13,   14,   15,   16,   17,   18,   19,   19,
+       19,   19,   19,   19,   19,   19,   19,   20,   21,   22,
+       23,   24,    1,    1,   25,   25,   25,   25,   25,   26,
+       25,   25,   25,   25,   25,   25,   25,   27,   25,   25,
+       25,   25,   25,   28,   25,   25,   25,   25,   25,   25,
+       29,    1,   30,   31,   25,    1,   32,   33,   34,   35,
+
+       36,   37,   38,   39,   40,   25,   41,   42,   43,   44,
+       45,   46,   47,   48,   49,   50,   51,   25,   52,   53,
+       54,   25,   55,   56,   57,   58,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -420,146 +421,148 @@ static const YY_CHAR yy_ec[256] =
         1,    1,    1,    1,    1
         1,    1,    1,    1,    1
     } ;
     } ;
 
 
-static const YY_CHAR yy_meta[58] =
+static const YY_CHAR yy_meta[59] =
     {   0,
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    2,    2,    1,    1,
-        1,    1,    1,    2,    2,    2,    2,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    2,    2,    1,
+        1,    1,    1,    1,    2,    2,    2,    2,    1,    1,
+        1,    2,    2,    2,    2,    2,    2,    2,    2,    2,
         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-        2,    2,    2,    1,    1,    1,    1
+        2,    2,    2,    2,    1,    1,    1,    1
     } ;
     } ;
 
 
-static const flex_int16_t yy_base[224] =
+static const flex_int16_t yy_base[226] =
     {   0,
     {   0,
-        0,  239,   56,   57,   59,   63,    0,    0,  241,  243,
-       67,  237,  217,  243,  243,  231,  243,  243,  243,  226,
-      243,  243,  243,  243,  243,  243,   57,  243,  243,  214,
-      213,  212,    0,  202,  188,  184,  243,  243,  243,  182,
-       19,   32,  194,   36,  184,  186,   42,  182,  181,   48,
-      178,   42,  185,  220,  166,  243,  243,  217,  243,  243,
-      243,  243,  243,  243,  243,  243,   79,  216,   45,  216,
-      214,  243,  243,  243,   73,   77,  243,  243,  243,    0,
-      175,  172,  164,    0,  169,   52,  181,  168,  174,   59,
-      176,  161,  163,    0,  161,  172,  167,  160,  163,   62,
-
-      154,  153,  146,  159,  195,  243,  193,  192,   61,  161,
-      190,   86,  144,  156,  155,  156,  157,  147,  138,  136,
-      153,  147,  147,  146,    0,  148,  135,  137,    0,  136,
-      128,  131,  125,  123,  137,  122,  126,    0,  128,  165,
-      164,  130,  130,  129,  243,  128,    0,    0,  122,  121,
-      125,  111,  119,  107,    0,  147,  110,  123,  106,  102,
-      107,  115,    0,  118,  101,  104,    0,   95,  110,  243,
-      142,  243,  134,   97,    0,    0,    0,   98,    0,   97,
-       91,  121,   81,   88,   79,   93,   93,    0,   78,   81,
-       74,    0,    0,  120,   71,    0,   69,   69,  243,    0,
-
-        0,    0,   82,   85,   66,    0,    0,  243,   77,    0,
-        0,   67,   71,   71,    0,   67,    0,    0,  243,  133,
-      135,  137,   91
+        0,  241,   57,   58,   60,   65,    0,    0,  243,  245,
+       69,  239,  218,  245,  245,  245,  232,  245,  245,  245,
+      227,  245,  245,  245,  245,  221,  245,   57,  245,  245,
+      214,  213,  212,    0,  202,  188,  184,  245,  245,  245,
+      182,   35,   36,  194,   26,  184,  186,   43,  182,  181,
+       52,  178,   43,  185,  221,  166,  245,  245,  218,  245,
+      245,  245,  245,  245,  245,  245,  245,   87,  217,   43,
+      217,  215,  245,  245,  245,  245,   74,   79,  245,  245,
+      245,    0,  175,  172,  164,    0,  169,   58,  181,  168,
+      174,   59,  176,  161,  163,    0,  161,  172,  167,  160,
+
+      163,   62,  154,  153,  146,  159,  196,  245,  194,  193,
+       61,  161,  191,   88,  144,  156,  155,  156,  157,  147,
+      138,  136,  153,  147,  147,  146,    0,  148,  135,  137,
+        0,  136,  128,  131,  125,  123,  137,  122,  126,    0,
+      128,  166,  165,  130,  130,  129,  245,  128,    0,    0,
+      122,  121,  125,  111,  119,  107,    0,  147,  110,  123,
+      106,  102,  107,  115,    0,  118,  101,   97,    0,   88,
+      103,  245,  136,  245,  127,   90,    0,    0,    0,   91,
+        0,   90,   91,  121,   81,   88,   79,   93,   93,    0,
+       78,   81,   72,    0,    0,  119,   70,    0,   68,   68,
+
+      245,    0,    0,    0,   81,   84,   65,    0,    0,  245,
+       77,    0,    0,   67,   68,   67,    0,   31,    0,    0,
+      245,  142,  144,  146,   59
     } ;
     } ;
 
 
-static const flex_int16_t yy_def[224] =
+static const flex_int16_t yy_def[226] =
     {   0,
     {   0,
-      219,    1,  220,  220,  221,  221,  222,  222,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  223,  223,  223,  223,  219,  219,  219,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-
-      223,  223,  223,  223,  219,  219,  219,  219,  219,  219,
-      219,  219,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  219,
-      219,  219,  219,  219,  219,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  219,
-      219,  219,  219,  219,  223,  223,  223,  223,  223,  223,
-      223,  219,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  219,  219,  223,  223,  223,  219,  223,
-
-      223,  223,  223,  223,  223,  223,  223,  219,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,    0,  219,
-      219,  219,  219
+      221,    1,  222,  222,  223,  223,  224,  224,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  225,  225,  225,  225,  221,  221,  221,
+      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+      225,  225,  225,  225,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+
+      225,  225,  225,  225,  225,  225,  221,  221,  221,  221,
+      221,  221,  221,  221,  225,  225,  225,  225,  225,  225,
+      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+      225,  221,  221,  221,  221,  221,  221,  225,  225,  225,
+      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+      225,  221,  221,  221,  221,  221,  225,  225,  225,  225,
+      225,  225,  225,  221,  225,  225,  225,  225,  225,  225,
+      225,  225,  225,  225,  225,  221,  221,  225,  225,  225,
+
+      221,  225,  225,  225,  225,  225,  225,  225,  225,  221,
+      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
+        0,  221,  221,  221,  221
     } ;
     } ;
 
 
-static const flex_int16_t yy_nxt[301] =
+static const flex_int16_t yy_nxt[304] =
     {   0,
     {   0,
        10,   11,   12,   13,   14,   15,   16,   17,   18,   19,
        10,   11,   12,   13,   14,   15,   16,   17,   18,   19,
        20,   21,   22,   23,   24,   25,   26,   27,   28,   29,
        20,   21,   22,   23,   24,   25,   26,   27,   28,   29,
        30,   31,   32,   33,   34,   35,   36,   37,   38,   39,
        30,   31,   32,   33,   34,   35,   36,   37,   38,   39,
-       40,   41,   42,   43,   44,   45,   46,   33,   47,   33,
-       48,   33,   49,   33,   33,   33,   50,   51,   52,   33,
-       53,   33,   33,   54,   55,   56,   57,   60,   60,   85,
-       63,   61,   61,   64,   63,   86,   65,   64,   67,   68,
-       65,   75,   87,   76,   76,   88,   90,   94,   99,  102,
-       67,   68,  100,   95,   96,  109,  117,   91,  103,  112,
-      112,   75,   80,   76,   76,  118,  110,  122,  132,  142,
-
-      218,   69,  112,  112,  217,  216,  123,  215,  143,  133,
-      134,  214,  135,   69,  213,  212,  211,  210,  209,  208,
-       70,  194,  207,  206,  205,  204,  203,  202,  201,  200,
-      199,  198,   70,   59,   59,   62,   62,   66,   66,  197,
-      196,  195,  182,  194,  193,  192,  191,  190,  189,  188,
-      187,  186,  185,  184,  183,  182,  181,  180,  179,  178,
-      177,  176,  175,  174,  173,  172,  171,  170,  169,  168,
-      167,  166,  165,  164,  163,  162,  161,  160,  159,  158,
-      157,  156,  155,  154,  153,  152,  151,  150,  149,  148,
-      147,  146,  145,  144,  141,  140,  105,  139,  138,  137,
-
-      136,  131,  130,  129,  128,  127,  126,  125,  124,  121,
-      120,  119,  116,  115,  114,  113,  111,  105,  108,  107,
-      106,  105,  104,  101,   98,   97,   93,   92,   89,   84,
-       83,   82,   81,   79,   78,   77,   74,   73,   72,   71,
-      219,   58,    9,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219
-
+       40,   41,   42,   43,   44,   45,   46,   47,   34,   48,
+       34,   49,   34,   50,   34,   34,   34,   51,   52,   53,
+       34,   54,   34,   34,   55,   56,   57,   58,   61,   61,
+       82,   64,   62,   62,   65,  220,   64,   92,   66,   65,
+       68,   69,   77,   66,   78,   78,   87,   89,   93,   96,
+       90,  104,   88,  101,  111,   97,   98,  102,   68,   69,
+      105,  114,  114,  119,   77,  112,   78,   78,  124,  134,
+
+      144,  219,  120,  218,   70,  114,  114,  125,  217,  145,
+      135,  136,  216,  137,  215,  214,  213,  212,  211,  210,
+      196,  209,   70,   71,  208,  207,  206,  205,  204,  203,
+      202,  201,  200,  199,  198,  197,  184,  196,  195,  194,
+      193,   71,   60,   60,   63,   63,   67,   67,  192,  191,
+      190,  189,  188,  187,  186,  185,  184,  183,  182,  181,
+      180,  179,  178,  177,  176,  175,  174,  173,  172,  171,
+      170,  169,  168,  167,  166,  165,  164,  163,  162,  161,
+      160,  159,  158,  157,  156,  155,  154,  153,  152,  151,
+      150,  149,  148,  147,  146,  143,  142,  107,  141,  140,
+
+      139,  138,  133,  132,  131,  130,  129,  128,  127,  126,
+      123,  122,  121,  118,  117,  116,  115,  113,  107,  110,
+      109,  108,  107,  106,  103,  100,   99,   95,   94,   91,
+       86,   85,   84,   83,   81,   80,   79,   76,   75,   74,
+       73,   72,  221,   59,    9,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+
+      221,  221,  221
     } ;
     } ;
 
 
-static const flex_int16_t yy_chk[301] =
+static const flex_int16_t yy_chk[304] =
     {   0,
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    3,    4,   41,
-        5,    3,    4,    5,    6,   41,    5,    6,   11,   11,
-        6,   27,   42,   27,   27,   42,   44,   47,   50,   52,
-       67,   67,   50,   47,   47,   69,   86,   44,   52,   75,
-       75,   76,  223,   76,   76,   86,   69,   90,  100,  109,
-
-      216,   11,  112,  112,  214,  213,   90,  212,  109,  100,
-      100,  209,  100,   67,  205,  204,  203,  198,  197,  195,
-       11,  194,  191,  190,  189,  187,  186,  185,  184,  183,
-      182,  181,   67,  220,  220,  221,  221,  222,  222,  180,
-      178,  174,  173,  171,  169,  168,  166,  165,  164,  162,
-      161,  160,  159,  158,  157,  156,  154,  153,  152,  151,
-      150,  149,  146,  144,  143,  142,  141,  140,  139,  137,
-      136,  135,  134,  133,  132,  131,  130,  128,  127,  126,
-      124,  123,  122,  121,  120,  119,  118,  117,  116,  115,
-      114,  113,  111,  110,  108,  107,  105,  104,  103,  102,
-
-      101,   99,   98,   97,   96,   95,   93,   92,   91,   89,
-       88,   87,   85,   83,   82,   81,   71,   70,   68,   58,
-       55,   54,   53,   51,   49,   48,   46,   45,   43,   40,
-       36,   35,   34,   32,   31,   30,   20,   16,   13,   12,
-        9,    2,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  219,  219,  219,  219,  219
-
+        1,    1,    1,    1,    1,    1,    1,    1,    3,    4,
+      225,    5,    3,    4,    5,  218,    6,   45,    5,    6,
+       11,   11,   28,    6,   28,   28,   42,   43,   45,   48,
+       43,   53,   42,   51,   70,   48,   48,   51,   68,   68,
+       53,   77,   77,   88,   78,   70,   78,   78,   92,  102,
+
+      111,  216,   88,  215,   11,  114,  114,   92,  214,  111,
+      102,  102,  211,  102,  207,  206,  205,  200,  199,  197,
+      196,  193,   68,   11,  192,  191,  189,  188,  187,  186,
+      185,  184,  183,  182,  180,  176,  175,  173,  171,  170,
+      168,   68,  222,  222,  223,  223,  224,  224,  167,  166,
+      164,  163,  162,  161,  160,  159,  158,  156,  155,  154,
+      153,  152,  151,  148,  146,  145,  144,  143,  142,  141,
+      139,  138,  137,  136,  135,  134,  133,  132,  130,  129,
+      128,  126,  125,  124,  123,  122,  121,  120,  119,  118,
+      117,  116,  115,  113,  112,  110,  109,  107,  106,  105,
+
+      104,  103,  101,  100,   99,   98,   97,   95,   94,   93,
+       91,   90,   89,   87,   85,   84,   83,   72,   71,   69,
+       59,   56,   55,   54,   52,   50,   49,   47,   46,   44,
+       41,   37,   36,   35,   33,   32,   31,   26,   21,   17,
+       13,   12,    9,    2,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
+
+      221,  221,  221
     } ;
     } ;
 
 
 static yy_state_type yy_last_accepting_state;
 static yy_state_type yy_last_accepting_state;
@@ -587,9 +590,9 @@ char *yytext;
     int flat = 0;
     int flat = 0;
     int is_last = 0;  // 是否\n
     int is_last = 0;  // 是否\n
     int is_stop = 0;  // 针对}需要返回一个}的同时返回一个STOP
     int is_stop = 0;  // 针对}需要返回一个}的同时返回一个STOP
-#line 590 "lex.yy.c"
+#line 593 "lex.yy.c"
 
 
-#line 592 "lex.yy.c"
+#line 595 "lex.yy.c"
 
 
 #define INITIAL 0
 #define INITIAL 0
 #define COMMENT 1
 #define COMMENT 1
@@ -814,7 +817,7 @@ YY_DECL
 	{
 	{
 #line 13 "gwarf_lex.l"
 #line 13 "gwarf_lex.l"
 
 
-#line 817 "lex.yy.c"
+#line 820 "lex.yy.c"
 
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
 		{
@@ -842,13 +845,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 220 )
+				if ( yy_current_state >= 222 )
 					yy_c = yy_meta[yy_c];
 					yy_c = yy_meta[yy_c];
 				}
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 			++yy_cp;
 			++yy_cp;
 			}
 			}
-		while ( yy_base[yy_current_state] != 243 );
+		while ( yy_base[yy_current_state] != 245 );
 
 
 yy_find_action:
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
 		yy_act = yy_accept[yy_current_state];
@@ -1107,203 +1110,213 @@ YY_RULE_SETUP
 case 45:
 case 45:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 69 "gwarf_lex.l"
 #line 69 "gwarf_lex.l"
-{return DIV;}
+{return MOD;}
 	YY_BREAK
 	YY_BREAK
 case 46:
 case 46:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 70 "gwarf_lex.l"
 #line 70 "gwarf_lex.l"
-{return LI;}
+{return INTDIV;}
 	YY_BREAK
 	YY_BREAK
 case 47:
 case 47:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 71 "gwarf_lex.l"
 #line 71 "gwarf_lex.l"
-{return RI;}
+{return DIV;}
 	YY_BREAK
 	YY_BREAK
 case 48:
 case 48:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 73 "gwarf_lex.l"
-{BEGIN COMMENT;}
+#line 72 "gwarf_lex.l"
+{return LI;}
 	YY_BREAK
 	YY_BREAK
 case 49:
 case 49:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 74 "gwarf_lex.l"
-{BEGIN STRING_TEXT;}
+#line 73 "gwarf_lex.l"
+{return RI;}
 	YY_BREAK
 	YY_BREAK
 case 50:
 case 50:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 75 "gwarf_lex.l"
 #line 75 "gwarf_lex.l"
-{BEGIN STRING_TEXT;}
+{BEGIN COMMENT;}
 	YY_BREAK
 	YY_BREAK
 case 51:
 case 51:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 77 "gwarf_lex.l"
-{return TRY;}
+#line 76 "gwarf_lex.l"
+{BEGIN STRING_TEXT;}
 	YY_BREAK
 	YY_BREAK
 case 52:
 case 52:
-/* rule 52 can match eol */
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 78 "gwarf_lex.l"
-{return EXCEPT;}
+#line 77 "gwarf_lex.l"
+{BEGIN STRING_TEXT;}
 	YY_BREAK
 	YY_BREAK
 case 53:
 case 53:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 79 "gwarf_lex.l"
 #line 79 "gwarf_lex.l"
-{return AS;}
+{return TRY;}
 	YY_BREAK
 	YY_BREAK
 case 54:
 case 54:
+/* rule 54 can match eol */
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 80 "gwarf_lex.l"
 #line 80 "gwarf_lex.l"
-{return RAISE;}
+{return EXCEPT;}
 	YY_BREAK
 	YY_BREAK
 case 55:
 case 55:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 81 "gwarf_lex.l"
 #line 81 "gwarf_lex.l"
-{return THROW;}
+{return AS;}
 	YY_BREAK
 	YY_BREAK
 case 56:
 case 56:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 82 "gwarf_lex.l"
 #line 82 "gwarf_lex.l"
-{return TRUE;}
+{return RAISE;}
 	YY_BREAK
 	YY_BREAK
 case 57:
 case 57:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 83 "gwarf_lex.l"
 #line 83 "gwarf_lex.l"
-{return FALSE;}
+{return THROW;}
 	YY_BREAK
 	YY_BREAK
 case 58:
 case 58:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 84 "gwarf_lex.l"
 #line 84 "gwarf_lex.l"
-{return NULL_token;}
+{return TRUE;}
 	YY_BREAK
 	YY_BREAK
 case 59:
 case 59:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 85 "gwarf_lex.l"
 #line 85 "gwarf_lex.l"
-{return DEF;}
+{return FALSE;}
 	YY_BREAK
 	YY_BREAK
 case 60:
 case 60:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 86 "gwarf_lex.l"
 #line 86 "gwarf_lex.l"
-{return RETURN;}
+{return NULL_token;}
 	YY_BREAK
 	YY_BREAK
 case 61:
 case 61:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 87 "gwarf_lex.l"
 #line 87 "gwarf_lex.l"
-{return CLASS;}
+{return DEF;}
 	YY_BREAK
 	YY_BREAK
 case 62:
 case 62:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 88 "gwarf_lex.l"
 #line 88 "gwarf_lex.l"
-{return AND;}
+{return RETURN;}
 	YY_BREAK
 	YY_BREAK
 case 63:
 case 63:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 89 "gwarf_lex.l"
 #line 89 "gwarf_lex.l"
-{return OR;}
+{return CLASS;}
 	YY_BREAK
 	YY_BREAK
 case 64:
 case 64:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 90 "gwarf_lex.l"
 #line 90 "gwarf_lex.l"
-{return NOT;}
+{return AND;}
 	YY_BREAK
 	YY_BREAK
 case 65:
 case 65:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 91 "gwarf_lex.l"
 #line 91 "gwarf_lex.l"
-{return POINT;}
+{return OR;}
 	YY_BREAK
 	YY_BREAK
 case 66:
 case 66:
 YY_RULE_SETUP
 YY_RULE_SETUP
+#line 92 "gwarf_lex.l"
+{return NOT;}
+	YY_BREAK
+case 67:
+YY_RULE_SETUP
 #line 93 "gwarf_lex.l"
 #line 93 "gwarf_lex.l"
+{return POINT;}
+	YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 95 "gwarf_lex.l"
 {
 {
     yylval.double_value = atof(yytext);
     yylval.double_value = atof(yytext);
     return NUMBER;
     return NUMBER;
     }
     }
 	YY_BREAK
 	YY_BREAK
-case 67:
+case 69:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 97 "gwarf_lex.l"
+#line 99 "gwarf_lex.l"
 {
 {
     yylval.double_value = atof(yytext);
     yylval.double_value = atof(yytext);
     return INT;
     return INT;
     }
     }
 	YY_BREAK
 	YY_BREAK
-case 68:
+case 70:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 101 "gwarf_lex.l"
+#line 103 "gwarf_lex.l"
 {
 {
     yylval.string_value = yytext;
     yylval.string_value = yytext;
     return VAR;
     return VAR;
     }
     }
 	YY_BREAK
 	YY_BREAK
-case 69:
-/* rule 69 can match eol */
-YY_RULE_SETUP
-#line 105 "gwarf_lex.l"
-{return STOPN;}
-	YY_BREAK
-case 70:
-YY_RULE_SETUP
-#line 106 "gwarf_lex.l"
-{return STOPF;}
-	YY_BREAK
 case 71:
 case 71:
+/* rule 71 can match eol */
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 107 "gwarf_lex.l"
 #line 107 "gwarf_lex.l"
-;
+{return STOPN;}
 	YY_BREAK
 	YY_BREAK
 case 72:
 case 72:
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 108 "gwarf_lex.l"
 #line 108 "gwarf_lex.l"
-{printf("other text = [%s];\n", yytext);}
+{return STOPF;}
 	YY_BREAK
 	YY_BREAK
 case 73:
 case 73:
-/* rule 73 can match eol */
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 110 "gwarf_lex.l"
-{BEGIN INITIAL;}
+#line 109 "gwarf_lex.l"
+;
 	YY_BREAK
 	YY_BREAK
 case 74:
 case 74:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 111 "gwarf_lex.l"
-{BEGIN INITIAL;}
+#line 110 "gwarf_lex.l"
+{printf("other text = [%s];\n", yytext);}
 	YY_BREAK
 	YY_BREAK
 case 75:
 case 75:
+/* rule 75 can match eol */
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 112 "gwarf_lex.l"
 #line 112 "gwarf_lex.l"
-;
+{BEGIN INITIAL;}
 	YY_BREAK
 	YY_BREAK
 case 76:
 case 76:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 114 "gwarf_lex.l"
+#line 113 "gwarf_lex.l"
 {BEGIN INITIAL;}
 {BEGIN INITIAL;}
 	YY_BREAK
 	YY_BREAK
 case 77:
 case 77:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 115 "gwarf_lex.l"
-{BEGIN INITIAL;}
+#line 114 "gwarf_lex.l"
+;
 	YY_BREAK
 	YY_BREAK
 case 78:
 case 78:
-/* rule 78 can match eol */
 YY_RULE_SETUP
 YY_RULE_SETUP
 #line 116 "gwarf_lex.l"
 #line 116 "gwarf_lex.l"
+{BEGIN INITIAL;}
+	YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 117 "gwarf_lex.l"
+{BEGIN INITIAL;}
+	YY_BREAK
+case 80:
+/* rule 80 can match eol */
+YY_RULE_SETUP
+#line 118 "gwarf_lex.l"
 {
 {
     yylval.string_value = yytext;
     yylval.string_value = yytext;
     return STRING;
     return STRING;
     }
     }
 	YY_BREAK
 	YY_BREAK
-case 79:
+case 81:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 120 "gwarf_lex.l"
+#line 122 "gwarf_lex.l"
 {
 {
     yylval.string_value = yytext;
     yylval.string_value = yytext;
     return STRING;
     return STRING;
     }
     }
 	YY_BREAK
 	YY_BREAK
-case 80:
+case 82:
 YY_RULE_SETUP
 YY_RULE_SETUP
-#line 124 "gwarf_lex.l"
+#line 126 "gwarf_lex.l"
 ECHO;
 ECHO;
 	YY_BREAK
 	YY_BREAK
-#line 1306 "lex.yy.c"
+#line 1319 "lex.yy.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(COMMENT):
 case YY_STATE_EOF(COMMENT):
 case YY_STATE_EOF(STRING_TEXT):
 case YY_STATE_EOF(STRING_TEXT):
@@ -1604,7 +1617,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 220 )
+			if ( yy_current_state >= 222 )
 				yy_c = yy_meta[yy_c];
 				yy_c = yy_meta[yy_c];
 			}
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1632,11 +1645,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 220 )
+		if ( yy_current_state >= 222 )
 			yy_c = yy_meta[yy_c];
 			yy_c = yy_meta[yy_c];
 		}
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-	yy_is_jam = (yy_current_state == 219);
+	yy_is_jam = (yy_current_state == 221);
 
 
 		return yy_is_jam ? 0 : yy_current_state;
 		return yy_is_jam ? 0 : yy_current_state;
 }
 }
@@ -2314,7 +2327,7 @@ void yyfree (void * ptr )
 
 
 #define YYTABLES_NAME "yytables"
 #define YYTABLES_NAME "yytables"
 
 
-#line 124 "gwarf_lex.l"
+#line 126 "gwarf_lex.l"
 
 
 int yywrap(void) {
 int yywrap(void) {
     return 1;
     return 1;

File diff ditekan karena terlalu besar
+ 299 - 290
paser/y.tab.c


+ 6 - 2
paser/y.tab.h

@@ -112,7 +112,9 @@ extern int yydebug;
     IN = 318,
     IN = 318,
     AND = 319,
     AND = 319,
     OR = 320,
     OR = 320,
-    NOT = 321
+    NOT = 321,
+    MOD = 322,
+    INTDIV = 323
   };
   };
 #endif
 #endif
 /* Tokens.  */
 /* Tokens.  */
@@ -180,6 +182,8 @@ extern int yydebug;
 #define AND 319
 #define AND 319
 #define OR 320
 #define OR 320
 #define NOT 321
 #define NOT 321
+#define MOD 322
+#define INTDIV 323
 
 
 /* Value type.  */
 /* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
@@ -194,7 +198,7 @@ union YYSTYPE
     struct if_list *if_list_base;
     struct if_list *if_list_base;
     struct parameter *parameter_list;
     struct parameter *parameter_list;
 
 
-#line 198 "y.tab.h"
+#line 202 "y.tab.h"
 
 
 };
 };
 typedef union YYSTYPE YYSTYPE;
 typedef union YYSTYPE YYSTYPE;

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini