Commit Graph

259 Commits

Author SHA1 Message Date
Kayne Ruse eb33775314 FIX: compounds assigned to themselves would cause self-references 2026-04-28 09:23:43 +10:00
Kayne Ruse 617a658de0 Added the preview image, so I don't lose it 2026-04-27 14:33:12 +10:00
Kayne Ruse 6ebbcc45a3 Tweaked build paths 2026-04-27 10:07:16 +10:00
Kayne Ruse b718b35097 FIX: Substrings had corner-cases with incorrect results, read more
I found this while writing unit tests for Toy_Function, where one
(native) function was named 'identity' and another (custom) was named
'ident' to avoid a naming clash. The rename didn't resolve the clash, so
after some digging, I found that strings compared to substrings would
return a match, despite being different.

This took some awkward corner-case handling, as it turns out
'deepCompareUtil' only returns zero when no differences have been found,
not when a match has been found. I also added checks for this to
Toy_String's unit test, with the parameters checked in both orders i.e.
(a,b) and (b,a), because paranoia is your friend.

The rope pattern is powerful, but also gives you enough rope to hang
yourself.
2026-04-26 22:52:24 +10:00
Kayne Ruse af30246e0c Implemented array.forEach(fn) 2026-04-26 11:59:15 +10:00
Kayne Ruse efc9fe1406 Tweaked stack allocation when inheriting VMs 2026-04-26 10:14:19 +10:00
Kayne Ruse c9a34e2259 Corrected usage of 'Toy_allocateTable' 2026-04-26 09:55:11 +10:00
Kayne Ruse 0c24a7609e Added the following attributes:
* table.length
* table.insert(key,value)
* table.hasKey(key)
* table.remove(key)

There's basically only iteration and sorting left.
2026-04-24 23:01:57 +10:00
Kayne Ruse 88e9794952 Implemented the following attributes:
* String.length
* String.asUpper
* String.asLower
* array.length
* array.pushBack(x)
* array.popBack()

The remaining attributes are listed in 'toy_attributes.h'
2026-04-24 17:33:10 +10:00
Kayne Ruse b589392b9e Comment tweaks 2026-04-24 13:01:38 +10:00
Kayne Ruse 21819b2d62 Capitalized type names 2026-04-24 12:46:27 +10:00
Kayne Ruse 4aec343b6c BUGFIX: scopes weren't expanding as intended 2026-04-24 12:46:05 +10:00
Kayne Ruse 9a75226491 Implemented the attribute operator, using a period 2026-04-24 11:31:54 +10:00
Kayne Ruse d2ac1eeb8e Syntax fix 2026-04-23 11:09:25 +10:00
Kayne Ruse f8596806ee Attempting a fix for macOS builds 2026-04-23 11:02:25 +10:00
Kayne Ruse 4957536e23 When in doubt, typecast 2026-04-23 10:45:06 +10:00
Kayne Ruse 5a867ac627 Fixed some 'size_t' issues and a bug caught on a different platform 2026-04-23 10:40:00 +10:00
Kayne Ruse 991d29e3e6 Enabled CI for other supported platforms 2026-04-23 10:10:58 +10:00
Kayne Ruse accb7f9fb4 Started work on an AST inspector 2026-04-22 15:57:55 +10:00
Kayne Ruse 63dfd33e5e Added arrays and tables to the bytecode inspector
Currently searching for an issue related to compounds.
2026-04-22 14:31:17 +10:00
Kayne Ruse 9bb115f732 Disabled bloated and verbose testing output 2026-04-22 13:06:14 +10:00
Kayne Ruse 8875b6968b Updated VM unit tests 2026-04-22 12:53:02 +10:00
Kayne Ruse 97d16c1184 Updated compiler unit tests 2026-04-22 12:07:40 +10:00
Kayne Ruse 47c5d49069 Updated parser unit test, fixed a missing stack pop for binary exprStmt 2026-04-22 11:40:53 +10:00
Kayne Ruse 2c92f829e1 Fixed stack overflow caused by expression statements
This is a longstanding bug, so I'm glad its fixed, even if its only a
bandaid.

