Commit graph

21 commits

Author SHA1 Message Date
2666c0f148 Implement bytecode (de)serialization 2023-03-07 21:40:07 +01:00
4d840fd817 Allow NULL as subfunction matcher
This will match all arguments and discard them. This makes the bytecode
for simple functions easier and will make it easier to construct simple
function programmatically.
2023-02-25 23:19:45 +01:00
e0881c558c strings+io: Make chars unsigned 2023-02-13 22:31:18 +01:00
55c95f99ad Rename format => io_writer
To make it clearer that this can be used for writing binary data too.
2023-02-10 21:48:31 +01:00
3f6e1f14a9 Implement loading other scripts 2023-01-31 22:07:28 +01:00
607da73c62 Add functions for reading/writing files and introduce native objects 2023-01-29 16:46:00 +01:00
3cc2a83226 Add functions to get information about the call stack 2023-01-28 21:42:40 +01:00
dd580a1519 Improve a bunch of error messages 2023-01-24 21:30:05 +01:00
5e9ac36a39 Get rid of fatal errors and report allocation error directly 2023-01-13 22:54:06 +01:00
e8a92a18b4 Implement functions for concatenating strings 2022-11-20 21:44:00 +01:00
f9878b43d8 Implement comparison operators 2022-11-20 13:47:38 +01:00
f0811ba8fe Implement global "gc" function
To dump the current GC state and do a manual collection
2022-11-19 22:21:32 +01:00
97d79754dd Implement while 2022-11-08 22:03:05 +01:00
0836b8c97c Implement global functions not, len and type 2022-10-31 15:29:01 +01:00
154cc42740 globals: Fix math operations returning argument list on single arg 2022-10-30 23:08:41 +01:00
363334967a Implement tostring and use it in print 2022-10-30 22:51:51 +01:00
fa4ed7bf83 Abstract away stdout
Instead of using stdout directly, we're now using a configurable
apfl_format_writer.
2022-10-30 21:21:40 +01:00
8ca24bcd49 Implement subfunctions and argument matching
A function can now have multiple subfunctions with their own parameter
list. These parameters are now no longer constrained to variables and
blanks only, but can also be consts and list destructurings (predicates
are also already compiled but don't get evaluated yet). The first
subfunction that matches the argument list gets evaluated.
2022-08-13 00:50:26 +02:00
41d0ee6132 bytecode: Add a function to dump bytecode
This also exposes it as a global function and removes the debug statements
in the compiler.
2022-07-28 20:49:29 +02:00
7c63a6b189 globals: Add if, ==, dump and basic math ops 2022-07-12 23:24:19 +02:00
4f9a33628c Implement first global function "print"
This introduces the globals and moves some previously non-public functions
into apfl.h.
2022-07-12 22:13:07 +02:00