diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-16 15:53:06 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-16 15:53:06 -0400 |
commit | 8e5455bb58956031658caab650f0a162fc471508 (patch) | |
tree | a50cd8f0c0067b4e199cde3fbb2c5cd48573e807 | |
parent | d7b155a319b423d3b1cda76bd33360964e124a65 (diff) |
oops forgot about while!
-rw-r--r-- | main.c | 14 | ||||
-rw-r--r-- | parse.c | 1 | ||||
-rw-r--r-- | test.toc | 8 |
3 files changed, 17 insertions, 6 deletions
@@ -10,19 +10,21 @@ TODO: break continue +&&, || +don't allow while {3; 5} or for 0..10 { 3; 5 } +make #sizeof always take a Type +sizeof (not #sizeof) +- make new(s) and del functions! +start making a standard library... (printf; stringbuilder would be nice to have) switch + - #fallthrough + - make sure break works inside a switch with cgen! - you'll need goto enums unions -sizeof (not #sizeof) -- make new and del functions! --- switch to / add as an alternative: libffi X ::= newtype(int); or something -don't allow while {3; 5} or for 0..10 { 3; 5 } (once break is added) any odd number of "s for a string -consider- should #sizeof always take a Type? it would be more verbose, but we might not actually need - #sizeof that much, given that we have new. - it probably should, because #sizeof(x[0]) can't be evaluated at compile time if x is not a constant --- #returns_code (struct body is a block, to be evaluated at compile time, which returns the actual statements) - struct varargs @@ -1437,6 +1437,7 @@ static Status parse_expr(Parser *p, Expression *e, Token *end) { return false; } if (!parse_block(p, &w->body, 0)) return false; + w->body.flags |= BLOCK_IS_LOOP; goto success; } case KW_FOR: { @@ -6,4 +6,12 @@ main ::= fn() { io.puti(i); if i == 7 { break; } } + i := 0; + while { + i += 1; + io.puti(i); + if i == 10 { + break; + } + } } |