diff options
-rw-r--r-- | eval.c | 7 | ||||
-rw-r--r-- | out.c | 17 | ||||
-rw-r--r-- | test.toc | 23 | ||||
-rw-r--r-- | vgcore.218438 | bin | 0 -> 6537216 bytes | |||
-rw-r--r-- | vgcore.218454 | bin | 0 -> 6537216 bytes | |||
-rw-r--r-- | vgcore.218567 | bin | 0 -> 6537216 bytes | |||
-rw-r--r-- | vgcore.218588 | bin | 0 -> 6537216 bytes | |||
-rw-r--r-- | vgcore.218644 | bin | 0 -> 6537216 bytes |
8 files changed, 27 insertions, 20 deletions
@@ -502,7 +502,9 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) { eval_binary_op_one(f32, F32, op); \ eval_binary_op_one(f64, F64, op) + #define eval_binary_op_nums_only(op) \ + /* fix casting to bool */ val_cast(&lhs, &e->binary.lhs->type, &lhs, &e->type); \ val_cast(&rhs, &e->binary.rhs->type, &rhs, &e->type); \ assert(e->type.kind == TYPE_BUILTIN); \ @@ -534,7 +536,8 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) { assert(e->type.kind == TYPE_BUILTIN); \ switch (builtin) { \ eval_binary_bool_op_nums(builtin, op); \ - default: assert(0); break; \ + default:printf("%d\n",(int)builtin); \ + assert(!"Invalid builtin to "#op); break; \ } @@ -629,7 +632,7 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) { if (e->binary.op != BINARY_SET) if (!eval_expr(ev, e->binary.lhs, &lhs)) return false; if (!eval_expr(ev, e->binary.rhs, &rhs)) return false; - BuiltinType builtin = e->type.builtin; + BuiltinType builtin = e->binary.lhs->type.builtin; switch (e->binary.op) { case BINARY_ADD: eval_binary_op_nums_only(+); break; @@ -17,7 +17,7 @@ typedef struct { void *data; u64 n; } slice_; /* declarations */ -void puti(i64 x); +i64 foo(void); void main__(void); /* code */ int main() { @@ -25,17 +25,20 @@ int main() { return 0; } -void puti(i64 x) { +i64 foo(void) { { - }} + i64 i; { + i64 expr__; expr__ = 0;i = expr__;} + while ((i<100)) { + i = (i+1);; + }; + }return i; +} void main__(void) { { - i64((* Ar)[5]); { - i64((* expr__)[5]); expr__ = ((i64((*)[5]))calloc(1, sizeof(i64([5]))));Ar = expr__;} - slice_ A; { - slice_ expr__; slice_ a0_; a0_.data = calloc(100, sizeof(i64)); a0_.n = 100;expr__ = a0_;A = expr__;} + i64( Ar[1]) = {0}; }} @@ -1,24 +1,25 @@ // #C("#include <stdio.h> // #define kasfdhkjasdfhjk "); -puti @= fn(x: int) { +// puti @= fn(x: int) { // #C("printf(\"%ld\\n\", (long)x)"); -}; +// }; foo @= fn() int { - X := new([100]int); + // X := new([100]int); i := 0; while i < 100 { - (*X)[i] = i; - i = i + 1; - } - total := 0; - i = 0; - while i < 100 { - total = total + (*X)[i]; + // (*X)[i] = i; i = i + 1; } - total + i + // total := 0; + // i = 0; + // while i < 100 { + // total = total + (*X)[i]; + // i = i + 1; + // } + // total }; main @= fn() { diff --git a/vgcore.218438 b/vgcore.218438 Binary files differnew file mode 100644 index 0000000..eeae9d6 --- /dev/null +++ b/vgcore.218438 diff --git a/vgcore.218454 b/vgcore.218454 Binary files differnew file mode 100644 index 0000000..5a3a550 --- /dev/null +++ b/vgcore.218454 diff --git a/vgcore.218567 b/vgcore.218567 Binary files differnew file mode 100644 index 0000000..ccd3cb9 --- /dev/null +++ b/vgcore.218567 diff --git a/vgcore.218588 b/vgcore.218588 Binary files differnew file mode 100644 index 0000000..cf38c22 --- /dev/null +++ b/vgcore.218588 diff --git a/vgcore.218644 b/vgcore.218644 Binary files differnew file mode 100644 index 0000000..a728f98 --- /dev/null +++ b/vgcore.218644 |