Mercurial > hg-old > index.cgi
comparison lwasm/main.c @ 335:9f58e3bca6e3
checkpoint
author | lost |
---|---|
date | Thu, 04 Mar 2010 05:13:22 +0000 |
parents | 67224d8d1024 |
children | 04c80c51b16a |
comparison
equal
deleted
inserted
replaced
334:f2173d18c73f | 335:9f58e3bca6e3 |
---|---|
26 #include <stdlib.h> | 26 #include <stdlib.h> |
27 | 27 |
28 #include <lw_alloc.h> | 28 #include <lw_alloc.h> |
29 #include <lw_string.h> | 29 #include <lw_string.h> |
30 #include <lw_stringlist.h> | 30 #include <lw_stringlist.h> |
31 #include <lw_expr.h> | |
31 | 32 |
32 #include "lwasm.h" | 33 #include "lwasm.h" |
33 #include "input.h" | 34 #include "input.h" |
34 | 35 |
35 extern int parse_pragma_string(asmstate_t *as, char *str); | 36 extern int parse_pragma_string(asmstate_t *as, char *str); |
183 asmstate.output_file = lw_strdup("a.out"); | 184 asmstate.output_file = lw_strdup("a.out"); |
184 } | 185 } |
185 | 186 |
186 input_init(&asmstate); | 187 input_init(&asmstate); |
187 | 188 |
188 do_pass1(&asmstate); | 189 // do_pass1(&asmstate); |
190 { | |
191 lw_expr_t te; | |
192 | |
193 te = lw_expr_build(lw_expr_type_oper, lw_expr_oper_plus, | |
194 lw_expr_build_noref(lw_expr_type_oper, lw_expr_oper_plus, | |
195 lw_expr_build_noref(lw_expr_type_oper, lw_expr_oper_times, | |
196 lw_expr_build_noref(lw_expr_type_int, 2), | |
197 lw_expr_build_noref(lw_expr_type_var, "tvar") | |
198 ), | |
199 lw_expr_build_noref(lw_expr_type_oper, lw_expr_oper_times, | |
200 lw_expr_build_noref(lw_expr_type_var, "tvar"), | |
201 lw_expr_build_noref(lw_expr_type_int, 3) | |
202 ) | |
203 ), | |
204 lw_expr_build_noref(lw_expr_type_oper, lw_expr_oper_times, | |
205 lw_expr_build_noref(lw_expr_type_int, 16), | |
206 lw_expr_build_noref(lw_expr_type_var, "avar") | |
207 ) | |
208 ); | |
209 | |
210 lw_expr_print(te); | |
211 printf("\n"); | |
212 | |
213 lw_expr_simplify(te); | |
214 lw_expr_print(te); | |
215 printf("\n"); | |
216 } | |
189 | 217 |
190 exit(0); | 218 exit(0); |
191 } | 219 } |