diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-04-24 17:43:21 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-04-24 17:43:21 -0400 |
commit | ecf8b49cf99ccf0bf941a2ed9707ee5d43ebf0ad (patch) | |
tree | 43638dcef61e96f1ad25c7d3815ebcbca50bb7d2 /test.toc | |
parent | 2de90e47312b8a7de69712015590fc7fbd3d9b0a (diff) |
improve cgen for loops and allow returning something of unknown type
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -1,18 +1,14 @@ #include "std/io.toc"; - -foo ::= fn() int { - puts("Hello"); - 3 -} - -bar ::= fn() (int, int) { - foo(), foo() +c_add ::= fn(x:int, y:int) int { + #C("x+y") } main ::= fn() { - _ := 5; - _ := 6+_; - _ := foo(); - _,_ := bar(); - _,_ := bar(); + xs : [5]int; + for x, i := &xs { + *x = c_add(i*i, i*i*i); + } + for x := xs { + puti(x); + } } |