Commit Graph

26 Commits

Author SHA1 Message Date
Kayne Ruse
4805c6757a Added terminal print callbacks
Resolved #127
2024-10-05 23:29:24 +10:00
Kayne Ruse
ad44eeac48 Removed bytecodeSize parameter 2024-10-05 19:44:46 +10:00
Kayne Ruse
d19a90f9bd Added CONTRIBUTING.md
Also renamed 'handles' throughout the project for consistency.

Some meta files also had their file extensions added.
2024-10-05 12:17:27 +10:00
Kayne Ruse
29f5647e31 Small tweak, read more
A table with 400 elements has a maximum PSL of 4.

This is only under test conditions, but WOW.
2024-10-04 17:10:23 +10:00
Kayne Ruse
196b5f86f1 Wrote tests for Toy_Table
I hope that's it, I don't wanna do that again XD
2024-10-04 16:50:54 +10:00
Kayne Ruse
5cf2e70b7d Implemented 'Toy_Table' hashtable with robin hood algorithm, untested 2024-10-03 16:33:47 +10:00
Kayne Ruse
ab1c9b941f Added negate opcode to equality opcode, in the second byte 2024-10-03 10:15:58 +10:00
Kayne Ruse
71c065a6c4 Changed size_t to unsigned int 2024-10-02 03:39:38 +10:00
Kayne Ruse
7b453bc35f Reworked generic structures, read more
The following structures are now more independant:

- Toy_Array
- Toy_Stack
- Toy_Bucket
- Toy_String

I reworked a lot of the memory allocation, so now there are more direct
calls to malloc() or realloc(), rather than relying on the macros from
toy_memory.h.

I've also split toy_memory into proper array and bucket files, because
it makes more sense this way, rather than having them both jammed into
one file. This means the eventual hashtable structure can also stand on
its own.

Toy_Array is a new wrapper around raw array pointers, and all of the
structures have their metadata embedded into their allocated memory now,
using variable length array members.

A lot of 'capacity' and 'count' variables were changed to 'size_t'
types, but this doesn't seem to be a problem anywhere.

If the workflow fails, then I'll leave it for tonight - I'm too tired,
and I don't want to overdo myself.
2024-10-01 20:38:06 +10:00
Kayne Ruse
a9759384cd Fixed bad tests with 64 bit platforms 2024-09-30 15:43:36 +10:00
Kayne Ruse
8d6bdb88b4 Implemented and tested Toy_String, read more
Strings are needed for the handling of identifiers in the key/value
variable storage, so I've got them working first. I used the rope
pattern, which seems to be quite an interesting approach.

I'll add comparison checks later.

Adjusted how buckets are handled in all tests, could've been an issue
down the line.

Added the build instructions to README.md.
2024-09-30 15:22:00 +10:00
Kayne Ruse
c518960171 Toy_VM and Toy_Stack are working and tested, read more
At this point, only a minimal number of operations are working, and
after running any kind of source code, the 'result' is simply left on
the VM's stack. Still, it's awesome to see it reach this point.
2024-09-27 15:12:37 +10:00
Kayne Ruse
a2625fa6d4 Implemented tests for Toy_Bytecode and Toy_Routine 2024-09-22 14:13:50 +10:00
Kayne Ruse
4567484038 Squashed: platform support, bugfixes, GH workflows, read more
I've expanded support to three major platforms:

- linux
- windows
- macos

The CI now runs the test suites for all of these, both under normal
conditions and under GDB (except for macos, which lacks GDB support).

TOY_BITNESS specifies the bit-width of the current platform, either 32
or 64. A value of -1 means the bit-width could not be determined. Some
tests will be disabled if the appropriate bit-width can't be determined,
and a warning is printed to stderr.

TOY_API has been tweaked, and is now dependant on different
preprocessor flags. It is defined as 'extern' on all supported
platforms except windows, which instead specifies DLL support. It
defaults to 'extern' if the platform can't be determined.

commit d0350998ecc80b8925a1962ceb2ab400da50be9d
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sun Sep 22 09:55:42 2024 +1000

    Expanded GDB tests using matrix strategy