This does break some tests, but I'm too tired and these tests are out of
date.
2026-04-17 23:43:30 +10:00
Kayne Ruse 5b101d763e Expanded bytecode inspector, added functions to Toy_copyValue 2026-04-17 11:55:46 +10:00
Kayne Ruse 81c95ff69d Cleared out some unneeded notes 2026-04-17 09:25:18 +10:00
Kayne Ruse 88100b128a Implemented native C functions called from Toy scripts
There's only example functions for now, but I'll add type-specific
functions later.
2026-04-16 21:14:42 +10:00
Kayne Ruse 3a0f11ebb4 Added string type check 2026-04-16 19:30:23 +10:00
Kayne Ruse f9790b99ce Moved type coersion check, functions can be compared
Also updated some tagged comments
2026-04-15 15:04:54 +10:00
Kayne Ruse dde52f9d8a Workflow tinkering 2026-04-15 14:17:32 +10:00
Kayne Ruse cda4bee6ee Double-checked strncpy doesn't have bugs
Apparently the linux kernel removed strncpy entirely.
2026-04-13 12:09:09 +10:00
Kayne Ruse 9a10fadada Tweaked CI 2026-04-12 23:15:56 +10:00
Kayne Ruse 8eefbc8a0c Added remaining opcodes to inspector
Also used some coloring for terminal outputs
2026-04-12 23:04:31 +10:00
Kayne Ruse e24823924a Comment tweaks 2026-04-12 15:02:07 +10:00
Kayne Ruse c0c03a4110 Functions are working, tests incomplete
This required a massive cross-cutting rework to the scope system,
multiple subtle bugfixes and relearning of the parser internals, but it
does appear that functions are working correctly.

A few caveats: for now, parameters are always constant, regardless of
type, return values can't be specified, and some script tests have been
written.

Most importantly, a key feature is working: closures.
2026-04-12 11:52:58 +10:00
Kayne Ruse b0d9c15d33 Added a benchmark for JS 2026-04-12 08:55:15 +10:00
Kayne Ruse 24e5d8081c Tweaked a doc 2026-04-12 08:42:06 +10:00
Kayne Ruse 42aef306a9 Added a lua benchmark for performance comparisons 2026-04-12 08:40:28 +10:00
Kayne Ruse 6f27d07829 Added a few opcodes to the inspector 2026-04-12 00:19:20 +10:00
Kayne Ruse b32ea9f309 Started working on a decompiler, called 'bytecode inspector'
It only has a few instructions for now, but I can flesh it out over
time.
2026-04-11 13:37:26 +10:00
Kayne Ruse 49a825aaf9 Removed some old notes 2026-04-11 02:06:59 +10:00
Kayne Ruse baa81b1aa9 Removed annoying workingdir thing 2026-04-11 01:55:11 +10:00
Kayne Ruse 9553edef9c Added tools for vscode 2026-04-11 01:48:30 +10:00
Kayne Ruse 66155fa213 Tweak, but I need a decompiler now 2026-04-10 16:19:03 +10:00
Kayne Ruse 547229e150 Script tests re-added, all tests can run under gdb
Also fixed a minor bug with printing, and removed the ability to
configure the parser.

Added and updated QUICKSTART.md as a quick way to get people started.

There's some broken scripts under 'scripts/' that require functions to
work properly.
2026-04-10 15:28:56 +10:00
Kayne Ruse 211744535e Tweak 2026-04-10 12:15:02 +10:00
Kayne Ruse 3a24fbf6e1 Tweaked CI 2026-04-07 22:00:54 +10:00
Kayne Ruse 842f041a50 VM test is passing 2026-04-07 21:34:05 +10:00
Kayne Ruse 7408a24a12 Scope test is working 2026-04-07 20:48:32 +10:00