Commit Graph

205 Commits

Author SHA1 Message Date
Kayne Ruse
c6d8766bc3 Added scripts/benchpress.toy
This file works in Toy v1 and Toy v2, but currently causes an SO.

See #171
2025-01-10 04:08:10 +11:00
Kayne Ruse
14696833fd Postfix '++' & '--' works (prefix & postfix are both tested) 2025-01-09 18:33:10 +11:00
Kayne Ruse
6f16c31f24 Prefix '++' working (postfix is next) 2025-01-09 16:45:48 +11:00
Kayne Ruse
3aee2ba664 Added quotemarks to internal string elements
This applies to strings within arrays and tables.
2025-01-09 12:11:23 +11:00
Kayne Ruse
b55192e513 Removed stubs for types as values
Also potentially fixed a bug in the previous commit, not certain
2025-01-09 11:46:29 +11:00
Kayne Ruse
90ffe9b40e Disallow empty bodies in control flow statements, added 'pass' keyword
Fixed #170
2025-01-09 11:03:03 +11:00
Kayne Ruse
9de9c85bea Update README.md 2025-01-01 21:21:14 +11:00
Kayne Ruse
23eb3e45df Keywords 'break' & 'continue' tested
There were a couple bugs - I'm glad I'm so thorough with these tests.

See #152
2024-12-30 16:56:57 +11:00
Kayne Ruse
b84a70cc34 Keywords 'break' and 'continue' are working, untested
See #152
2024-12-30 09:50:51 +11:00
Kayne Ruse
6d25beea03 Removed minPsl from tables, not needed (always zero)
Closes #166
2024-12-27 17:24:28 +11:00
Kayne Ruse
e96f87ff45 Merge remote-tracking branch 'refs/remotes/origin/v2' into v2 2024-12-27 13:07:19 +11:00
Kayne Ruse
0192b60338 Updated README.md, filled out issue tracker, planning ahead 2024-12-27 13:04:44 +11:00
Kayne Ruse
c3a737eae5 Added a reference file to notes 2024-12-26 17:13:46 +11:00
Kayne Ruse
cc4ff3f6d8 Fixed logical AND and OR operators, read more
The definition of '&&':
  Return the first falsy value, or the last value, skipping the evaluation of other operands.

The definition of '||':
  Return the first truthy value, or the last value, skipping the evaluation of other operands.

Toy now follows these definitions.

Fixed #154
2024-12-26 16:09:16 +11:00
Kayne Ruse
153ab54be6 Fixed some incorrect precedence rules 2024-12-26 14:46:12 +11:00
Kayne Ruse
24cfe7f539 Fixed some error states and error messages, read more
By leaving 'null' on the stack, it won't cause stack underflows in a
bunch of erroneous situations. This will allow the repl (and other
situations) to continue if they want to.

I've also fixed some error messages in toy_table.c, which were formatted
badly.

Closes #162
2024-12-26 14:33:26 +11:00
Kayne Ruse
3ca816439e Swapped some if-checks for asserts, closes #161
Thanks 'devast8a' on discord
2024-12-26 13:09:21 +11:00
Kayne Ruse
9cb138a7d6 Added tables to integration tests, tweaked a lot of comments 2024-12-25 11:04:18 +11:00
Kayne Ruse
9e2cbb1f59 Quick fix for some self-referential table bugs 2024-12-24 16:47:58 +11:00
Kayne Ruse
b092b8ce50 Added tables to the scripts, untested
This also has a lot of bugfixing.
2024-12-24 16:08:42 +11:00
Kayne Ruse
4faa0c0476 Fixed nested assignment bug 2024-12-24 11:58:51 +11:00
Kayne Ruse
223db840c8 Benchmarked memory models for Toy_Array, read more
The results can be found in
'tests/benchmarks/array_allocation/results.md'

The results are disappointing, as 'malloc()' is simply faster in every
possible situation compared to my custom arena allocator.
2024-12-24 10:37:54 +11:00
Kayne Ruse
8b5cc3b493 Wrote a benchmark to test TOY_BUCKET_IDEAL sizes 2024-12-18 00:40:17 +11:00
Kayne Ruse
04c799954c Tweaked standard bucket sizes, see #160
Hyacinth: It's pronounced "Bouquet"!
2024-12-17 22:25:33 +11:00
Kayne Ruse
3e17916a4a Prepped for #160, fixed a stack-shrink bug 2024-12-17 21:18:45 +11:00
Kayne Ruse
a28053d4e9 Reworked Toy_String as a union, enabled -Wpedantic
Toy now fits into the C spec.

Fixed #158

Addendum: MacOS test caught an error:

error: a function declaration without a prototype is deprecated in all versions of C

That took 3 attempts to fix correctly.

