Updated Toy

This commit is contained in:
2023-03-11 18:13:38 +11:00
parent 6537f308d2
commit c4bd1f20d2
5 changed files with 7 additions and 7 deletions

View File

@@ -78,10 +78,10 @@ const unsigned char* Toy_compileString(const char* source, size_t* size) {
Toy_initParser(&parser, &lexer);
Toy_initCompiler(&compiler);
//run the parser until the end of the source
//step 1 - run the parser until the end of the source
Toy_ASTNode* node = Toy_scanParser(&parser);
while(node != NULL) {
//pack up and leave
//on error, pack up and leave
if (node->type == TOY_AST_NODE_ERROR) {
Toy_freeASTNode(node);
Toy_freeCompiler(&compiler);
@@ -94,7 +94,7 @@ const unsigned char* Toy_compileString(const char* source, size_t* size) {
node = Toy_scanParser(&parser);
}
//get the bytecode dump
//step 2 - get the bytecode dump
const unsigned char* tb = Toy_collateCompiler(&compiler, size);
//cleanup