Acse.y 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. %{
  2. /*
  3. * Andrea Di Biagio
  4. * Politecnico di Milano, 2007
  5. *
  6. * Acse.y
  7. * Formal Languages & Compilers Machine, 2007/2008
  8. *
  9. */
  10. /*************************************************************************
  11. Compiler for the language LANCE
  12. ***************************************************************************/
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <assert.h>
  16. #include "axe_struct.h"
  17. #include "axe_engine.h"
  18. #include "symbol_table.h"
  19. #include "axe_errors.h"
  20. #include "collections.h"
  21. #include "axe_expressions.h"
  22. #include "axe_gencode.h"
  23. #include "axe_utils.h"
  24. #include "axe_array.h"
  25. #include "axe_cflow_graph.h"
  26. #include "cflow_constants.h"
  27. #include "axe_transform.h"
  28. #include "axe_reg_alloc.h"
  29. #include "reg_alloc_constants.h"
  30. #include "axe_io_manager.h"
  31. #ifndef NDEBUG
  32. # include "axe_debug.h"
  33. #endif
  34. /* global variables */
  35. int line_num; /* this variable will keep track of the
  36. * source code line number. Every time that a newline
  37. * is encountered while parsing the input file, this
  38. * value is increased by 1. This value is then used
  39. * for error tracking: if the parser returns an error
  40. * or a warning, this value is used in order to notify
  41. * in which line of code the error has been found */
  42. int num_error; /* the number of errors found in the code. This value
  43. * is increased by 1 every time a new error is found
  44. * in the code. */
  45. int num_warning; /* As for the `num_error' global variable, this one
  46. * keeps track of all the warning messages displayed */
  47. /* errorcode is defined inside "axe_engine.c" */
  48. extern int errorcode; /* this variable is used to test if an error is found
  49. * while parsing the input file. It also is set
  50. * to notify if the compiler internal state is invalid.
  51. * When the parsing process is started, the value
  52. * of `errorcode' is set to the value of the macro
  53. * `AXE_OK' defined in "axe_constants.h".
  54. * As long as everything (the parsed source code and
  55. * the internal state of the compiler) is correct,
  56. * the value of `errorcode' is set to `AXE_OK'.
  57. * When an error occurs (because the input file contains
  58. * one or more syntax errors or because something went
  59. * wrong in the machine internal state), the errorcode
  60. * is set to a value that is different from `AXE_OK'. */
  61. extern int cflow_errorcode; /* As for `errorcode' this value is used to
  62. * test if an error occurs during the creation process of
  63. * a control flow graph. More informations can be found
  64. * analyzing the file `axe_cflow_graph.h'. */
  65. /* program informations */
  66. t_program_infos *program; /* The singleton instance of `program'.
  67. * An instance of `t_program_infos' holds in its
  68. * internal structure, all the useful informations
  69. * about a program. For example: the assembly
  70. * (code and directives); the symbol table;
  71. * the label manager (see axe_labels.h) etc. */
  72. t_cflow_Graph *graph; /* An instance of a control flow graph. This instance
  73. * will be generated starting from `program' and will
  74. * be used during the register allocation process */
  75. t_reg_allocator *RA; /* Register allocator. It implements the "Linear scan"
  76. * algorythm */
  77. t_io_infos *file_infos; /* input and output files used by the compiler */
  78. %}
  79. %expect 1
  80. /*=========================================================================
  81. SEMANTIC RECORDS
  82. =========================================================================*/
  83. %union {
  84. int intval;
  85. char *svalue;
  86. t_axe_expression expr;
  87. t_axe_declaration *decl;
  88. t_list *list;
  89. t_axe_label *label;
  90. t_while_statement while_stmt;
  91. }
  92. /*=========================================================================
  93. TOKENS
  94. =========================================================================*/
  95. %start program
  96. %token LBRACE RBRACE LPAR RPAR LSQUARE RSQUARE
  97. %token SEMI COLON PLUS MINUS MUL_OP DIV_OP MOD_OP
  98. %token AND_OP OR_OP NOT_OP
  99. %token ASSIGN LT GT SHL_OP SHR_OP EQ NOTEQ LTEQ GTEQ
  100. %token ANDAND OROR
  101. %token COMMA
  102. %token FOR
  103. %token RETURN
  104. %token READ
  105. %token WRITE
  106. %token <label> DO
  107. %token <while_stmt> WHILE
  108. %token <label> IF
  109. %token <label> ELSE
  110. %token <intval> TYPE
  111. %token <svalue> IDENTIFIER
  112. %token <intval> NUMBER
  113. %token <label> DOLLAR
  114. %token <label> AT
  115. %type <expr> exp
  116. %type <decl> declaration
  117. %type <list> declaration_list
  118. %type <label> if_stmt
  119. /*=========================================================================
  120. OPERATOR PRECEDENCES
  121. =========================================================================*/
  122. %left COMMA
  123. %left ASSIGN
  124. %left OROR
  125. %left ANDAND
  126. %left OR_OP
  127. %left AND_OP
  128. %left EQ NOTEQ
  129. %left LT GT LTEQ GTEQ
  130. %left DOLLAR AT
  131. %left SHL_OP SHR_OP
  132. %left MINUS PLUS
  133. %left MUL_OP DIV_OP
  134. %right NOT
  135. /*=========================================================================
  136. BISON GRAMMAR
  137. =========================================================================*/
  138. %%
  139. /* `program' is the starting non-terminal of the grammar.
  140. * A program is composed by:
  141. 1. declarations (zero or more);
  142. 2. A list of instructions. (at least one instruction!).
  143. * When the rule associated with the non-terminal `program' is executed,
  144. * the parser notify it to the `program' singleton instance. */
  145. program : var_declarations statements
  146. {
  147. /* Notify the end of the program. Once called
  148. * the function `set_end_Program' - if necessary -
  149. * introduces a `HALT' instruction into the
  150. * list of instructions. */
  151. set_end_Program(program);
  152. /* return from yyparse() */
  153. YYACCEPT;
  154. }
  155. ;
  156. var_declarations : var_declarations var_declaration { /* does nothing */ }
  157. | /* empty */ { /* does nothing */ }
  158. ;
  159. var_declaration : TYPE declaration_list SEMI
  160. {
  161. /* update the program infos by adding new variables */
  162. set_new_variables(program, $1, $2);
  163. }
  164. ;
  165. declaration_list : declaration_list COMMA declaration
  166. { /* add the new declaration to the list of declarations */
  167. $$ = addElement($1, $3, -1);
  168. }
  169. | declaration
  170. {
  171. /* add the new declaration to the list of declarations */
  172. $$ = addElement(NULL, $1, -1);
  173. }
  174. ;
  175. declaration : IDENTIFIER ASSIGN NUMBER
  176. {
  177. /* create a new instance of t_axe_declaration */
  178. $$ = alloc_declaration($1, 0, 0, $3);
  179. /* test if an `out of memory' occurred */
  180. if ($$ == NULL)
  181. notifyError(AXE_OUT_OF_MEMORY);
  182. }
  183. | IDENTIFIER LSQUARE NUMBER RSQUARE
  184. {
  185. /* create a new instance of t_axe_declaration */
  186. $$ = alloc_declaration($1, 1, $3, 0);
  187. /* test if an `out of memory' occurred */
  188. if ($$ == NULL)
  189. notifyError(AXE_OUT_OF_MEMORY);
  190. }
  191. | IDENTIFIER
  192. {
  193. /* create a new instance of t_axe_declaration */
  194. $$ = alloc_declaration($1, 0, 0, 0);
  195. /* test if an `out of memory' occurred */
  196. if ($$ == NULL)
  197. notifyError(AXE_OUT_OF_MEMORY);
  198. }
  199. ;
  200. /* A block of code can be either a single statement or
  201. * a set of statements enclosed between braces */
  202. code_block : statement { /* does nothing */ }
  203. | LBRACE statements RBRACE { /* does nothing */ }
  204. ;
  205. /* One or more code statements */
  206. statements : statements statement { /* does nothing */ }
  207. | statement { /* does nothing */ }
  208. ;
  209. /* A statement can be either an assignment statement or a control statement
  210. * or a read/write statement or a semicolon */
  211. statement : assign_statement SEMI { /* does nothing */ }
  212. | control_statement { /* does nothing */ }
  213. | read_write_statement SEMI { /* does nothing */ }
  214. | SEMI { gen_nop_instruction(program); }
  215. ;
  216. control_statement : if_statement { /* does nothing */ }
  217. | while_statement { /* does nothing */ }
  218. | do_while_statement SEMI { /* does nothing */ }
  219. | return_statement SEMI { /* does nothing */ }
  220. ;
  221. read_write_statement : read_statement { /* does nothing */ }
  222. | write_statement { /* does nothing */ }
  223. ;
  224. assign_statement : IDENTIFIER LSQUARE exp RSQUARE ASSIGN exp
  225. {
  226. /* Notify to `program' that the value $6
  227. * have to be assigned to the location
  228. * addressed by $1[$3]. Where $1 is obviously
  229. * the array/pointer identifier, $3 is an expression
  230. * that holds an integer value. That value will be
  231. * used as an index for the array $1 */
  232. storeArrayElement(program, $1, $3, $6);
  233. /* free the memory associated with the IDENTIFIER.
  234. * The use of the free instruction is required
  235. * because of the value associated with IDENTIFIER.
  236. * The value of IDENTIFIER is a string created
  237. * by a call to the function `strdup' (see Acse.lex) */
  238. free($1);
  239. }
  240. | IDENTIFIER ASSIGN exp
  241. {
  242. int location;
  243. t_axe_instruction *instr;
  244. /* in order to assign a value to a variable, we have to
  245. * know where the variable is located (i.e. in which register).
  246. * the function `get_symbol_location' is used in order
  247. * to retrieve the register location assigned to
  248. * a given identifier.
  249. * A symbol table keeps track of the location of every
  250. * declared variable.
  251. * `get_symbol_location' perform a query on the symbol table
  252. * in order to discover the correct location of
  253. * the variable with $1 as identifier */
  254. /* get the location of the symbol with the given ID. */
  255. location = get_symbol_location(program, $1, 0);
  256. /* update the value of location */
  257. if ($3.expression_type == IMMEDIATE)
  258. gen_move_immediate(program, location, $3.value);
  259. else
  260. instr = gen_add_instruction
  261. (program, location, REG_0, $3.value, CG_DIRECT_ALL);
  262. /* free the memory associated with the IDENTIFIER */
  263. free($1);
  264. }
  265. ;
  266. if_statement : if_stmt
  267. {
  268. /* fix the `label_else' */
  269. assignLabel(program, $1);
  270. }
  271. | if_stmt ELSE
  272. {
  273. /* reserve a new label that points to the address where to jump if
  274. * `exp' is verified */
  275. $2 = newLabel(program);
  276. /* exit from the if-else */
  277. gen_bt_instruction (program, $2, 0);
  278. /* fix the `label_else' */
  279. assignLabel(program, $1);
  280. }
  281. code_block
  282. {
  283. /* fix the `label_else' */
  284. assignLabel(program, $2);
  285. }
  286. ;
  287. if_stmt : IF
  288. {
  289. /* the label that points to the address where to jump if
  290. * `exp' is not verified */
  291. $1 = newLabel(program);
  292. }
  293. LPAR exp RPAR
  294. {
  295. if ($4.expression_type == IMMEDIATE)
  296. gen_load_immediate(program, $4.value);
  297. else
  298. gen_andb_instruction(program, $4.value,
  299. $4.value, $4.value, CG_DIRECT_ALL);
  300. /* if `exp' returns FALSE, jump to the label $1 */
  301. gen_beq_instruction (program, $1, 0);
  302. }
  303. code_block { $$ = $1; }
  304. ;
  305. while_statement : WHILE
  306. {
  307. /* initialize the value of the non-terminal */
  308. $1 = create_while_statement();
  309. /* reserve and fix a new label */
  310. $1.label_condition
  311. = assignNewLabel(program);
  312. }
  313. LPAR exp RPAR
  314. {
  315. if ($4.expression_type == IMMEDIATE)
  316. gen_load_immediate(program, $4.value);
  317. else
  318. gen_andb_instruction(program, $4.value,
  319. $4.value, $4.value, CG_DIRECT_ALL);
  320. /* reserve a new label. This new label will point
  321. * to the first instruction after the while code
  322. * block */
  323. $1.label_end = newLabel(program);
  324. /* if `exp' returns FALSE, jump to the label $1.label_end */
  325. gen_beq_instruction (program, $1.label_end, 0);
  326. }
  327. code_block
  328. {
  329. /* jump to the beginning of the loop */
  330. gen_bt_instruction
  331. (program, $1.label_condition, 0);
  332. /* fix the label `label_end' */
  333. assignLabel(program, $1.label_end);
  334. }
  335. ;
  336. do_while_statement : DO
  337. {
  338. /* the label that points to the address where to jump if
  339. * `exp' is not verified */
  340. $1 = newLabel(program);
  341. /* fix the label */
  342. assignLabel(program, $1);
  343. }
  344. code_block WHILE LPAR exp RPAR
  345. {
  346. if ($6.expression_type == IMMEDIATE)
  347. gen_load_immediate(program, $6.value);
  348. else
  349. gen_andb_instruction(program, $6.value,
  350. $6.value, $6.value, CG_DIRECT_ALL);
  351. /* if `exp' returns TRUE, jump to the label $1 */
  352. gen_bne_instruction (program, $1, 0);
  353. }
  354. ;
  355. return_statement : RETURN
  356. {
  357. /* insert an HALT instruction */
  358. gen_halt_instruction(program);
  359. }
  360. ;
  361. read_statement : READ LPAR IDENTIFIER RPAR
  362. {
  363. int location;
  364. /* read from standard input an integer value and assign
  365. * it to a variable associated with the given identifier */
  366. /* get the location of the symbol with the given ID */
  367. /* lookup the symbol table and fetch the register location
  368. * associated with the IDENTIFIER $3. */
  369. location = get_symbol_location(program, $3, 0);
  370. /* insert a read instruction */
  371. gen_read_instruction (program, location);
  372. /* free the memory associated with the IDENTIFIER */
  373. free($3);
  374. }
  375. ;
  376. write_statement : WRITE LPAR exp RPAR
  377. {
  378. int location;
  379. if ($3.expression_type == IMMEDIATE)
  380. {
  381. /* load `immediate' into a new register. Returns the new register
  382. * identifier or REG_INVALID if an error occurs */
  383. location = gen_load_immediate(program, $3.value);
  384. }
  385. else
  386. location = $3.value;
  387. /* write to standard output an integer value */
  388. gen_write_instruction (program, location);
  389. }
  390. ;
  391. exp: NUMBER { $$ = create_expression ($1, IMMEDIATE); }
  392. | IDENTIFIER {
  393. int location;
  394. /* get the location of the symbol with the given ID */
  395. location = get_symbol_location(program, $1, 0);
  396. /* return the register location of IDENTIFIER as
  397. * a value for `exp' */
  398. $$ = create_expression (location, REGISTER);
  399. /* free the memory associated with the IDENTIFIER */
  400. free($1);
  401. }
  402. | IDENTIFIER LSQUARE exp RSQUARE {
  403. int reg;
  404. /* load the value IDENTIFIER[exp]
  405. * into `arrayElement' */
  406. reg = loadArrayElement(program, $1, $3);
  407. /* create a new expression */
  408. $$ = create_expression (reg, REGISTER);
  409. /* free the memory associated with the IDENTIFIER */
  410. free($1);
  411. }
  412. | NOT_OP NUMBER { if ($2 == 0)
  413. $$ = create_expression (1, IMMEDIATE);
  414. else
  415. $$ = create_expression (0, IMMEDIATE);
  416. }
  417. | NOT_OP IDENTIFIER {
  418. int identifier_location;
  419. int output_register;
  420. /* get the location of the symbol with the given ID */
  421. identifier_location =
  422. get_symbol_location(program, $2, 0);
  423. /* generate a NOT instruction. In order to do this,
  424. * at first we have to ask for a free register where
  425. * to store the result of the NOT instruction. */
  426. output_register = getNewRegister(program);
  427. /* Now we are able to generate a NOT instruction */
  428. gen_notl_instruction (program, output_register
  429. , identifier_location);
  430. $$ = create_expression (output_register, REGISTER);
  431. /* free the memory associated with the IDENTIFIER */
  432. free($2);
  433. }
  434. | exp AND_OP exp {
  435. $$ = handle_bin_numeric_op(program, $1, $3, ANDB);
  436. }
  437. | exp OR_OP exp {
  438. $$ = handle_bin_numeric_op(program, $1, $3, ORB);
  439. }
  440. | exp PLUS exp {
  441. $$ = handle_bin_numeric_op(program, $1, $3, ADD);
  442. }
  443. | exp MINUS exp {
  444. $$ = handle_bin_numeric_op(program, $1, $3, SUB);
  445. }
  446. | exp MUL_OP exp {
  447. $$ = handle_bin_numeric_op(program, $1, $3, MUL);
  448. }
  449. | exp DIV_OP exp {
  450. $$ = handle_bin_numeric_op(program, $1, $3, DIV);
  451. }
  452. | exp LT exp {
  453. $$ = handle_binary_comparison (program, $1, $3, _LT_);
  454. }
  455. | exp GT exp {
  456. $$ = handle_binary_comparison (program, $1, $3, _GT_);
  457. }
  458. | exp EQ exp {
  459. $$ = handle_binary_comparison (program, $1, $3, _EQ_);
  460. }
  461. | exp NOTEQ exp {
  462. $$ = handle_binary_comparison (program, $1, $3, _NOTEQ_);
  463. }
  464. | exp LTEQ exp {
  465. $$ = handle_binary_comparison (program, $1, $3, _LTEQ_);
  466. }
  467. | exp GTEQ exp {
  468. $$ = handle_binary_comparison (program, $1, $3, _GTEQ_);
  469. }
  470. | exp SHL_OP exp { $$ = handle_bin_numeric_op(program, $1, $3, SHL); }
  471. | exp SHR_OP exp { $$ = handle_bin_numeric_op(program, $1, $3, SHR); }
  472. | exp ANDAND exp { $$ = handle_bin_numeric_op(program, $1, $3, ANDL); }
  473. | exp OROR exp { $$ = handle_bin_numeric_op(program, $1, $3, ORL); }
  474. | LPAR exp RPAR { $$ = $2; }
  475. | MINUS exp {
  476. if ($2.expression_type == IMMEDIATE)
  477. {
  478. $$ = $2;
  479. $$.value = - ($$.value);
  480. }
  481. else
  482. {
  483. t_axe_expression exp_r0;
  484. /* create an expression for regisrer REG_0 */
  485. exp_r0.value = REG_0;
  486. exp_r0.expression_type = REGISTER;
  487. $$ = handle_bin_numeric_op
  488. (program, exp_r0, $2, SUB);
  489. }
  490. }
  491. | exp DOLLAR exp AT exp {
  492. int e_c;
  493. if ($5.expression_type != IMMEDIATE)
  494. yyerror();
  495. if ($5.value < 0)
  496. yyerror();
  497. if ($5.value > 32)
  498. e_c = 0;
  499. else
  500. e_c = 32 - $5.value;
  501. int r_e2 = gen_load_immediate(program, 0);
  502. int r_index = gen_load_immediate(program, e_c);
  503. $4 = newLabel(program);
  504. $2 = assignNewLabel(program);
  505. gen_beq_instruction(program, $4, 0);
  506. gen_shli_instruction(program, r_e2, r_e2, 1);
  507. gen_addi_instruction(program, r_e2, r_e2, 1);
  508. gen_subi_instruction(program, r_index, r_index, 1);
  509. gen_bt_instruction(program, $2, 0);
  510. assignLabel(program, $4);
  511. int r_e1 = getNewRegister(program);
  512. gen_notb_instruction(program, r_e1, r_e2);
  513. if ($1.expression_type == IMMEDIATE)
  514. gen_andb_instruction(program, r_e1, r_e1,
  515. gen_load_immediate(program, $1.value),
  516. CG_DIRECT_ALL);
  517. else
  518. gen_andb_instruction(program, r_e1, r_e1, $1.value,
  519. CG_DIRECT_ALL);
  520. if ($3.expression_type == IMMEDIATE)
  521. gen_andb_instruction(program, r_e2, r_e2,
  522. gen_load_immediate(program, $3.value),
  523. CG_DIRECT_ALL);
  524. else
  525. gen_andb_instruction(program, r_e2, r_e2, $3.value,
  526. CG_DIRECT_ALL);
  527. gen_orb_instruction(program, r_e1, r_e1, r_e2,
  528. CG_DIRECT_ALL);
  529. $$ = create_expression(r_e1, REGISTER);
  530. }
  531. ;
  532. %%
  533. /*=========================================================================
  534. MAIN
  535. =========================================================================*/
  536. int main (int argc, char **argv)
  537. {
  538. /* initialize all the compiler data structures and global variables */
  539. init_compiler(argc, argv);
  540. /* start the parsing procedure */
  541. yyparse();
  542. #ifndef NDEBUG
  543. fprintf(stdout, "Parsing process completed. \n");
  544. #endif
  545. /* test if the parsing process completed succesfully */
  546. checkConsistency();
  547. #ifndef NDEBUG
  548. fprintf(stdout, "Creating a control flow graph. \n");
  549. #endif
  550. /* create the control flow graph */
  551. graph = createFlowGraph(program->instructions);
  552. checkConsistency();
  553. #ifndef NDEBUG
  554. assert(program != NULL);
  555. assert(program->sy_table != NULL);
  556. assert(file_infos != NULL);
  557. assert(file_infos->syTable_output != NULL);
  558. printSymbolTable(program->sy_table, file_infos->syTable_output);
  559. printGraphInfos(graph, file_infos->cfg_1, 0);
  560. fprintf(stdout, "Updating the basic blocks. \n");
  561. #endif
  562. /* update the control flow graph by inserting load and stores inside
  563. * every basic block */
  564. graph = insertLoadAndStoreInstr(program, graph);
  565. #ifndef NDEBUG
  566. fprintf(stdout, "Executing a liveness analysis on the intermediate code \n");
  567. #endif
  568. performLivenessAnalysis(graph);
  569. checkConsistency();
  570. #ifndef NDEBUG
  571. printGraphInfos(graph, file_infos->cfg_2, 1);
  572. #endif
  573. #ifndef NDEBUG
  574. fprintf(stdout, "Starting the register allocation process. \n");
  575. #endif
  576. /* initialize the register allocator by using the control flow
  577. * informations stored into the control flow graph */
  578. RA = initializeRegAlloc(graph);
  579. /* execute the linear scan algorythm */
  580. execute_linear_scan(RA);
  581. #ifndef NDEBUG
  582. printRegAllocInfos(RA, file_infos->reg_alloc_output);
  583. #endif
  584. #ifndef NDEBUG
  585. fprintf(stdout, "Updating the control flow informations. \n");
  586. #endif
  587. /* apply changes to the program informations by using the informations
  588. * of the register allocation process */
  589. updateProgramInfos(program, graph, RA);
  590. #ifndef NDEBUG
  591. fprintf(stdout, "Writing the assembly file... \n");
  592. #endif
  593. writeAssembly(program, file_infos->output_file_name);
  594. #ifndef NDEBUG
  595. fprintf(stdout, "Assembly written on file \"%s\".\n", file_infos->output_file_name);
  596. #endif
  597. /* shutdown the compiler */
  598. shutdownCompiler(0);
  599. return 0;
  600. }
  601. /*=========================================================================
  602. YYERROR
  603. =========================================================================*/
  604. int yyerror(const char* errmsg)
  605. {
  606. errorcode = AXE_SYNTAX_ERROR;
  607. return 0;
  608. }