commit dc2addacc52830227ddcd0f35997c0e1668b579c
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sun Sep 22 09:05:42 2024 +1000

    Reserved the yield keyword

commit f485c380f74a49092e0c5a41e599fbb06dbce235
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sat Sep 21 15:17:11 2024 +1000

    Potential segfault fix

commit d8b19d21c92133feb071e631009a3cf99df0f068
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sat Sep 21 14:25:47 2024 +1000

    Added testing on windows under GDB, read more

    I'm hunting a segfault that only appears on windows, but I lack a
    windows machine, so github's runners are all I have right now.

commit 8606db541fb5cbe91b16a39e9815fe4a27ba0c8a
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sat Sep 21 13:12:02 2024 +1000

    DLL import/export macros tweaked for windows

    TOY_EXPORT for making a DLL
    TOY_IMPORT for using a DLL

    Defaults to 'extern' if neither option is present

commit a6929666401953a5b3a93dfe83c9398e012beefc
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sat Sep 21 12:52:06 2024 +1000

    Investigating bitness issue on windows

commit 8f615f735868a316e8d5a6a77ed899e72fd537f8
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sat Sep 21 12:32:55 2024 +1000

    Adjusting bitness tests in test_ast.c

commit 61694f2183ac84ee7c53c855f2f6aa29f360f16c
Author: Kayne Ruse <kayneruse@gmail.com>
Date:   Sat Sep 21 11:46:59 2024 +1000

    Added experimental macOS CI job
2024-09-22 11:27:08 +10:00
Kayne Ruse
78320e53bb Multiple bugfixes, read more
* expand() will only touch the memory once
* fixed missing if-else cascade at toy_routine.c:90
* unary negate will not optimise numbers unless the '-' character is immediately prior
* fixed broken test for unary negation of groups
2024-09-20 21:39:02 +10:00
Kayne Ruse
ad6f1c3067 Bytecode and Routine working, Routine tests incomplete
There may be a build issue on windows
2024-09-20 16:22:52 +10:00
Kayne Ruse
e35af3d84b Fixed buffer overflow, bytecode is WIP 2024-09-19 19:06:49 +10:00
Kayne Ruse
083ee950dd WIP bytecode and routine, read more
The tests are failing in a strange way, with the error message 'corrupted top size'. I don't know what it means, and it seems to be caused by a call to printf() within 'test_bytecode.c'. I need a break, as this is making me dizzy.
2024-09-19 12:45:35 +10:00
Kayne Ruse
47ac1c5b30 Removed Toy_AstGroup generation, as it isn't needed 2024-09-14 12:09:02 +10:00
Kayne Ruse
898b8efc04 Implemented tests for Toy_Parser
The parser now correctly produces a workable AST. I think I'll skip
over the optimizer, and begin on the compiler next session. The
optimizer will act directly on the AST, but it isn't totally necessary.

Other tools can also operate on the AST, such as for debugging - I'll
have to ask what kinds are out there.
2024-09-13 18:08:52 +10:00
Kayne Ruse
b00a6838be Wrote Toy_Parser with minimal features, tests missing
It's too late at night, so I'm packing this up with only a dummy warning
message for the tests. I'll keep going tomorrow, hopefully.
2024-09-12 20:53:34 +10:00
Kayne Ruse
eca3350c64 Tweaked platform support, disabled some tests based on platform 2024-09-10 21:08:05 +10:00
Kayne Ruse
5fd933a15e Implemented AST, ensured bucket memory worked 2024-09-10 20:25:01 +10:00
Kayne Ruse
81417e7f32 Implemented bucket memory structure for custom allocators 2024-09-07 19:47:02 +10:00
Kayne Ruse
e6ad46f1ff Wrote value, chunk, memory sections, tested value
chunk and memory remain untested for now
2024-08-13 23:42:14 +10:00
Kayne Ruse
a912b6a29c Added lexer, implemented tests build system 2024-08-11 20:15:09 +10:00