3 \details This driver does what APC does, but in staggered stages with
4 additional debugging information
7 ----------------------------------------------------------------------------*/
9 #include <stdio.h> //print
10 #include <errno.h> //errors
11 #include <string.h> //strnlen
13 #include <stdlib.h> //exit
14 #include <unistd.h> //getopt
16 #include <apc/parser.tab.h> //bison
17 #include <apc/ir.h> //ir
19 /* Import apc.c but redefine its primary symbols for jumping */
21 #define yyparse testapc_yyparse
22 #include <bin/tools/apc.c>
26 int main(int, char*[]);
27 int testapc_yyparse(void);
34 const char* cargs
['Z'];
36 extern //apc/parser.tab.c
41 /* Ansi Term Colors */
42 #define RED "\x1b[31m"
43 #define GREEN "\x1b[32m"
44 #define YELLOW "\x1b[33m"
45 #define BLUE "\x1b[34m"
46 #define MAGENTA "\x1b[35m"
47 #define CYAN "\x1b[36m"
48 #define CLRC "\x1b[0m" //clear current color
50 /* Main entry from terminal
51 parses debugging options for testing apc, and calls apc_main
57 { apc_main(argc
, argv
);
58 printf(GREEN
"PASS\n");
63 char tok_lval
[MAX_TOK
];
65 /* yyparse intercept */
69 char* tok_pattern
= "T[%i]L[%i]";
70 char* lval_type
= tok_pattern
+ 8; //location of i
80 for (i
= 0; i
< 10; i
++)
81 { if ((tok
= lexer()) != 0)
82 { *lval_type
= tok_lval
[tok
] ? tok_lval
[tok
] : 'i';
83 printf(tok_pattern
, tok
, yylval
.val
);