While is working but untested, read more

* TODO: break and continue keywords need to be implemented
* TODO: while-then needs testing
* Fixed the parser not liking zero-length strings
This commit is contained in:
2024-11-26 14:48:24 +11:00
parent 0947430c29
commit 6cc331d462
7 changed files with 139 additions and 25 deletions

View File

@@ -116,6 +116,16 @@ void Toy_private_emitAstIfThenElse(Toy_Bucket** bucketHandle, Toy_Ast** astHandl
(*astHandle) = tmp;
}
void Toy_private_emitAstWhileThen(Toy_Bucket** bucketHandle, Toy_Ast** astHandle, Toy_Ast* condBranch, Toy_Ast* thenBranch) {
Toy_Ast* tmp = (Toy_Ast*)Toy_partitionBucket(bucketHandle, sizeof(Toy_Ast));
tmp->type = TOY_AST_WHILE_THEN;
tmp->whileThen.condBranch = condBranch;
tmp->whileThen.thenBranch = thenBranch;
(*astHandle) = tmp;
}
void Toy_private_emitAstPrint(Toy_Bucket** bucketHandle, Toy_Ast** astHandle) {
Toy_Ast* tmp = (Toy_Ast*)Toy_partitionBucket(bucketHandle, sizeof(Toy_Ast));