Browse Source

位运算

SongZihuan 5 years ago
parent
commit
9b0eb9b865
8 changed files with 805 additions and 1050 deletions
  1. 82 850
      debug.log
  2. BIN
      gwarf
  3. 0 1
      inter/interpreter.c
  4. 7 5
      paser/lex.h
  5. 77 4
      paser/lexical.c
  6. 459 11
      paser/syntax.c
  7. 28 1
      paser/token.h
  8. 152 178
      status.log

File diff suppressed because it is too large
+ 82 - 850
debug.log


BIN
gwarf


+ 0 - 1
inter/interpreter.c

@@ -1518,7 +1518,6 @@ GWARF_result operation_func(statement *the_statement, var_list *the_var, var_lis
     else if(right_result.u != return_def && is_space(&right_result)){
     else if(right_result.u != return_def && is_space(&right_result)){
         return right_result;
         return right_result;
     }
     }
-
     switch (func_type)  // 获取运算类型
     switch (func_type)  // 获取运算类型
     {
     {
         case ADD_func:
         case ADD_func:

+ 7 - 5
paser/lex.h

@@ -4,7 +4,7 @@
 // 定义lex需要使用的宏
 // 定义lex需要使用的宏
 #define NO_MATCH(paser) \
 #define NO_MATCH(paser) \
     do{ \
     do{ \
-        if((paser->status  == START)){ \
+        if((paser->status == START)){ \
             paser->status = NOTMATCH; \
             paser->status = NOTMATCH; \
         } \
         } \
         else{ \
         else{ \
@@ -41,10 +41,10 @@
     } \
     } \
     } while(0)
     } while(0)
 
 
-#define USE paser->status != NOTMATCH && paser->status != END && paser->status != WAIT_END
+#define USE paser->status != NOTMATCH && paser->status != END && paser->status != WAIT_END && paser->status != S_END
 
 
 #define UNUSE_SET \
 #define UNUSE_SET \
-    else if(paser->status == END){ \
+    else if(paser->status == END || paser->status == S_END){ \
         paser->status = NOTMATCH; \
         paser->status = NOTMATCH; \
     } \
     } \
     else if(paser->status == WAIT_END){ \
     else if(paser->status == WAIT_END){ \
@@ -54,8 +54,10 @@
 // 定义匹配器的状态
 // 定义匹配器的状态
 #define STATUS int
 #define STATUS int
 #define NOTMATCH -1
 #define NOTMATCH -1
-#define END -2
-#define WAIT_END -3
+#define WAIT_END -2
+#define END -3
+// S_END 二级合并
+#define S_END -4
 #define START 0
 #define START 0
 
 
 // 设置mode
 // 设置mode

+ 77 - 4
paser/lexical.c

@@ -5,6 +5,8 @@
 void match_int(char, word_paser *);
 void match_int(char, word_paser *);
 void match_double(char, word_paser *);
 void match_double(char, word_paser *);
 void match_text(char, word_paser *, char *);
 void match_text(char, word_paser *, char *);
+void match_text_s(char, word_paser *, char *);
+void match_var(char p, word_paser *paser);
 
 
 int is_in(int);
 int is_in(int);
 extern void paser_error(char *);
 extern void paser_error(char *);
@@ -71,6 +73,7 @@ int paser(int *index){
         // 执行解析器
         // 执行解析器
         match_int(p, global_paser[INT_PASER]);
         match_int(p, global_paser[INT_PASER]);
         match_double(p, global_paser[DOUBLE_PASER]);
         match_double(p, global_paser[DOUBLE_PASER]);
+        match_var(p, global_paser[VAR_PASER]);
 
 
         // 常规文本解析器
         // 常规文本解析器
         match_text(p, global_paser[ENTER_PASER], "\n");
         match_text(p, global_paser[ENTER_PASER], "\n");
@@ -89,6 +92,17 @@ int paser(int *index){
         match_text(p, global_paser[ELSE_PASER], "else");
         match_text(p, global_paser[ELSE_PASER], "else");
         match_text(p, global_paser[COMMA_PASER], ";");
         match_text(p, global_paser[COMMA_PASER], ";");
         match_text(p, global_paser[FOR_PASER], "for");
         match_text(p, global_paser[FOR_PASER], "for");
+        match_text(p, global_paser[LI_PASER], "[");
+        match_text(p, global_paser[RI_PASER], "]");
+        match_text_s(p, global_paser[POW_PASER], "**");
+        match_text(p, global_paser[LOG_PASER], "log");
+        match_text(p, global_paser[SQRT_PASER], "sqrt");
+        match_text(p, global_paser[BITNOT_PASER], "~");
+        match_text(p, global_paser[BITRIGHT_PASER], ">>");
+        match_text(p, global_paser[BITLEFT_PASER], "<<");
+        match_text(p, global_paser[BITAND_PASER], "&");
+        match_text(p, global_paser[BITOR_PASER], "|");
+        match_text(p, global_paser[BITNOTOR_PASER], "^");
 
 
         *index = check_list(global_paser);  // 检查解析结果
         *index = check_list(global_paser);  // 检查解析结果
 
 
@@ -156,23 +170,39 @@ void free_list(word_paser **paser_list){  // 释放空间
 int check_list(word_paser **paser_list){  // 检查结果
 int check_list(word_paser **paser_list){  // 检查结果
     // 统计数据
     // 统计数据
     int end_count = 0;
     int end_count = 0;
+    int s_end_count = 0;  // 二级合并
     int not_count = 0;
     int not_count = 0;
 
 
     int end_index = 0;  // 最后一个匹配成功的解析器的index
     int end_index = 0;  // 最后一个匹配成功的解析器的index
+    int s_end_index = 0;  // 最后一个匹配成功的解析器的index
     for(int i = 0;i < MAX_PASER_SIZE;i += 1){
     for(int i = 0;i < MAX_PASER_SIZE;i += 1){
         if(paser_list[i]->status == END){  // 统计END的次数
         if(paser_list[i]->status == END){  // 统计END的次数
             end_count += 1;
             end_count += 1;
             end_index = i;
             end_index = i;
         }
         }
-        if(paser_list[i]->status == NOTMATCH){  // 统计END的次数
+        else if(paser_list[i]->status == S_END){  // 统计END的次数
+            s_end_count += 1;
+            s_end_index = i;
+        }
+        else if(paser_list[i]->status == NOTMATCH){  // 统计END的次数
             not_count += 1;
             not_count += 1;
         }
         }
         fprintf(debug, "[debug][lexical]  check list : paser_list[%d]->status = %d\n", i, paser_list[i]->status);
         fprintf(debug, "[debug][lexical]  check list : paser_list[%d]->status = %d\n", i, paser_list[i]->status);
     }
     }
     fprintf(debug, "[debug][lexical]  check list : end_count = %d\n", end_count);
     fprintf(debug, "[debug][lexical]  check list : end_count = %d\n", end_count);
+    fprintf(debug, "[debug][lexical]  check list : s_end_count = %d\n", s_end_count);
     fprintf(debug, "[debug][lexical]  check list : not_count = %d\n", not_count);
     fprintf(debug, "[debug][lexical]  check list : not_count = %d\n", not_count);
     fprintf(debug, "[debug][lexical]  check list : count all = %d\n\n", MAX_PASER_SIZE);
     fprintf(debug, "[debug][lexical]  check list : count all = %d\n\n", MAX_PASER_SIZE);
 
 
+    if(end_count == 0 && s_end_count == 1){  // 晋升
+        end_count = 1;
+        s_end_count = 0;
+        end_index = s_end_index;
+    }
+    else{
+        not_count += s_end_count;  // 降级
+    }
+
     // 需要往回放一个字符
     // 需要往回放一个字符
     if((MAX_PASER_SIZE - not_count - end_count) == 0 && end_count == 1){  // 除了不匹配就是匹配成功,且只有一个成功
     if((MAX_PASER_SIZE - not_count - end_count) == 0 && end_count == 1){  // 除了不匹配就是匹配成功,且只有一个成功
         back_p();  // 回退一个字符[所有匹配成功的都必须吞一个字符,然后再这里统一回退]
         back_p();  // 回退一个字符[所有匹配成功的都必须吞一个字符,然后再这里统一回退]
@@ -200,7 +230,7 @@ void match_int(char p, word_paser *paser){  // 匹配一个int
     UNUSE_SET;  // if(USE)的else语句
     UNUSE_SET;  // if(USE)的else语句
 }
 }
 
 
-void match_double(char p, word_paser *paser){  // 匹配一个int
+void match_double(char p, word_paser *paser){  // 匹配一个double
     if(USE){
     if(USE){
         GET_LEN(paser);
         GET_LEN(paser);
         if((p <= '9' && p >= '0') || (p == '.' && paser->status == 1)){  // 是数字
         if((p <= '9' && p >= '0') || (p == '.' && paser->status == 1)){  // 是数字
@@ -229,6 +259,32 @@ void match_double(char p, word_paser *paser){  // 匹配一个int
 }
 }
 
 
 
 
+void match_var(char p, word_paser *paser){  // 匹配一个var
+    if(USE){
+        GET_LEN(paser);
+        if(paser->status == START){
+            if(p == '_' || (p <= 'z' && p >= 'a')){
+                paser->text = (char *)malloc(sizeof(char));
+                paser->text[len] = p;
+                paser->status = 1;
+            }
+            else{
+                paser->status = NOTMATCH;
+            }
+        }
+        else{
+            if(p == '_' || (p <= 'z' && p >= 'a') || (p <= '9' && p >= '0')){
+                paser->text = (char *)realloc(paser->text, sizeof(char) * (strlen(paser->text) + 1));
+                paser->text[len] = p;
+            }
+            else{
+                paser->status = S_END;
+            }
+        }
+    }
+    UNUSE_SET;
+}
+
 void match_text(char p, word_paser *paser, char *text){  // 匹配换行符
 void match_text(char p, word_paser *paser, char *text){  // 匹配换行符
     char *match = text;  // 待匹配字符串
     char *match = text;  // 待匹配字符串
     if(USE){
     if(USE){
@@ -238,9 +294,26 @@ void match_text(char p, word_paser *paser, char *text){  // 匹配换行符
             CHECK_END(paser);  // 设置是否完全匹配
             CHECK_END(paser);  // 设置是否完全匹配
         }
         }
         else{
         else{
-            // 匹配不成功处理
-            NO_MATCH(paser);  // 如果是START模式则设置为不匹配,否则设置为匹配结束
+            paser->status = NOTMATCH;
         }
         }
     }
     }
     UNUSE_SET;
     UNUSE_SET;
+}
+
+void match_text_s(char p, word_paser *paser, char *text){  // 匹配换行符
+    char *match = text;  // 待匹配字符串
+    if(USE){
+        GET_LEN(paser);  // 设置len并且处理NULL
+        if(p == match[len]){  // 匹配成功
+            SET_TEXT(paser);  // 设置text
+            CHECK_END(paser);  // 设置是否完全匹配
+        }
+        else{
+            paser->status = NOTMATCH;
+        }
+    }
+    else if(paser->status == WAIT_END){
+        paser->status = S_END;
+    }
+    UNUSE_SET;
 }
 }

+ 459 - 11
paser/syntax.c

@@ -3,9 +3,12 @@
 #include"../inter/interpreter.h"
 #include"../inter/interpreter.h"
 
 
 void factor(int *status, token_node *list);
 void factor(int *status, token_node *list);
+void power(int *status, token_node *list);
 void number(int *status, token_node *list);
 void number(int *status, token_node *list);
 void element(int *status, token_node *list);
 void element(int *status, token_node *list);
+void var_token(int *status, token_node *list);
 void polynomial(int *status, token_node *list);
 void polynomial(int *status, token_node *list);
+void bit_move(int *status, token_node *list);
 void command(int *status, token_node *list);
 void command(int *status, token_node *list);
 void while_(int *status, token_node *list);
 void while_(int *status, token_node *list);
 void if_(int *status, token_node *list);
 void if_(int *status, token_node *list);
@@ -13,6 +16,12 @@ void for_(int *status, token_node *list);
 void elif_(int *status, token_node *list);
 void elif_(int *status, token_node *list);
 void block_(int *status, token_node *list);
 void block_(int *status, token_node *list);
 void top_exp(int *status, token_node *list);
 void top_exp(int *status, token_node *list);
+void negative(int *status, token_node *list);
+void bit_not(int *status, token_node *list);
+void bit_notor(int *status, token_node *list);
+void bit_or(int *status, token_node *list);
+void bit_and(int *status, token_node *list);
+
 void paser_error(char *text);
 void paser_error(char *text);
 
 
 /*
 /*
@@ -302,7 +311,7 @@ void for_(int *status, token_node *list){
 
 
         get_right_token(status,list,block_,block_t);
         get_right_token(status,list,block_,block_t);
         if(block_t.type != NON_block){  // 不是表达式
         if(block_t.type != NON_block){  // 不是表达式
-            paser_error("Don't get '{'[s]");
+            paser_error("Don't get '{'");
         }
         }
 
 
         statement *for_tmp =  make_statement();
         statement *for_tmp =  make_statement();
@@ -404,8 +413,8 @@ top_exp : polynomial
 void top_exp(int *status, token_node *list){
 void top_exp(int *status, token_node *list){
     fprintf(status_log, "[info][grammar]  mode status: top_exp\n");
     fprintf(status_log, "[info][grammar]  mode status: top_exp\n");
     token exp;
     token exp;
-    get_base_token(status,list,polynomial,exp);
-    if(exp.type != NON_polynomial){
+    get_base_token(status,list,bit_notor,exp);
+    if(exp.type != NON_bit_notor){
         back_one_token(list, exp);
         back_one_token(list, exp);
         return;
         return;
     }
     }
@@ -414,6 +423,228 @@ void top_exp(int *status, token_node *list){
     return;
     return;
 }
 }
 
 
+/*
+bit_notor : bit_or
+          | bit_notor BITOR bit_or
+*/
+void bit_notor(int *status, token_node *list){  // 因试分解
+    fprintf(status_log, "[info][grammar]  mode status: bit_or\n");
+    token left, right, symbol, new_token;
+
+    left = pop_node(list);  // 先弹出一个token   检查token的类型:区分是模式1,还是模式2/3
+    if(left.type == NON_bit_notor){  // 模式2/3
+        fprintf(status_log, "[info][grammar]  (bit_or)reduce right\n");
+        get_pop_token(status, list, symbol);
+
+        if(symbol.type == BITNOTOR_PASER){  // 模式2/3
+            get_right_token(status, list, bit_or, right);  // 回调右边
+            if(right.type != NON_bit_or){
+                paser_error("Don't get a bit_or");
+            }
+            // 逻辑操作
+            new_token.type = NON_bit_notor;
+            new_token.data_type = statement_value;
+
+            statement *code_tmp =  make_statement();
+            code_tmp->type = operation;
+            code_tmp->code.operation.type = BITNOTOR_func;
+            code_tmp->code.operation.left_exp = left.data.statement_value;
+            code_tmp->code.operation.right_exp = right.data.statement_value;
+            
+            new_token.data.statement_value = code_tmp;
+            add_node(list, new_token);  // 压入节点[弹出3个压入1个]
+            return bit_notor(status, list);  // 回调自己
+        }
+        else{  // 递归跳出
+            // 回退,也就是让下一次pop的时候读取到的是left而不是symbol
+            fprintf(status_log, "[info][grammar]  (bit_notor)out\n");
+            back_one_token(list, left);
+            back_again(list, symbol);
+            return;
+        }
+    }
+    else{  // 模式1
+        fprintf(status_log, "[info][grammar]  (bit_or)back one token to (bit_and)\n");
+        back_one_token(list, left);
+        get_base_token(status, list, bit_or, new_token);
+        if(new_token.type != NON_bit_or){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_bit_notor;
+        add_node(list, new_token);
+        return bit_notor(status, list);  // 回调自己
+    }
+}
+
+/*
+bit_or : bit_and
+       | bit_or BITOR bit_and
+*/
+void bit_or(int *status, token_node *list){  // 因试分解
+    fprintf(status_log, "[info][grammar]  mode status: bit_or\n");
+    token left, right, symbol, new_token;
+
+    left = pop_node(list);  // 先弹出一个token   检查token的类型:区分是模式1,还是模式2/3
+    if(left.type == NON_bit_or){  // 模式2/3
+        fprintf(status_log, "[info][grammar]  (bit_or)reduce right\n");
+        get_pop_token(status, list, symbol);
+
+        if(symbol.type == BITOR_PASER){  // 模式2/3
+            get_right_token(status, list, bit_and, right);  // 回调右边
+            if(right.type != NON_bit_and){
+                paser_error("Don't get a bit_and");
+            }
+            // 逻辑操作
+            new_token.type = NON_bit_or;
+            new_token.data_type = statement_value;
+
+            statement *code_tmp =  make_statement();
+            code_tmp->type = operation;
+            code_tmp->code.operation.type = BITOR_func;
+            code_tmp->code.operation.left_exp = left.data.statement_value;
+            code_tmp->code.operation.right_exp = right.data.statement_value;
+            
+            new_token.data.statement_value = code_tmp;
+            add_node(list, new_token);  // 压入节点[弹出3个压入1个]
+            return bit_or(status, list);  // 回调自己
+        }
+        else{  // 递归跳出
+            // 回退,也就是让下一次pop的时候读取到的是left而不是symbol
+            fprintf(status_log, "[info][grammar]  (bit_or)out\n");
+            back_one_token(list, left);
+            back_again(list, symbol);
+            return;
+        }
+    }
+    else{  // 模式1
+        fprintf(status_log, "[info][grammar]  (bit_or)back one token to (bit_and)\n");
+        back_one_token(list, left);
+        get_base_token(status, list, bit_and, new_token);
+        if(new_token.type != NON_bit_and){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_bit_or;
+        add_node(list, new_token);
+        return bit_or(status, list);  // 回调自己
+    }
+}
+
+/*
+bit_and : bit_move
+        | bit_and BITAND bit_move
+*/
+void bit_and(int *status, token_node *list){  // 因试分解
+    fprintf(status_log, "[info][grammar]  mode status: bit_and\n");
+    token left, right, symbol, new_token;
+
+    left = pop_node(list);  // 先弹出一个token   检查token的类型:区分是模式1,还是模式2/3
+    if(left.type == NON_bit_and){  // 模式2/3
+        fprintf(status_log, "[info][grammar]  (factor)reduce right\n");
+        get_pop_token(status, list, symbol);
+
+        if(symbol.type == BITAND_PASER){  // 模式2/3
+            get_right_token(status, list, bit_move, right);  // 回调右边
+            if(right.type != NON_bit_move){
+                paser_error("Don't get a bit_move");
+            }
+            // 逻辑操作
+            new_token.type = NON_bit_and;
+            new_token.data_type = statement_value;
+
+            statement *code_tmp =  make_statement();
+            code_tmp->type = operation;
+            code_tmp->code.operation.type = BITAND_func;
+            code_tmp->code.operation.left_exp = left.data.statement_value;
+            code_tmp->code.operation.right_exp = right.data.statement_value;
+            
+            new_token.data.statement_value = code_tmp;
+            add_node(list, new_token);  // 压入节点[弹出3个压入1个]
+            return bit_and(status, list);  // 回调自己
+        }
+        else{  // 递归跳出
+            // 回退,也就是让下一次pop的时候读取到的是left而不是symbol
+            fprintf(status_log, "[info][grammar]  (bit_and)out\n");
+            back_one_token(list, left);
+            back_again(list, symbol);
+            return;
+        }
+    }
+    else{  // 模式1
+        fprintf(status_log, "[info][grammar]  (bit_move)back one token to (factor)\n");
+        back_one_token(list, left);
+        get_base_token(status, list, bit_move, new_token);
+        if(new_token.type != NON_bit_move){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_bit_and;
+        add_node(list, new_token);
+        return bit_and(status, list);  // 回调自己
+    }
+}
+
+/*
+bit_move : power
+         | bit_move BITRIGHT factor
+         | bit_move BITLEFT factor
+*/
+void bit_move(int *status, token_node *list){  // 因试分解
+    fprintf(status_log, "[info][grammar]  mode status: factor\n");
+    token left, right, symbol, new_token;
+
+    left = pop_node(list);  // 先弹出一个token   检查token的类型:区分是模式1,还是模式2/3
+    if(left.type == NON_bit_move){  // 模式2/3
+        fprintf(status_log, "[info][grammar]  (factor)reduce right\n");
+        get_pop_token(status, list, symbol);
+
+        if(symbol.type == BITRIGHT_PASER || symbol.type == BITLEFT_PASER){  // 模式2/3
+            get_right_token(status, list, polynomial, right);  // 回调右边
+            if(right.type != NON_polynomial){
+                paser_error("Don't get a polynomial");
+            }
+            // 逻辑操作
+            new_token.type = NON_bit_move;
+            new_token.data_type = statement_value;
+            statement *code_tmp =  make_statement();
+            code_tmp->type = operation;
+
+            if(symbol.type == BITRIGHT_PASER){
+                code_tmp->code.operation.type = BITRIGHT_func;
+            }
+            else{
+                code_tmp->code.operation.type = BITLEFT_func;
+            }
+            code_tmp->code.operation.left_exp = left.data.statement_value;
+            code_tmp->code.operation.right_exp = right.data.statement_value;
+            new_token.data.statement_value = code_tmp;
+            add_node(list, new_token);  // 压入节点[弹出3个压入1个]
+            return bit_move(status, list);  // 回调自己
+        }
+        else{  // 递归跳出
+            // 回退,也就是让下一次pop的时候读取到的是left而不是symbol
+            fprintf(status_log, "[info][grammar]  (bit_move)out\n");
+            back_one_token(list, left);
+            back_again(list, symbol);
+            return;
+        }
+    }
+    else{  // 模式1
+        fprintf(status_log, "[info][grammar]  (bit_move)back one token to (factor)\n");
+        back_one_token(list, left);
+        get_base_token(status, list, polynomial, new_token);
+        if(new_token.type != NON_polynomial){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_bit_move;
+        add_node(list, new_token);
+        return bit_move(status, list);  // 回调自己
+    }
+}
+
+
 /*
 /*
 polynomial : factor
 polynomial : factor
            | polynomial ADD factor
            | polynomial ADD factor
@@ -472,9 +703,9 @@ void polynomial(int *status, token_node *list){  // 多项式
 }
 }
 
 
 /*
 /*
-factor : element
-       | factor MUL element
-       | factor DIV element
+factor : power
+       | factor MUL power
+       | factor DIV power
 */
 */
 void factor(int *status, token_node *list){  // 因试分解
 void factor(int *status, token_node *list){  // 因试分解
     fprintf(status_log, "[info][grammar]  mode status: factor\n");
     fprintf(status_log, "[info][grammar]  mode status: factor\n");
@@ -486,8 +717,8 @@ void factor(int *status, token_node *list){  // 因试分解
         get_pop_token(status, list, symbol);
         get_pop_token(status, list, symbol);
 
 
         if(symbol.type == MUL_PASER || symbol.type == DIV_PASER){  // 模式2/3
         if(symbol.type == MUL_PASER || symbol.type == DIV_PASER){  // 模式2/3
-            get_right_token(status, list, element, right);  // 回调右边
-            if(right.type != NON_element){
+            get_right_token(status, list, negative, right);  // 回调右边
+            if(right.type != NON_negative){
                 paser_error("Don't get a value");
                 paser_error("Don't get a value");
             }
             }
             // 逻辑操作
             // 逻辑操作
@@ -519,8 +750,8 @@ void factor(int *status, token_node *list){  // 因试分解
     else{  // 模式1
     else{  // 模式1
         fprintf(status_log, "[info][grammar]  (factor)back one token to (element)\n");
         fprintf(status_log, "[info][grammar]  (factor)back one token to (element)\n");
         back_one_token(list, left);
         back_one_token(list, left);
-        get_base_token(status, list, element, new_token);
-        if(new_token.type != NON_element){
+        get_base_token(status, list, negative, new_token);
+        if(new_token.type != NON_negative){
             back_one_token(list, new_token);  // 往回[不匹配类型]
             back_one_token(list, new_token);  // 往回[不匹配类型]
             return;
             return;
         }
         }
@@ -530,6 +761,155 @@ void factor(int *status, token_node *list){  // 因试分解
     }
     }
 }
 }
 
 
+/*
+negative : bit_not
+         | BITNOT bit_not
+*/
+void negative(int *status, token_node *list){
+    fprintf(status_log, "[info][grammar]  mode status: negative\n");
+    token left, right, new_token;
+
+    left = pop_node(list);  // 先弹出一个token   检查token的类型:区分是模式1,还是模式2/3
+    if(left.type == SUB_PASER){  // 模式2
+        fprintf(status_log, "[info][grammar]  (bit_not)reduce right\n");
+
+        get_right_token(status, list, bit_not, right);  // 回调右边
+        if(right.type != NON_bit_not){
+            paser_error("Don't get a bit_not");
+        }
+        // 逻辑操作
+        new_token.type = NON_negative;
+        new_token.data_type = statement_value;
+        statement *code_tmp =  make_statement();
+        code_tmp->type = operation;
+        code_tmp->code.operation.type = NEGATIVE_func;
+
+        code_tmp->code.operation.left_exp = NULL;
+        code_tmp->code.operation.right_exp = right.data.statement_value;
+        new_token.data.statement_value = code_tmp;
+        add_node(list, new_token);  // 压入节点[弹出3个压入1个]
+        return;  // 回调自己
+    }
+    else{  // 模式1
+        fprintf(status_log, "[info][grammar]  (negative)back one token to (bit_not)\n");
+        back_one_token(list, left);
+        get_base_token(status, list, bit_not, new_token);
+        if(new_token.type != NON_bit_not){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_negative;
+        add_node(list, new_token);
+        return;
+    }
+}
+
+/*
+bit_not : power
+        | BITNOT power
+*/
+void bit_not(int *status, token_node *list){
+    fprintf(status_log, "[info][grammar]  mode status: bit_not\n");
+    token left, right, new_token;
+
+    left = pop_node(list);  // 先弹出一个token   检查token的类型:区分是模式1,还是模式2/3
+    if(left.type == BITNOT_PASER){  // 模式2
+        fprintf(status_log, "[info][grammar]  (bit_not)reduce right\n");
+
+        get_right_token(status, list, power, right);  // 回调右边
+        if(right.type != NON_power){
+            paser_error("Don't get a power");
+        }
+        // 逻辑操作
+        new_token.type = NON_bit_not;
+        new_token.data_type = statement_value;
+        statement *code_tmp =  make_statement();
+        code_tmp->type = operation;
+        code_tmp->code.operation.type = BITNOT_func;
+
+        code_tmp->code.operation.left_exp = NULL;
+        code_tmp->code.operation.right_exp = right.data.statement_value;
+        new_token.data.statement_value = code_tmp;
+        add_node(list, new_token);  // 压入节点[弹出3个压入1个]
+        return;  // 回调自己
+    }
+    else{  // 模式1
+        fprintf(status_log, "[info][grammar]  (bit_not)back one token to (power)\n");
+        back_one_token(list, left);
+        get_base_token(status, list, power, new_token);
+        if(new_token.type != NON_power){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_bit_not;
+        add_node(list, new_token);
+        return;
+    }
+}
+
+/*
+power : element
+      | power POW element
+      | power LOG element
+      | power SQRT element
+*/
+void power(int *status, token_node *list){
+    fprintf(status_log, "[info][grammar]  mode status: power\n");
+    token left, right, symbol, new_token;
+
+    left = pop_node(list);  // 先弹出一个token   检查token的类型:区分是模式1,还是模式2/3
+    if(left.type == NON_power){  // 模式2/3
+        fprintf(status_log, "[info][grammar]  (power)reduce right\n");
+        get_pop_token(status, list, symbol);
+
+        if(symbol.type == POW_PASER || symbol.type == LOG_PASER || symbol.type == SQRT_PASER){  // 模式2/3/4
+            get_right_token(status, list, element, right);  // 回调右边
+            if(right.type != NON_element){
+                paser_error("Don't get a value");
+            }
+            // 逻辑操作
+            new_token.type = NON_power;
+            new_token.data_type = statement_value;
+            statement *code_tmp =  make_statement();
+            code_tmp->type = operation;
+
+            if(symbol.type == POW_PASER){
+                code_tmp->code.operation.type = POW_func;
+            }
+            else if(symbol.type == LOG_PASER){
+                code_tmp->code.operation.type = LOG_func;
+            }
+            else{
+                code_tmp->code.operation.type = SQRT_func;
+            }
+            code_tmp->code.operation.left_exp = left.data.statement_value;
+            code_tmp->code.operation.right_exp = right.data.statement_value;
+            new_token.data.statement_value = code_tmp;
+            add_node(list, new_token);  // 压入节点[弹出3个压入1个]
+            return power(status, list);  // 回调自己
+        }
+        else{  // 递归跳出
+            // 回退,也就是让下一次pop的时候读取到的是left而不是symbol
+            fprintf(status_log, "[info][grammar]  (power)out\n");
+            back_one_token(list, left);
+            back_again(list, symbol);
+            return;
+        }
+    }
+    else{  // 模式1
+        fprintf(status_log, "[info][grammar]  (power)back one token to (element)\n");
+        back_one_token(list, left);
+        get_base_token(status, list, element, new_token);
+        if(new_token.type != NON_element){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_power;
+        add_node(list, new_token);
+        return power(status, list);  // 回调自己
+    }
+}
+
 /*
 /*
 element : number
 element : number
         | LB top_exp RB
         | LB top_exp RB
@@ -545,15 +925,50 @@ void element(int *status, token_node *list){  // 数字归约
         if(new_token.type != NON_top_exp){
         if(new_token.type != NON_top_exp){
             paser_error("Don't get 'top_exp'");            
             paser_error("Don't get 'top_exp'");            
         }
         }
-        new_token.type = NON_element;
         token rb;
         token rb;
         get_pop_token(status, list ,rb);
         get_pop_token(status, list ,rb);
         if(rb.type != RB_PASER){  // 匹配失败
         if(rb.type != RB_PASER){  // 匹配失败
             paser_error("Don't get ')'");
             paser_error("Don't get ')'");
         }
         }
+        new_token.type = NON_element;
         add_node(list, new_token);  // 压入节点
         add_node(list, new_token);  // 压入节点
         return;
         return;
     }
     }
+    else if(gett.type == VAR_PASER){  // a
+        back_one_token(list, gett);
+        get_base_token(status, list, var_token, new_token);
+        if(new_token.type != NON_base_var){
+            back_one_token(list, new_token);  // 往回[不匹配类型]
+            return;
+        }
+        new_token.type = NON_element;
+        add_node(list, new_token);
+        return;
+    }
+    else if(gett.type == LI_PASER){  // [1]a或[1]列表或[1,2,3,4]列表
+        back_one_token(list, gett);
+        token exp_token, rb, tmp_var;
+        get_right_token(status, list, top_exp, exp_token);
+        if(exp_token.type != NON_top_exp){
+            paser_error("Don't get 'top_exp'");            
+        }
+        get_pop_token(status, list ,rb);
+        if(rb.type != RI_PASER){  // 匹配失败  TODO:: 检查是不是[1,2,3,4]的列表类型
+            paser_error("Don't get ']'");
+        }
+        get_pop_token(status, list ,tmp_var);
+        if(tmp_var.type == VAR_PASER){  // a
+            back_one_token(list, tmp_var);
+            get_base_token(status, list, var_token, new_token);
+            if(new_token.type != NON_base_var){
+                paser_error("Don't get var");
+            }
+            new_token.data.statement_value->code.base_var.from = exp_token.data.statement_value;
+        }
+        new_token.type = NON_element;
+        add_node(list, new_token);
+        return;
+    }
     else{
     else{
         fprintf(status_log, "[info][grammar]  (element)back one token to (number)\n");
         fprintf(status_log, "[info][grammar]  (element)back one token to (number)\n");
         back_one_token(list, gett);
         back_one_token(list, gett);
@@ -568,6 +983,39 @@ void element(int *status, token_node *list){  // 数字归约
 
 
     }
     }
 }
 }
+/*
+var_token : VAR
+*/
+void var_token(int *status, token_node *list){  // 数字归约
+    fprintf(status_log, "[info][grammar]  mode status: var_token\n");
+    token gett, new_token;
+
+    gett = pop_node(list);  // 取得一个token
+    if(gett.type == VAR_PASER){  // var类型
+        new_token.type = NON_base_var;
+
+        GWARF_value tmp_value;
+        tmp_value.type = INT_value;
+        tmp_value.value.int_value = atoi(gett.data.text);
+
+        statement *code_tmp =  make_statement();
+        code_tmp->type = base_var;
+        code_tmp->code.base_var.var_name = gett.data.text;
+        code_tmp->code.base_var.from = NULL;
+        
+        new_token.data.statement_value = code_tmp;
+        new_token.data_type = statement_value;
+
+        fprintf(status_log, "[info][grammar]  (var_token)out\n");
+        add_node(list, new_token);  // 压入节点
+        return;
+    }
+    else{  // 不是期望值
+        fprintf(status_log, "[info][grammar]  (var_token)back one token\n");
+        back_one_token(list, gett);
+        return;
+    }
+}
 
 
 /*
 /*
 number : INT_PASER
 number : INT_PASER

+ 28 - 1
paser/token.h

@@ -3,7 +3,7 @@
 
 
 #include "../inter/interpreter.h"
 #include "../inter/interpreter.h"
 
 
-#define MAX_PASER_SIZE 18
+#define MAX_PASER_SIZE 30
 #define INT_PASER 0
 #define INT_PASER 0
 #define DOUBLE_PASER 1
 #define DOUBLE_PASER 1
 #define ENTER_PASER 2
 #define ENTER_PASER 2
@@ -22,6 +22,18 @@
 #define ELSE_PASER 15
 #define ELSE_PASER 15
 #define COMMA_PASER 16
 #define COMMA_PASER 16
 #define FOR_PASER 17
 #define FOR_PASER 17
+#define VAR_PASER 18
+#define LI_PASER 19
+#define RI_PASER 20
+#define POW_PASER 21
+#define LOG_PASER 22
+#define SQRT_PASER 23
+#define BITNOT_PASER 24
+#define BITRIGHT_PASER 25
+#define BITLEFT_PASER 26
+#define BITAND_PASER 27
+#define BITOR_PASER 28
+#define BITNOTOR_PASER 29
 
 
 // 获取并返回一个token
 // 获取并返回一个token
 #define get_pop_token(status,list,new_token) \
 #define get_pop_token(status,list,new_token) \
@@ -89,6 +101,13 @@ typedef enum token_type
     ELIF = ELIF_PASER,
     ELIF = ELIF_PASER,
     ELSE = ELSE_PASER,
     ELSE = ELSE_PASER,
     COMMA = COMMA_PASER,
     COMMA = COMMA_PASER,
+    VAR = VAR_PASER,
+    BITNOT = BITNOT_PASER,
+    BITRIGHT = BITRIGHT_PASER,
+    BITLEFT = BITLEFT_PASER,
+    BITAND = BITAND_PASER,
+    BITOR = BITOR_PASER,
+    BITNOTOR = BITNOTOR_PASER,
 
 
     // 特殊符号
     // 特殊符号
     BAD_token = -2,
     BAD_token = -2,
@@ -108,6 +127,14 @@ typedef enum token_type
     NON_else = -15,
     NON_else = -15,
     NON_for = -16,
     NON_for = -16,
     NON_element = -17,
     NON_element = -17,
+    NON_base_var = -18,
+    NON_power = -19,
+    NON_bit_not = -20,
+    NON_negative = -21,
+    NON_bit_move = -22,
+    NON_bit_and = -23,
+    NON_bit_or = -24,
+    NON_bit_notor = -25,
 } token_type;
 } token_type;
 
 
 typedef union token_data
 typedef union token_data

+ 152 - 178
status.log

@@ -1,4 +1,4 @@
-[debug][grammar]  get token type : 17; data type : 0
+[debug][grammar]  get token type : 0; data type : 0
 [debug][grammar]  add a token[seek : 0, index : 0, size : 1]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [info][grammar]  mode status: top_exp
 [info][grammar]  mode status: top_exp
@@ -8,26 +8,30 @@
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [info][grammar]  mode status: command
 [info][grammar]  mode status: command
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (command)back one token to (for)
+[info][grammar]  (command)back one token to (top_exp)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: while_
+[info][grammar]  mode status: top_exp
+[info][grammar]  mode status: bit_or
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 8; data type : 0
+[info][grammar]  (bit_or)back one token to (bit_and)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: bit_or
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 16; data type : 0
+[info][grammar]  (bit_or)back one token to (bit_and)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: bit_and
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 0; data type : 0
+[info][grammar]  (bit_move)back one token to (factor)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: factor
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (bit_move)back one token to (factor)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: top_exp
 [info][grammar]  mode status: polynomial
 [info][grammar]  mode status: polynomial
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [info][grammar]  (polynomial)back one token to (factor)
 [info][grammar]  (polynomial)back one token to (factor)
@@ -38,6 +42,21 @@
 [info][grammar]  (factor)back one token to (element)
 [info][grammar]  (factor)back one token to (element)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: negative
+[debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (negative)back one token to (bit_not)
+[debug][grammar]  add a token[seek : 0, index : 0, size : 2]
+[debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: bit_not
+[debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (bit_not)back one token to (power)
+[debug][grammar]  add a token[seek : 0, index : 0, size : 2]
+[debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: power
+[debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (power)back one token to (element)
+[debug][grammar]  add a token[seek : 0, index : 0, size : 2]
+[debug][grammar]  after add a token[seek : 1, index : 1]
 [info][grammar]  mode status: element
 [info][grammar]  mode status: element
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [info][grammar]  (element)back one token to (number)
 [info][grammar]  (element)back one token to (number)
@@ -45,7 +64,7 @@
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [info][grammar]  mode status: number
 [info][grammar]  mode status: number
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (number)get int number: 1
+[info][grammar]  (number)get int number: 33
 [info][grammar]  (number)add one token
 [info][grammar]  (number)add one token
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
@@ -55,14 +74,14 @@
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: factor
+[info][grammar]  mode status: power
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)reduce right
-[debug][grammar]  get token type : 4; data type : 0
+[info][grammar]  (power)reduce right
+[debug][grammar]  get token type : 29; data type : 0
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)out
+[info][grammar]  (power)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 2]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 2]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 2]
@@ -71,42 +90,16 @@
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 2]
 [debug][grammar]  after add a token[seek : 1, index : 2]
-[info][grammar]  mode status: polynomial
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
-[info][grammar]  (polynomial)reduce right
-[debug][grammar]  get token seek += 1 : 0, index : 1
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 0; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)back one token to (element)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: element
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (element)back one token to (number)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: number
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (number)get int number: 1
-[info][grammar]  (number)add one token
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
 [info][grammar]  mode status: factor
 [info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 0, index : 0]
+[debug][grammar]  pop a token[seek : 0, index : 1]
 [info][grammar]  (factor)reduce right
 [info][grammar]  (factor)reduce right
-[debug][grammar]  get token type : 16; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [info][grammar]  (factor)out
 [info][grammar]  (factor)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
@@ -131,51 +124,12 @@
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 2]
 [debug][grammar]  after add a token[seek : 1, index : 2]
-[debug][grammar]  pop a token[seek : 0, index : 1]
-[debug][grammar]  get token seek += 1 : 0, index : 1
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 0; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: top_exp
-[info][grammar]  mode status: polynomial
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (polynomial)back one token to (factor)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
 [info][grammar]  mode status: factor
 [info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)back one token to (element)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: element
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (element)back one token to (number)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: number
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (number)get int number: 1
-[info][grammar]  (number)add one token
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 0, index : 0]
+[debug][grammar]  pop a token[seek : 0, index : 1]
 [info][grammar]  (factor)reduce right
 [info][grammar]  (factor)reduce right
-[debug][grammar]  get token type : 4; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)out
+[info][grammar]  (bit_move)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 3]
@@ -184,44 +138,12 @@
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 2]
 [debug][grammar]  after add a token[seek : 1, index : 2]
-[info][grammar]  mode status: polynomial
+[info][grammar]  mode status: bit_and
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
-[info][grammar]  (polynomial)reduce right
-[debug][grammar]  get token seek += 1 : 0, index : 1
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 0; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)back one token to (element)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: element
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (element)back one token to (number)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: number
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (number)get int number: 1
-[info][grammar]  (number)add one token
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 0, index : 0]
 [info][grammar]  (factor)reduce right
 [info][grammar]  (factor)reduce right
-[debug][grammar]  get token type : 9; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)out
+[info][grammar]  (bit_and)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 3]
@@ -230,12 +152,12 @@
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 2]
 [debug][grammar]  after add a token[seek : 1, index : 2]
-[info][grammar]  mode status: polynomial
+[info][grammar]  mode status: bit_or
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
-[info][grammar]  (polynomial)reduce right
+[info][grammar]  (bit_or)reduce right
 [debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (polynomial)out
+[info][grammar]  (bit_or)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 1, index : 1, size : 3]
@@ -244,42 +166,29 @@
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 2]
 [debug][grammar]  after add a token[seek : 1, index : 2]
+[info][grammar]  mode status: bit_or
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
+[info][grammar]  (bit_or)reduce right
 [debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 11; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: block_
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 2; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: top_exp
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (command_list)back one token to (command)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: command
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (command)back <ENTER>
+[debug][grammar]  get token type : 0; data type : 0
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: bit_or
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (bit_or)back one token to (bit_and)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: top_exp
+[info][grammar]  mode status: bit_and
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (command_list)reduce right
-[debug][grammar]  get token type : 0; data type : 0
+[info][grammar]  (bit_move)back one token to (factor)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: command
+[info][grammar]  mode status: factor
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (command)back one token to (top_exp)
+[info][grammar]  (bit_move)back one token to (factor)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: top_exp
 [info][grammar]  mode status: polynomial
 [info][grammar]  mode status: polynomial
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [info][grammar]  (polynomial)back one token to (factor)
 [info][grammar]  (polynomial)back one token to (factor)
@@ -290,56 +199,64 @@
 [info][grammar]  (factor)back one token to (element)
 [info][grammar]  (factor)back one token to (element)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: element
+[info][grammar]  mode status: negative
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (element)back one token to (number)
+[info][grammar]  (negative)back one token to (bit_not)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: number
+[info][grammar]  mode status: bit_not
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (number)get int number: 100
-[info][grammar]  (number)add one token
+[info][grammar]  (bit_not)back one token to (power)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: power
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (power)back one token to (element)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: element
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (element)back one token to (number)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: factor
+[info][grammar]  mode status: number
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (factor)reduce right
-[debug][grammar]  get token type : 6; data type : 0
+[info][grammar]  (number)get int number: 21
+[info][grammar]  (number)add one token
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[debug][grammar]  get token type : 0; data type : 0
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: element
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (element)back one token to (number)
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: number
-[debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (number)get int number: 3
-[info][grammar]  (number)add one token
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[info][grammar]  mode status: power
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (power)reduce right
+[debug][grammar]  get token type : -3; data type : 6
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (power)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  back a token[seek : 2, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
 [info][grammar]  mode status: factor
 [info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 0, index : 0]
+[debug][grammar]  pop a token[seek : 0, index : 1]
 [info][grammar]  (factor)reduce right
 [info][grammar]  (factor)reduce right
-[debug][grammar]  get token type : 2; data type : 0
-[debug][grammar]  add a token[seek : 0, index : 0, size : 3]
-[debug][grammar]  after add a token[seek : 1, index : 1]
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [info][grammar]  (factor)out
 [info][grammar]  (factor)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
@@ -364,30 +281,87 @@
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 1, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 2]
 [debug][grammar]  after add a token[seek : 1, index : 2]
+[info][grammar]  mode status: factor
 [debug][grammar]  pop a token[seek : 0, index : 1]
 [debug][grammar]  pop a token[seek : 0, index : 1]
+[info][grammar]  (factor)reduce right
 [debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (bit_move)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  back a token[seek : 2, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
+[info][grammar]  mode status: bit_and
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[info][grammar]  (factor)reduce right
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
+[info][grammar]  (bit_and)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: top_exp
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  back a token[seek : 2, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
+[info][grammar]  mode status: bit_or
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[info][grammar]  (bit_or)reduce right
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (command_list)reduce right
-[debug][grammar]  get token type : 12; data type : 0
+[info][grammar]  (bit_or)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: command
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  back a token[seek : 2, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
+[info][grammar]  mode status: bit_or
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[info][grammar]  (bit_or)reduce right
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (command)back one token to (top_exp)
+[info][grammar]  (bit_notor)out
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: top_exp
-[info][grammar]  mode status: polynomial
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  back a token[seek : 2, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  add a token[seek : 0, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 1, index : 2]
+[debug][grammar]  pop a token[seek : 0, index : 1]
+[debug][grammar]  get token seek += 1 : 0, index : 1
 [debug][grammar]  pop a token[seek : 0, index : 0]
 [debug][grammar]  pop a token[seek : 0, index : 0]
-[info][grammar]  (polynomial)back one token to (factor)
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  add a token[seek : 0, index : 0, size : 3]
 [debug][grammar]  after add a token[seek : 1, index : 1]
 [debug][grammar]  after add a token[seek : 1, index : 1]
-[info][grammar]  mode status: factor
-[debug][grammar]  pop a token[seek : 
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  pop a token[seek : 1, index : 1]
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[info][grammar]  mode status: top_exp
+[debug][grammar]  pop a token[seek : 1, index : 1]
+[info][grammar]  (command_list)reduce right
+[debug][grammar]  get token type : -3; data type : 6
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[info][grammar]  mode status: command
+[debug][grammar]  pop a token[seek : 1, index : 1]
+[info][grammar]  (command)back <EOF>
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  pop a token[seek : 1, index : 1]
+[info][grammar]  (command_list)out
+[debug][grammar]  add a token[seek : 1, index : 1, size : 3]
+[debug][grammar]  after add a token[seek : 2, index : 2]
+[debug][grammar]  add a token[seek : 2, index : 2, size : 3]
+[debug][grammar]  after add a token[seek : 3, index : 3]
+[debug][grammar]  back a token[seek : 3, index : 3]

Some files were not shown because too many files changed in this diff