diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7e5620..ca81755 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ First, the main development branch of Toy is 'v2', with the branches 'v1' and 'v v2 is a ground-up rewrite, with additions, changes and deletions to the language that make sense. If you want to discuss the direction things are going, the [Discussions Tab](https://github.com/Ratstail91/Toy/discussions) is perfect for that. -The [Issue Tracker](https://github.com/Ratstail91/Toy/issues) is a good place to see what tasks and issues are currently waiting to be addressed. The [toy.h](https://github.com/Ratstail91/Toy/blob/v2/source/toy.h) source file is a quick way to see what building blocks are available in the source code. There are also a number of comments prepended with `TODO:` scattered throughout the source code, as reminders of planned features. +The [Issue Tracker](https://github.com/Ratstail91/Toy/issues) is a good place to see what tasks and issues are currently waiting to be addressed. The [toy.h](https://github.com/Ratstail91/Toy/blob/v2/source/toy.h) source file is a quick way to see what building blocks are available in the source code. There are also a number of comments prepended with `TODO` scattered throughout the source code, as reminders of planned features. The [test cases](https://github.com/Ratstail91/Toy/tree/v2/tests/cases), which test individual parts of the code in isolation, can be a good way to see how those parts are used. Likewise, the [REPL](https://github.com/Ratstail91/Toy/tree/v2/repl) shows a practical usage of Toy. @@ -33,8 +33,6 @@ graph TB Toy_Array ``` -*TODO: Toy_Value will eventually depend on other structures, includeing those shown here, once the related features are implemented in v2.* - In addition, [toy_common.h](https://github.com/Ratstail91/Toy/blob/v2/source/toy_common.h) grants platform portability and version info, while [toy_console_colors.h](https://github.com/Ratstail91/Toy/blob/v2/source/toy_console_colors.h) provides string constants as macros that help with console output (where supported). # Coding Habits diff --git a/repl/main.c b/repl/main.c index 202733c..ccf3376 100644 --- a/repl/main.c +++ b/repl/main.c @@ -251,7 +251,7 @@ static void errorAndExitCallback(const char* msg) { } //main file -int main(int argc, const char* argv[]) { //TODO: this needs an interactive terminal mode +int main(int argc, const char* argv[]) { Toy_setPrintCallback(printCallback); Toy_setErrorCallback(errorAndExitCallback); Toy_setAssertFailureCallback(errorAndExitCallback); diff --git a/source/toy_ast.h b/source/toy_ast.h index 30eec42..3f98175 100644 --- a/source/toy_ast.h +++ b/source/toy_ast.h @@ -31,7 +31,7 @@ typedef enum Toy_AstFlag { TOY_AST_FLAG_MULTIPLY, TOY_AST_FLAG_DIVIDE, TOY_AST_FLAG_MODULO, - TOY_AST_FLAG_ASSIGN, //TODO: implement the declare statement + TOY_AST_FLAG_ASSIGN, TOY_AST_FLAG_ADD_ASSIGN, TOY_AST_FLAG_SUBTRACT_ASSIGN, TOY_AST_FLAG_MULTIPLY_ASSIGN, @@ -99,7 +99,6 @@ typedef struct Toy_AstPass { typedef struct Toy_AstError { Toy_AstType type; - //TODO: more data regarding the error } Toy_AstError; typedef struct Toy_AstEnd { diff --git a/source/toy_opcodes.h b/source/toy_opcodes.h index 405f817..a875d1c 100644 --- a/source/toy_opcodes.h +++ b/source/toy_opcodes.h @@ -36,7 +36,7 @@ typedef enum Toy_OpcodeType { //various action instructions TOY_OPCODE_PRINT, TOY_OPCODE_CONCAT, - //TODO: clear the program stack + //TODO: clear the program stack? //meta instructions TOY_OPCODE_PASS, diff --git a/source/toy_routine.c b/source/toy_routine.c index da6e3e1..6261a8a 100644 --- a/source/toy_routine.c +++ b/source/toy_routine.c @@ -92,7 +92,6 @@ static void emitString(Toy_Routine** rt, Toy_String* str) { static void writeRoutineCode(Toy_Routine** rt, Toy_Ast* ast); //forward declare for recursion static void writeInstructionValue(Toy_Routine** rt, Toy_AstValue ast) { - //TODO: store more complex values in the data code EMIT_BYTE(rt, code, TOY_OPCODE_READ); EMIT_BYTE(rt, code, ast.value.type); @@ -369,7 +368,9 @@ static void* writeRoutine(Toy_Routine* rt, Toy_Ast* ast) { emitInt((void**)&buffer, &capacity, &count, 0); //subs } - //append various parts to the buffer TODO: add the rest + //append various parts to the buffer + //TODO: param region + if (rt->codeCount > 0) { expand(&buffer, &capacity, &count, rt->codeCount); memcpy((buffer + count), rt->code, rt->codeCount); @@ -394,6 +395,8 @@ static void* writeRoutine(Toy_Routine* rt, Toy_Ast* ast) { count += rt->dataCount; } + //TODO: subs region + //finally, record the total size within the header, and return the result *((int*)buffer) = count; diff --git a/source/toy_string.h b/source/toy_string.h index e8f0b12..ad53ec4 100644 --- a/source/toy_string.h +++ b/source/toy_string.h @@ -5,6 +5,7 @@ #include "toy_bucket.h" #include "toy_value.h" +//TODO: Remove this #define TOY_STRING_MAX_LENGTH 1000 //rope pattern diff --git a/source/toy_value.c b/source/toy_value.c index a2c1750..8b5f7b9 100644 --- a/source/toy_value.c +++ b/source/toy_value.c @@ -25,7 +25,7 @@ bool Toy_private_isTruthy(Toy_Value value) { bool Toy_private_isEqual(Toy_Value left, Toy_Value right) { //temp check if (right.type > TOY_VALUE_STRING) { - Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET); //TODO: varargs + Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET); } switch(left.type) { @@ -64,7 +64,7 @@ bool Toy_private_isEqual(Toy_Value left, Toy_Value right) { case TOY_VALUE_FUNCTION: case TOY_VALUE_OPAQUE: default: - Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET); //TODO: varargs + Toy_error(TOY_CC_ERROR "ERROR: Unknown types in value equality comparison\n" TOY_CC_RESET); } return 0; @@ -111,7 +111,7 @@ unsigned int Toy_hashValue(Toy_Value value) { return str->cachedHash; } else if (str->type == TOY_STRING_NODE) { - //TODO: I wonder it it would be possible to discretely swap the composite node string with a new leaf string here? Would that speed up other parts of the code by not having to walk the tree? + //TODO: I wonder if it would be possible to discretely swap the composite node string with a new leaf string here? Would that speed up other parts of the code by not having to walk the tree in future? char* buffer = Toy_getStringRawBuffer(str); str->cachedHash = hashCString(buffer); free(buffer); diff --git a/source/toy_vm.h b/source/toy_vm.h index e84bfbb..f19658e 100644 --- a/source/toy_vm.h +++ b/source/toy_vm.h @@ -29,8 +29,8 @@ typedef struct Toy_VM { //stack - immediate-level values only Toy_Stack* stack; - //heap - block-level key/value pairs - //TODO: needs string util for identifiers + //scope - block-level key/value pairs + //TODO: Toy_Scope* scope; //easy access to memory Toy_Bucket* stringBucket;