Kayne Ruse
813da3e1aa
WIP Adding for-loop to parser & compiler
2026-05-21 11:26:59 +10:00
Kayne Ruse
750ebd1f99
Added 'range' to standard library, adjusted native functions
2026-05-20 13:48:52 +10:00
Kayne Ruse
f55f27726c
Fixed invoking functions within function arguments
...
Somewhat similar to c9d4b9965c
2026-05-19 13:24:17 +10:00
Kayne Ruse
a0d75b3c70
Updated and revised some tests
2026-05-19 11:24:49 +10:00
Kayne Ruse
414a9d6194
Expanded docs
2026-05-17 09:47:46 +10:00
Kayne Ruse
2eaf0a9b0f
Updated QUICKSTART, moved it to docs
2026-05-15 14:56:43 +10:00
Kayne Ruse
3ab18c7b14
Fixed nagging issues, read more
...
* A segfault from the inspector
* multiple returns no longer a goal
* Cleaned up the 'URGENT' comment tags
* Narrowed down what is needed for alpha
2026-05-15 14:13:54 +10:00
Kayne Ruse
6901b9a6c9
Opaque values can be referenced
2026-05-13 17:54:24 +10:00
Kayne Ruse
c9d4b9965c
Added function invoke in RHS values
...
Return also supports chained expressions.
2026-05-13 17:32:05 +10:00
Kayne Ruse
ff1ef1352a
Reviewed and updated tagged comments
2026-05-13 10:56:40 +10:00
Kayne Ruse
53d3606c7e
Found and fixed some obscure leaks in 'Toy_Scope'
2026-05-10 17:35:07 +10:00
Kayne Ruse
83fb5222a2
Found and fixed a memory leak in the rope strings
...
Also fixed a bit manipulation error in the GC.
2026-05-10 15:45:16 +10:00
Kayne Ruse
3b813da1cf
Zero the bucket's memory
...
Windows doesn't do this automatically.
2026-05-09 13:00:06 +10:00
Kayne Ruse
8b9b012bcc
Fixed a memory leak
2026-05-08 17:23:36 +10:00
Kayne Ruse
6c055a0435
Implemented garbage collection
...
As a whole, this is still tentative.
2026-05-08 16:28:12 +10:00
Kayne Ruse
be84a8dfe2
Tweaked output callbacks to match 'puts' signature
2026-05-08 11:12:27 +10:00
Kayne Ruse
185f3896c5
Fixed API naming convention
...
Anything prepended with TOY_API is 'public'.
Anything that starts with Toy_private_* shouldn't be touched.
2026-05-06 16:12:50 +10:00
Kayne Ruse
60a0fe8907
Added opaque attributes to API
2026-05-06 16:02:27 +10:00
Kayne Ruse
18a4b33c4e
Enabled the opaque value type
...
Also improved a couple error messages.
2026-05-01 18:42:51 +10:00
Kayne Ruse
eb33775314
FIX: compounds assigned to themselves would cause self-references
2026-04-28 09:23:43 +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
accb7f9fb4
Started work on an AST inspector
2026-04-22 15:57:55 +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
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
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
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
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
842f041a50
VM test is passing
2026-04-07 21:34:05 +10:00
Kayne Ruse
09fc6d5279
Compiler test is passing
2026-04-07 20:36:58 +10:00
Kayne Ruse
48072f0dd1
AST test is passing
2026-04-07 20:06:44 +10:00
Kayne Ruse
522fc3e64b
Value test is passing
2026-04-07 19:44:28 +10:00