summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c14
-rw-r--r--parse.c1
-rw-r--r--test.toc8
3 files changed, 17 insertions, 6 deletions
diff --git a/main.c b/main.c
index 3e75e12..e21285a 100644
--- a/main.c
+++ b/main.c
@@ -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
diff --git a/parse.c b/parse.c
index 4b95c70..b101afe 100644
--- a/parse.c
+++ b/parse.c
@@ -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: {
diff --git a/test.toc b/test.toc
index 398f7b7..8103f08 100644
--- a/test.toc
+++ b/test.toc
@@ -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;
+ }
+ }
}