syntax.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. #include"token.h"
  2. #include"lex.h"
  3. #include"../inter/interpreter.h"
  4. void factor(int *status, token_node *list);
  5. void number(int *status, token_node *list);
  6. void element(int *status, token_node *list);
  7. void polynomial(int *status, token_node *list);
  8. void command(int *status, token_node *list);
  9. void while_(int *status, token_node *list);
  10. void if_(int *status, token_node *list);
  11. void for_(int *status, token_node *list);
  12. void elif_(int *status, token_node *list);
  13. void block_(int *status, token_node *list);
  14. void top_exp(int *status, token_node *list);
  15. void paser_error(char *text);
  16. /*
  17. command_list : command
  18. | command_list command
  19. */
  20. void command_list(int *status, token_node *list){ // 多项式
  21. fprintf(status_log, "[info][grammar] mode status: top_exp\n", text);
  22. token left, right, new_token;
  23. left = pop_node(list); // 先弹出一个token 检查token的类型:区分是模式1,还是模式2/3
  24. if(left.type == NON_command_list){ // 模式2
  25. fprintf(status_log, "[info][grammar] (command_list)reduce right\n");
  26. get_right_token(status, list, command, right); // 回调右边
  27. if(right.type == NON_command){
  28. new_token.type = NON_command_list;
  29. new_token.data_type = empty;
  30. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  31. return command_list(status, list); // 回调自己
  32. }
  33. else{ // 递归跳出[EOF_token]
  34. printf("right.type = %d\n", right.type);
  35. fprintf(status_log, "[info][grammar] (command_list)out\n");
  36. back_one_token(list, left);
  37. back_again(list, right);
  38. return;
  39. }
  40. }
  41. else if(left.type == EOF_token){ // 递归跳出的条件
  42. fprintf(status_log, "[info][grammar] (command_list)out\n");
  43. return;
  44. }
  45. else{ // 模式1
  46. fprintf(status_log, "[info][grammar] (command_list)back one token to (command)\n");
  47. back_one_token(list, left);
  48. get_base_token(status, list, command, new_token);
  49. if(new_token.type != NON_command){
  50. back_one_token(list, new_token); // 往回[不匹配类型]
  51. return;
  52. }
  53. new_token.type = NON_command_list;
  54. add_node(list, new_token);
  55. return command_list(status, list); // 回调自己
  56. }
  57. }
  58. /*
  59. command : top_exp <ENTER>
  60. */
  61. void command(int *status, token_node *list){ // 多项式
  62. fprintf(status_log, "[info][grammar] mode status: command\n", text);
  63. token left, new_token;
  64. left = pop_node(list); // 先弹出一个token 检查token
  65. if(left.type == WHILE_PASER){ // 是while类型的数据
  66. fprintf(status_log, "[info][grammar] (command)back one token to (while)\n");
  67. back_one_token(list, left);
  68. get_base_token(status, list, while_, new_token);
  69. get_stop_token();
  70. push_statement(statement_base, new_token);
  71. }
  72. if(left.type == IF_PASER){ // 是while类型的数据
  73. fprintf(status_log, "[info][grammar] (command)back one token to (if)\n");
  74. back_one_token(list, left);
  75. get_base_token(status, list, if_, new_token);
  76. get_stop_token();
  77. push_statement(statement_base, new_token);
  78. }
  79. if(left.type == FOR_PASER){ // 是while类型的数据
  80. fprintf(status_log, "[info][grammar] (command)back one token to (for)\n");
  81. back_one_token(list, left);
  82. get_base_token(status, list, for_, new_token);
  83. get_stop_token();
  84. push_statement(statement_base, new_token);
  85. }
  86. else if(left.type == ENTER_PASER){
  87. fprintf(status_log, "[info][grammar] (command)back <ENTER>\n");
  88. }
  89. else if(left.type == EOF_token){
  90. fprintf(status_log, "[info][grammar] (command)back <EOF>\n");
  91. back_one_token(list, left);
  92. goto return_back;
  93. }
  94. else{ // 表达式
  95. fprintf(status_log, "[info][grammar] (command)back one token to (top_exp)\n");
  96. back_one_token(list, left);
  97. get_base_token(status, list, top_exp, new_token);
  98. if(new_token.type != NON_top_exp){
  99. back_one_token(list, new_token); // 往回[不匹配类型]
  100. return;
  101. }
  102. get_stop_token();
  103. push_statement(statement_base, new_token);
  104. }
  105. new_token.type = NON_command;
  106. add_node(list, new_token);
  107. return_back:
  108. return; // 回调自己
  109. }
  110. /*
  111. if_ : IF LB top_exp RB block
  112. */
  113. void if_(int *status, token_node *list){
  114. fprintf(status_log, "[info][grammar] mode status: if_\n");
  115. token if_t, lb_t, exp_t, rb_t, block_t, next_t, child_t, new_token;
  116. if_t = pop_node(list);
  117. if(if_t.type == IF_PASER){
  118. get_pop_token(status, list, lb_t);
  119. if(lb_t.type != LB_PASER){
  120. paser_error("Don't get '('");
  121. }
  122. get_right_token(status,list,top_exp,exp_t);
  123. if(exp_t.type != NON_top_exp){ // 不是表达式
  124. paser_error("Don't get 'top_exp'");
  125. }
  126. get_pop_token(status, list, rb_t);
  127. if(rb_t.type != RB_PASER){
  128. paser_error("Don't get ')'");
  129. }
  130. get_right_token(status,list,block_,block_t);
  131. if(block_t.type != NON_block){ // 不是表达式
  132. paser_error("Don't get '{'");
  133. }
  134. statement *if_tmp = make_statement();
  135. if_tmp->type = if_branch;
  136. if_tmp->code.if_branch.done = make_if(exp_t.data.statement_value, block_t.data.statement_value);
  137. // 检查else和elseif
  138. el_again:
  139. get_pop_token(status,list,next_t);
  140. if(next_t.type == ENTER_PASER){ // 忽略Enter
  141. goto el_again;
  142. }
  143. printf("next_t.type = %d\n", next_t.type);
  144. if(next_t.type == ELIF_PASER || next_t.type == ELSE_PASER){ // elif
  145. back_one_token(list, next_t);
  146. get_base_token(status,list,elif_,child_t);
  147. if(child_t.type == NON_elif){
  148. append_elif(child_t.data.if_list_base, if_tmp->code.if_branch.done);
  149. goto el_again;
  150. }
  151. }
  152. else{
  153. back_one_token(list, next_t);
  154. }
  155. new_token.type = NON_if;
  156. new_token.data_type = statement_value;
  157. new_token.data.statement_value = if_tmp;
  158. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  159. return;
  160. }
  161. else{
  162. back_one_token(list, if_t);
  163. return;
  164. }
  165. }
  166. /*
  167. elif_ : ELIF LB top_exp RB block
  168. */
  169. void elif_(int *status, token_node *list){
  170. fprintf(status_log, "[info][grammar] mode status: elif_\n");
  171. token elif_t, lb_t, exp_t, rb_t, block_t, next_t, new_token;
  172. elif_t = pop_node(list);
  173. if(elif_t.type == ELIF_PASER){
  174. get_pop_token(status, list, lb_t);
  175. if(lb_t.type != LB_PASER){
  176. paser_error("Don't get '('");
  177. }
  178. get_right_token(status,list,top_exp,exp_t);
  179. if(exp_t.type != NON_top_exp){ // 不是表达式
  180. paser_error("Don't get 'top_exp'");
  181. }
  182. get_pop_token(status, list, rb_t);
  183. if(rb_t.type != RB_PASER){
  184. paser_error("Don't get ')'");
  185. }
  186. get_right_token(status,list,block_,block_t);
  187. if(block_t.type != NON_block){ // 不是表达式
  188. paser_error("Don't get '{'");
  189. }
  190. if_list *if_tmp = make_if(exp_t.data.statement_value, block_t.data.statement_value);
  191. new_token.type = NON_elif;
  192. new_token.data_type = if_list_base;
  193. new_token.data.if_list_base = if_tmp;
  194. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  195. return;
  196. }
  197. if(elif_t.type == ELSE_PASER){ // else
  198. get_right_token(status,list,block_,block_t);
  199. if(block_t.type != NON_block){ // 不是表达式
  200. paser_error("Don't get '{'");
  201. }
  202. if_list *if_tmp = make_if(NULL, block_t.data.statement_value);
  203. new_token.type = NON_elif;
  204. new_token.data_type = if_list_base;
  205. new_token.data.if_list_base = if_tmp;
  206. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  207. return;
  208. }
  209. else{
  210. back_one_token(list, elif_t);
  211. return;
  212. }
  213. }
  214. /*
  215. for_ : FOR LB top_exp COMMA top_exp COMMA top_exp RB block
  216. */
  217. void for_(int *status, token_node *list){
  218. fprintf(status_log, "[info][grammar] mode status: while_\n");
  219. token for_t, exp_1, exp_2, exp_3, block_t, lb_t, rb_t, comma_t,new_token;
  220. statement *exp_a, *exp_b, *exp_c;
  221. for_t = pop_node(list);
  222. if(for_t.type == FOR_PASER){
  223. get_pop_token(status, list, lb_t);
  224. if(lb_t.type != LB_PASER){
  225. paser_error("Don't get '('");
  226. }
  227. get_pop_token(status, list, exp_1);
  228. if(exp_1.type == COMMA_PASER){
  229. exp_a = NULL; // exp_1 = NULL;
  230. }
  231. else{
  232. back_one_token(list, exp_1);
  233. get_base_token(status,list,top_exp,exp_1); // 不是使用right token,不需要执行safe_get_token
  234. if(exp_1.type != NON_top_exp){ // 不是表达式
  235. paser_error("Don't get 'top_exp'");
  236. }
  237. get_pop_token(status, list, comma_t);
  238. if(comma_t.type != COMMA_PASER){
  239. paser_error("Don't get ';' in for cycle");
  240. }
  241. exp_a = exp_1.data.statement_value;
  242. }
  243. get_pop_token(status, list, exp_2);
  244. if(exp_2.type == COMMA_PASER){
  245. exp_b = NULL; // exp_1 = NULL;
  246. }
  247. else{
  248. back_one_token(list, exp_2);
  249. get_base_token(status,list,top_exp,exp_2); // 不是使用right token,不需要执行safe_get_token
  250. if(exp_2.type != NON_top_exp){ // 不是表达式
  251. paser_error("Don't get 'top_exp'");
  252. }
  253. get_pop_token(status, list, comma_t);
  254. if(comma_t.type != COMMA_PASER){
  255. paser_error("Don't get ';' in for cycle");
  256. }
  257. exp_b = exp_2.data.statement_value;
  258. }
  259. get_pop_token(status, list, exp_3);
  260. if(exp_3.type == RB_PASER){
  261. exp_c = NULL; // exp_1 = NULL;
  262. back_one_token(list, exp_3);
  263. }
  264. else{
  265. back_one_token(list, exp_3);
  266. get_base_token(status,list,top_exp,exp_3); // 不是使用right token,不需要执行safe_get_token
  267. if(exp_3.type != NON_top_exp){ // 不是表达式
  268. paser_error("Don't get 'top_exp'");
  269. }
  270. exp_c = exp_3.data.statement_value;
  271. }
  272. get_pop_token(status, list, rb_t);
  273. if(rb_t.type != RB_PASER){
  274. paser_error("Don't get ')'");
  275. }
  276. get_right_token(status,list,block_,block_t);
  277. if(block_t.type != NON_block){ // 不是表达式
  278. paser_error("Don't get '{'[s]");
  279. }
  280. statement *for_tmp = make_statement();
  281. for_tmp->type = for_cycle;
  282. for_tmp->code.for_cycle.first = exp_a;
  283. for_tmp->code.for_cycle.condition = exp_b;
  284. for_tmp->code.for_cycle.after = exp_c;
  285. for_tmp->code.for_cycle.done = block_t.data.statement_value;
  286. new_token.type = NON_for;
  287. new_token.data_type = statement_value;
  288. new_token.data.statement_value = for_tmp;
  289. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  290. return;
  291. }
  292. else{
  293. back_one_token(list, for_t);
  294. return;
  295. }
  296. }
  297. /*
  298. while_ : WHILE LB top_exp RB block
  299. */
  300. void while_(int *status, token_node *list){
  301. fprintf(status_log, "[info][grammar] mode status: while_\n");
  302. token while_t, lb_t, exp_t, rb_t, block_t, new_token;
  303. while_t = pop_node(list);
  304. if(while_t.type == WHILE_PASER){
  305. get_pop_token(status, list, lb_t);
  306. if(lb_t.type != LB_PASER){
  307. paser_error("Don't get '('");
  308. }
  309. get_right_token(status,list,top_exp,exp_t);
  310. if(exp_t.type != NON_top_exp){ // 不是表达式
  311. paser_error("Don't get 'top_exp'");
  312. }
  313. get_pop_token(status, list, rb_t);
  314. if(rb_t.type != RB_PASER){
  315. paser_error("Don't get ')'");
  316. }
  317. get_right_token(status,list,block_,block_t);
  318. if(block_t.type != NON_block){ // 不是表达式
  319. paser_error("Don't get '{'");
  320. }
  321. statement *while_tmp = make_statement();
  322. while_tmp->type = while_cycle;
  323. while_tmp->code.while_cycle.condition = exp_t.data.statement_value;
  324. while_tmp->code.while_cycle.done = block_t.data.statement_value;
  325. new_token.type = NON_while;
  326. new_token.data_type = statement_value;
  327. new_token.data.statement_value = while_tmp;
  328. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  329. return;
  330. }
  331. else{
  332. back_one_token(list, while_t);
  333. return;
  334. }
  335. }
  336. /*
  337. block_ : LP command_list RB
  338. */
  339. void block_(int *status, token_node *list){
  340. fprintf(status_log, "[info][grammar] mode status: block_\n");
  341. token lp_t, rp_t, new_token, command_list_t;
  342. lp_t = pop_node(list);
  343. if(lp_t.type == LP_PASER){
  344. statement *block_tmp = make_statement();
  345. statement_base = append_statement_list(block_tmp, statement_base);
  346. get_right_token(status,list,command_list,command_list_t); // 要把command_list也弹出来
  347. statement_base = free_statement_list(statement_base); // 重新释放
  348. get_pop_token(status, list, rp_t);
  349. if(rp_t.type != RP_PASER){
  350. paser_error("Don't get '}'");
  351. }
  352. new_token.type = NON_block;
  353. new_token.data_type = statement_value;
  354. new_token.data.statement_value = block_tmp;
  355. add_node(list, new_token); // 压入节点
  356. return;
  357. }
  358. else{
  359. back_one_token(list, lp_t);
  360. return;
  361. }
  362. }
  363. /*
  364. top_exp : polynomial
  365. */
  366. void top_exp(int *status, token_node *list){
  367. fprintf(status_log, "[info][grammar] mode status: top_exp\n");
  368. token exp;
  369. get_base_token(status,list,polynomial,exp);
  370. if(exp.type != NON_polynomial){
  371. back_one_token(list, exp);
  372. return;
  373. }
  374. exp.type = NON_top_exp;
  375. add_node(list, exp); // 压入节点
  376. return;
  377. }
  378. /*
  379. polynomial : factor
  380. | polynomial ADD factor
  381. | polynomial SUB factor
  382. */
  383. void polynomial(int *status, token_node *list){ // 多项式
  384. fprintf(status_log, "[info][grammar] mode status: polynomial\n");
  385. token left, right, symbol, new_token;
  386. left = pop_node(list); // 先弹出一个token 检查token的类型:区分是模式1,还是模式2/3
  387. if(left.type == NON_polynomial){ // 模式2/3
  388. fprintf(status_log, "[info][grammar] (polynomial)reduce right\n");
  389. get_pop_token(status, list, symbol);
  390. if(symbol.type == ADD_PASER || symbol.type == SUB_PASER){ // 模式2/3
  391. get_right_token(status, list, factor, right); // 回调右边
  392. if(right.type != NON_factor){
  393. paser_error("Don't get a factor");
  394. }
  395. new_token.type = NON_polynomial;
  396. new_token.data_type = statement_value;
  397. statement *code_tmp = make_statement();
  398. code_tmp->type = operation;
  399. if(symbol.type == ADD_PASER){
  400. code_tmp->code.operation.type = ADD_func;
  401. }
  402. else{
  403. code_tmp->code.operation.type = SUB_func;
  404. }
  405. code_tmp->code.operation.left_exp = left.data.statement_value;
  406. code_tmp->code.operation.right_exp = right.data.statement_value;
  407. new_token.data.statement_value = code_tmp;
  408. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  409. return polynomial(status, list); // 回调自己
  410. }
  411. else{ // 递归跳出
  412. fprintf(status_log, "[info][grammar] (polynomial)out\n");
  413. back_one_token(list, left);
  414. back_again(list, symbol);
  415. return;
  416. }
  417. }
  418. else{ // 模式1
  419. fprintf(status_log, "[info][grammar] (polynomial)back one token to (factor)\n");
  420. back_one_token(list, left);
  421. get_base_token(status, list, factor, new_token);
  422. if(new_token.type != NON_factor){
  423. back_one_token(list, new_token); // 往回[不匹配类型]
  424. return;
  425. }
  426. new_token.type = NON_polynomial;
  427. add_node(list, new_token);
  428. return polynomial(status, list); // 回调自己
  429. }
  430. }
  431. /*
  432. factor : element
  433. | factor MUL element
  434. | factor DIV element
  435. */
  436. void factor(int *status, token_node *list){ // 因试分解
  437. fprintf(status_log, "[info][grammar] mode status: factor\n");
  438. token left, right, symbol, new_token;
  439. left = pop_node(list); // 先弹出一个token 检查token的类型:区分是模式1,还是模式2/3
  440. if(left.type == NON_factor){ // 模式2/3
  441. fprintf(status_log, "[info][grammar] (factor)reduce right\n");
  442. get_pop_token(status, list, symbol);
  443. if(symbol.type == MUL_PASER || symbol.type == DIV_PASER){ // 模式2/3
  444. get_right_token(status, list, element, right); // 回调右边
  445. if(right.type != NON_element){
  446. paser_error("Don't get a value");
  447. }
  448. // 逻辑操作
  449. new_token.type = NON_factor;
  450. new_token.data_type = statement_value;
  451. statement *code_tmp = make_statement();
  452. code_tmp->type = operation;
  453. if(symbol.type == MUL_PASER){
  454. code_tmp->code.operation.type = MUL_func;
  455. }
  456. else{
  457. code_tmp->code.operation.type = DIV_func;
  458. }
  459. code_tmp->code.operation.left_exp = left.data.statement_value;
  460. code_tmp->code.operation.right_exp = right.data.statement_value;
  461. new_token.data.statement_value = code_tmp;
  462. add_node(list, new_token); // 压入节点[弹出3个压入1个]
  463. return factor(status, list); // 回调自己
  464. }
  465. else{ // 递归跳出
  466. // 回退,也就是让下一次pop的时候读取到的是left而不是symbol
  467. fprintf(status_log, "[info][grammar] (factor)out\n");
  468. back_one_token(list, left);
  469. back_again(list, symbol);
  470. return;
  471. }
  472. }
  473. else{ // 模式1
  474. fprintf(status_log, "[info][grammar] (factor)back one token to (element)\n");
  475. back_one_token(list, left);
  476. get_base_token(status, list, element, new_token);
  477. if(new_token.type != NON_element){
  478. back_one_token(list, new_token); // 往回[不匹配类型]
  479. return;
  480. }
  481. new_token.type = NON_factor;
  482. add_node(list, new_token);
  483. return factor(status, list); // 回调自己
  484. }
  485. }
  486. /*
  487. element : number
  488. | LB top_exp RB
  489. */
  490. void element(int *status, token_node *list){ // 数字归约
  491. fprintf(status_log, "[info][grammar] mode status: element\n");
  492. token gett, new_token;
  493. gett = pop_node(list); // 取得一个token
  494. if(gett.type == LB_PASER){ // 模式3
  495. fprintf(status_log, "[info][grammar] (element)get LB\n");
  496. get_right_token(status, list, top_exp, new_token);
  497. if(new_token.type != NON_top_exp){
  498. paser_error("Don't get 'top_exp'");
  499. }
  500. new_token.type = NON_element;
  501. token rb;
  502. get_pop_token(status, list ,rb);
  503. if(rb.type != RB_PASER){ // 匹配失败
  504. paser_error("Don't get ')'");
  505. }
  506. add_node(list, new_token); // 压入节点
  507. return;
  508. }
  509. else{
  510. fprintf(status_log, "[info][grammar] (element)back one token to (number)\n");
  511. back_one_token(list, gett);
  512. get_base_token(status, list, number, new_token);
  513. if(new_token.type != NON_base_value){
  514. back_one_token(list, new_token); // 往回[不匹配类型]
  515. return;
  516. }
  517. new_token.type = NON_element;
  518. add_node(list, new_token);
  519. return;
  520. }
  521. }
  522. /*
  523. number : INT_PASER
  524. | DOUBLE_PASER
  525. | LB top_exp RB
  526. */
  527. void number(int *status, token_node *list){ // 数字归约
  528. fprintf(status_log, "[info][grammar] mode status: number\n");
  529. token gett, new_token;
  530. gett = pop_node(list); // 取得一个token
  531. if(gett.type == INT_PASER){ // int类型
  532. new_token.type = NON_base_value;
  533. GWARF_value tmp_value;
  534. tmp_value.type = INT_value;
  535. tmp_value.value.int_value = atoi(gett.data.text);
  536. statement *code_tmp = make_statement();
  537. code_tmp->type = call;
  538. code_tmp->code.call.func = pack_call_name("int", NULL);
  539. code_tmp->code.call.parameter_list = pack_value_parameter(tmp_value);
  540. new_token.data.statement_value = code_tmp;
  541. new_token.data_type = statement_value;
  542. fprintf(status_log, "[info][grammar] (number)get int number: %d\n", tmp_value.value.int_value);
  543. }
  544. else if(gett.type == DOUBLE_PASER){
  545. new_token.type = NON_base_value;
  546. GWARF_value tmp_value;
  547. tmp_value.type = NUMBER_value;
  548. tmp_value.value.double_value = atof(gett.data.text);
  549. statement *code_tmp = make_statement();
  550. code_tmp->type = call;
  551. code_tmp->code.call.func = pack_call_name("double", NULL);
  552. code_tmp->code.call.parameter_list = pack_value_parameter(tmp_value);
  553. new_token.data.statement_value = code_tmp;
  554. new_token.data_type = statement_value;
  555. fprintf(status_log, "[info][grammar] (number)get double number: %f\n", new_token.data.d_number);
  556. }
  557. else{ // 不是期望值
  558. fprintf(status_log, "[info][grammar] (number)back one token\n");
  559. back_one_token(list, gett);
  560. return;
  561. }
  562. free(gett.data.text); // 释放字符串
  563. fprintf(status_log, "[info][grammar] (number)add one token\n");
  564. add_node(list, new_token); // 压入节点
  565. }
  566. void paser_error(char *text){
  567. fprintf(status_log, "[error][grammar] paser error : %s\n\n", text);
  568. printf("[error][grammar] paser error : %s\n\n", text);
  569. exit(1);
  570. }