Addendum: 'No new line at the end of file' are you shitting me?
2024-12-15 15:52:06 +11:00
Kayne Ruse
93fce94e9c Locales are hard, sorry!
Fixed #159
2024-12-14 12:57:53 +11:00
Kayne Ruse
7be63c8ccc Added -Wpointer-arith to CFLAGS, read more
I attempted to add '-Wpedantic' to CFLAGS, but it seems that my usage of
the variable length arrays within unions is causing an error that can't
be selectively disabled:

error: invalid use of structure with flexible array member [-Werror=pedantic]

This is the offending code: /source/toy_string.h#L9-L37

It seems that tagged unions, with VLAs within, is simply not allowed.
Unfortunately, my whole string system depends on it. I'll have to find some way
around it.

I've also updated the debugging output in repl/main.c.
2024-12-12 18:23:44 +11:00
Kayne Ruse
cf9affe190 Fixed unused param
Accidentally used a c23 feature.

MacOS runner didn't like that.
2024-12-12 16:23:09 +11:00
Kayne Ruse
fce71a6cda Tweaked CFLAGS, and fixed related errors 2024-12-12 16:18:41 +11:00
Kayne Ruse
5f4dfdccc5 Updated docs and comments 2024-12-11 17:07:49 +11:00
Kayne Ruse
476a79b746 Updated README.md syntax examples 2024-12-10 17:10:09 +11:00
Kayne Ruse
5f75b5f1a3 Allowed for empty arrays and trailing commas 2024-12-10 10:44:13 +11:00
Kayne Ruse
1a36c14247 Expanded array tests, read more
Getting the array's length is still not available yet, so I'm not
marking arrays as done - but everything that is there is tested.

I've also tweaked the assert output callbacks to also print 'assert failure'.
2024-12-09 12:11:31 +11:00
Kayne Ruse
61a105db2d Compound assignment for arrays is working, untested, read more
I added reference values in 62ca7a1fb7,
but forgot to mention it. I'm now using references to assign to the
internals of an array, no matter how many levels deep it is.
2024-12-07 15:35:06 +11:00
Kayne Ruse
2324150fd5 Update CODE_OF_CONDUCT.md 2024-12-07 07:43:28 +11:00
Kayne Ruse
03dce296cb Assignment target is now an AST node
This will make assigning to arbitrary targets easier.
2024-12-04 19:24:58 +11:00
Kayne Ruse
62ca7a1fb7 WIP: Implementing arrays into the script, read more
I had intended to solve the Advent of Code puzzles in Toy, but they
don't work without arrays. I wasn't able to enable arrays in time, so
I need to focus on doing things correctly.

The most immediate tasks are marked with 'URGENT', and a lot of tests
need writing.
2024-12-02 11:58:03 +11:00
Kayne Ruse
12c6ac938c WIP: tests incomplete 2024-11-30 12:50:46 +11:00
Kayne Ruse
58cecafb3b WIP: Adding arrays to value structure, tests incomplete 2024-11-29 12:17:54 +11:00
Kayne Ruse
bb2e85e350 Updated README.md 2024-11-29 12:16:10 +11:00
Kayne Ruse
431893bf60 WIP: Started on break & continue, needs Toy_Array in Toy_Value first 2024-11-28 13:43:26 +11:00
Kayne Ruse
6cc331d462 While is working but untested, read more
* TODO: break and continue keywords need to be implemented
* TODO: while-then needs testing
* Fixed the parser not liking zero-length strings
2024-11-26 14:48:24 +11:00
Kayne Ruse
0947430c29 Finished if-then-else tests, finally. 2024-11-26 11:30:28 +11:00
Kayne Ruse
1695f9d1c9 Found and fixed a bug in the parser 2024-11-23 15:43:31 +11:00
Kayne Ruse
79c4374a1f Make sure this test works without scope braces too 2024-11-23 13:41:02 +11:00
Kayne Ruse
37fb3927a6 Implemented some tests, not finished yet
* parser compounds
* routine keyword assert
2024-11-23 10:45:19 +11:00
Kayne Ruse
0b559ecb74 Fixed the lines marked as 'URGENT' 2024-11-23 10:07:05 +11:00
Kayne Ruse
7d4ea4881f WIP: Fixed print bug, tests incomplete, read more
I was sidetracked by a strange display bug - turns out it was caused by
pointers - this commit fixes it.

The tests for if-then-else still aren't finished, but I'm knocking off
as it's past my time limit. I've marked 'TODO' and 'URGENT' using
comments, so finding the issues should be easy.
2024-11-22 18:21:47 +11:00
Kayne Ruse
b29a87840d EMERGENCY: Computer is dying, this is an incomplete commit, do not use 2024-11-22 15:48:44 +11:00