Removed some old notes

This commit is contained in:
2026-04-11 02:06:59 +10:00
parent baa81b1aa9
commit 49a825aaf9
6 changed files with 2 additions and 95 deletions

View File

@@ -1,33 +0,0 @@
//source
while (true) {
print "1";
break;
print "2";
}
print "3";
//asm
0 TOY_OPCODE_READ [TOY_VALUE_BOOLEAN, true, -]
4 TOY_OPCODE_JUMP [TOY_OP_PARAM_JUMP_RELATIVE, TOY_OP_PARAM_JUMP_IF_FALSE, -]
8 52 (jumps to end '64' after this JUMP instruction)
12 TOY_OPCODE_SCOPE_PUSH
16 TOY_OPCODE_READ [TOY_VALUE_STRING, TOY_STRING_LEAF, 0]
20 0 (string "1")
24 TOY_OPCODE_PRINT
28 TOY_OPCODE_ESCAPE
32 0? (addr)
36 0? (diff)
40 TOY_OPCODE_READ [TOY_VALUE_STRING, TOY_STRING_LEAF, 0]
44 4 (string "2")
48 TOY_OPCODE_PRINT
52 TOY_OPCODE_SCOPE_POP
56 TOY_OPCODE_JUMP [TOY_OP_PARAM_JUMP_RELATIVE, TOY_OP_PARAM_JUMP_ALWAYS, -]
60 -64 (jumps to start '0' after this JUMP instruction)
64 TOY_OPCODE_READ [TOY_VALUE_STRING, TOY_STRING_LEAF, 0]
68 8 (string "3")
72 TOY_OPCODE_PRINT
76 TOY_OPCODE_RETURN

View File

@@ -1,3 +0,0 @@
type coercion
permanent strings?
concat & free? (strings)

View File

@@ -1,28 +0,0 @@
TOY_OPCODE_DECLARE:
{Declare, type, length, 0} ; {emitString()}
# write value
TOY_OPCODE_READ:
null -> {Read, type, 0, 0}
bool -> {Read, type, value, 0}
int -> {Read, type, 0, 0} ; {value}
float -> {Read, type, 0, 0} ; {value}
string -> {Read, type, leaf, 0} ; {emitString()}
# write assignment
TOY_AST_FLAG_ASSIGN:
{Read, type(string), name, length} ;
{emitString()} ;
{writeCode()} ;
{Assign, 0, 0, 0} ;
TOY_AST_FLAG_ADD_ASSIGN:
{Read, type(string), name, length} ;
{emitString()} ;
{Duplicate, 0, 0, 0} ;
{writeCode()} ;
{Assign, 0, 0, 0}
{Add, Assign, 0, 0} ;
//subtract, multiply, divide, modulo all mimic add

View File

@@ -10,9 +10,6 @@
#include <string.h> #include <string.h>
//utilities //utilities
#define APPEND(dest, src) \
strncpy((dest) + (strlen(dest)), (src), strlen((src)) + 1);
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
#define FLIPSLASH(str) for (int i = 0; str != NULL && str[i]; i++) str[i] = str[i] == '/' ? '\\' : str[i]; #define FLIPSLASH(str) for (int i = 0; str != NULL && str[i]; i++) str[i] = str[i] == '/' ? '\\' : str[i];
#else #else
@@ -60,30 +57,6 @@ unsigned char* readFile(char* path, int* size) {
return buffer; return buffer;
} }
int getFilePath(char* dest, const char* src) {
char* p = NULL;
//find the last slash, regardless of platform
p = strrchr(src, '\\');
if (p == NULL) {
p = strrchr(src, '/');
}
if (p == NULL) {
int len = strlen(src);
strncpy(dest, src, len);
return len;
}
//determine length of the path
int len = p - src + 1;
//copy to the dest
strncpy(dest, src, len);
dest[len] = '\0';
return len;
}
int getFileName(char* dest, const char* src) { int getFileName(char* dest, const char* src) {
char* p = NULL; char* p = NULL;
@@ -489,7 +462,7 @@ int main(int argc, const char* argv[]) {
Toy_runVM(&vm); Toy_runVM(&vm);
//print the debug info //print the debug info
if (cmd.verboseDebugPrint) { if (cmd.verboseDebugPrint) { //URGENT: 'verbose' option is mainly for the WIP elements, like decompiler
debugStackPrint(vm.stack); debugStackPrint(vm.stack);
debugScopePrint(vm.scope, 0); debugScopePrint(vm.scope, 0);
} }

View File

@@ -16,5 +16,3 @@ TOY_API void Toy_setAssertFailureCallback(Toy_callbackType cb);
TOY_API void Toy_resetPrintCallback(void); TOY_API void Toy_resetPrintCallback(void);
TOY_API void Toy_resetErrorCallback(void); TOY_API void Toy_resetErrorCallback(void);
TOY_API void Toy_resetAssertFailureCallback(void); TOY_API void Toy_resetAssertFailureCallback(void);
//TODO: rename print.h to debug?

View File

@@ -92,5 +92,5 @@ TOY_API int Toy_compareValues(Toy_Value left, Toy_Value right);
//convert the value to a string - values that *are* strings are simply copied //convert the value to a string - values that *are* strings are simply copied
TOY_API union Toy_String_t* Toy_stringifyValue(struct Toy_Bucket** bucketHandle, Toy_Value value); TOY_API union Toy_String_t* Toy_stringifyValue(struct Toy_Bucket** bucketHandle, Toy_Value value);
//for debugging //for error messages
TOY_API const char* Toy_private_getValueTypeAsCString(Toy_ValueType type); TOY_API const char* Toy_private_getValueTypeAsCString(Toy_ValueType type);