Strings, due to their potentially large size, are stored outside of a routine's code section, in the data section. To access the correct string, you must read the jump index, then the real address from the jump table - and extra layer of indirection will result in more flexible data down the road, I hope. Other changes include: * Added string concat operator .. * Added TOY_STRING_MAX_LENGTH * Strings can't be created or concatenated longer than the max length * The parser will display a warning if the bucket is too small for a string at max length, but it will continue * Added TOY_BUCKET_IDEAL to correspend with max string length * The bucket now allocates an address that is 4-byte aligned * Fixed missing entries in the parser rule table * Corrected some failing TOY_BITNESS tests
For the feature complete version 1, click here.
Toy v2.x
The Toy programming language is an imperative, bytecode-interpreted, embeddable scripting language. Rather than functioning independently, it serves as part of another program, the "host". This design allows for straightforward customization by both the host’s developer and end users, achieved by exposing program logic through text files.
This repository holds the reference implementation for Toy version 2.x, written in C.
Nifty Features
- Simple C-like syntax
- Intermediate AST representation
- Strong, but optional type system
- First-class functions
- Extensible via external libraries
- Can re-direct output, error and assertion failure messages
- Open source under the zlib license
Syntax
print 42; //print is a built-in keyword
//more examples to be added as the features are implemented
Building
Supported platforms are: linux-latest, windows-latest, macos-latest, using GitHub's standard runners.
To build the library, run make source.
To build the library and repl, run make repl.
To build and run the test cases, run make tests.
To build and run the test cases under gdb, run make tests-gdb.
Tools
Coming Soon.
License
This source code is covered by the zlib license (see LICENSE.md).
Contributors and Special Thanks
For a guide on how you can contribute, see CONTRIBUTING.md.
@hiperiondev - v1 Disassembler, v1 porting support and feedback
@add00 - v1 Library support
@gruelingpine185 - Unofficial v1 MacOS support
@solar-mist - v1 Minor bugfixes
The Ratbags - Feedback
@munificent - For writing the book that sparked my interest in langdev
Patreon Supporters
- Seth A. Robinson
