Commit Graph

336 Commits

Author SHA1 Message Date
Dummi26
794e776e25 changed enum type syntax because A: int/string is ambiguous while A(int)/string and A(int/string) aren't. Builtins now use the Err enum variant for errors. 2023-04-01 16:27:52 +02:00
Dummi26
b1a90d5872 implemented enum functionality. todo: default functions should use Ok/Err enum variants? 2023-04-01 14:38:46 +02:00
Dummi26
260e42d4a7 changed while loop break to use matching (any matching value breaks) and added the same break functionality to for loops. 2023-03-30 19:11:21 +02:00
Dummi26
52973eb0f8 changed remove and pop to return [] or [v] instead of [] or v to remove the ambiguity when successfully returning v with v = []. This also makes .assume1() work with these functions. 2023-03-30 18:46:45 +02:00
Dummi26
2ba1ed270d changed get to return [] or [v] instead of [] or v because v might be []. This also matches the 0-or-1-length-tuple patterns for optionals (so it can be unwrap()d using .assume1()). 2023-03-30 18:38:05 +02:00
Dummi26
45186e3803 parser bugfix, started working on external libraries (libraries can register functions and react to function calls via stdout/stdin) 2023-03-24 14:57:42 +01:00
Dummi26
296163d5fe added examples 2023-03-22 19:37:21 +01:00
Dummi26
2c12556af9 fixed compiler errors 2023-03-22 19:23:18 +01:00
Dummi26
744f268bfd added some string methods and assume1, which takes ([]/[t]) or ([]/[t] string) and returns t. If the first argument passed is [] instead of [t], panics with the custom error message, if one was provided (string argument). 2023-03-22 19:20:02 +01:00
Dummi26
2a00d01812 fixed a bug with while loops running unreachable!() code instead of looping on [] values. 2023-03-17 17:05:19 +01:00
Dummi26
021a247369 update readme 2023-03-17 16:56:55 +01:00
Dummi26
fff0b868ce added files and fixed a bug in run() and thread() 2023-03-17 16:54:27 +01:00
Dummi26
04b9cbc4c7 fixed readme issue 2023-03-17 16:33:23 +01:00
Dummi26
6712097829 added match statements. 2023-03-17 16:29:42 +01:00
Dummi26
664de5c347 cleaned up script/value.rs by splitting it up into val_data and val_type. 2023-03-17 14:23:54 +01:00
Dummi26
a43a23da8c - added type-checking for builtins. Except for the List-functions, all builtins should now be properly type-checked.
- changed List.insert(..) from (list, index, element) to (list, element, index) to be more in line with List.push(list, element)
2023-03-16 15:33:43 +01:00
Dummi26
585017da46 improved and fixed some bugs with the switch! unhandled type error and some builtins 2023-03-14 20:58:35 +01:00
Dummi26
1b43dfebda fixed bug where the last item in a list would break the parser if it wasn't followed by a whitespace, ), or }. (added ] to the list of statement-breaking chars) 2023-03-14 20:21:36 +01:00
Dummi26
862418ce98 almost functional type checking for builtins; builtins return types work
as expected now (for List.get, Thread.await() etc)
2023-03-14 20:14:30 +01:00
Mark
5ca0373640
(2) 2023-03-14 12:42:39 +01:00
Mark
5d868a759d
basis for type-checked builtins (1) 2023-03-14 12:40:15 +01:00
Mark
3ac886115a
. 2023-03-14 09:21:48 +01:00
Mark
f43f5e518c
script file has to be provided as the first arg 2023-03-14 09:19:58 +01:00
Dummi26
d0cf7ab588 added the concept of references: prefix any (single) type or variable with & to get a reference. This is used for List.{push, insert, pop, remove, get} to avoid copying the list unnecessarily. 2023-03-13 23:05:27 +01:00
Dummi26
a4fbb8dd97 - fixed a bug with t.fits_in(rhs) regarding inner types
- added //...\n and /*...*/ comment syntax
- added tuple.n indexing, where n is an int <= the tuples length (this is checked before the script runs)
2023-03-12 15:42:19 +01:00
Dummi26
15b78dc0b6 removed leftover debug prints 2023-03-12 13:27:50 +01:00
Dummi26
fea095a8d6 fixed a bug with inner types, like [int/string], always being parsed as single types, even though this isn't necessary. 2023-03-12 13:26:51 +01:00
Dummi26
05ecc809c3 - fixed a bug with switch syntax closing brace being recognized twice by the parser
- writing to a variable when the type that is being written doesn't fit will shadow the variable to prevent weird issues where a variable would be changed to a different type from within a block, then after that block it would still have data of that type but its type wouldn't reflect this, causing switch! to miss some cases. might remove shadowing in the future, who knows.
- added run_command_get_bytes
2023-03-12 13:14:18 +01:00
Dummi26
369b37371c adjusted list syntax to be [<content> ...] to create a visual difference from tuples, which don't have the ... before the ]. 2023-03-12 12:43:21 +01:00
Dummi26
ff1f487a6f updated output format, added script/builtins.rs 2023-03-12 12:35:45 +01:00
Dummi26
6da8a77304 fixed some bugs 2023-03-10 13:44:18 +01:00
Dummi26
efff8c1d70 . 2023-03-09 18:51:58 +01:00
Dummi26
f2d176e0dd added another example to the readme, showing switch statements 2023-03-09 13:26:54 +01:00
Dummi26
63721b9e26 initial code commit, implemented switch statements and if-else syntax. 2023-03-09 13:24:52 +01:00
Dummi26
bb2f4b541c initial code commit. variables, functions, basic multithreading works. missing a lot of builtins and possibly operators (+-*/). good proof of concept for now. 2023-03-08 22:19:51 +01:00
Mark
e8a02a8b30
Create README.md 2023-03-07 16:10:48 +01:00