Commit Graph

369 Commits

Author SHA1 Message Date
c1e4730f35 Fix for bare enums in multi-assigns 2024-05-15 13:42:45 -04:00
214a8e18aa Rename func 2024-05-15 13:40:27 -04:00
8809435867 Bugfix for assignment not properly promoting (and checking) values, plus
adding support for unqualified enums in assignment
2024-05-15 13:39:35 -04:00
af0c285d96 Allow specifying function arg enums without qualifiers 2024-05-15 13:24:43 -04:00
ae9cb9e7e3 Allow returning enums without qualifiers 2024-05-15 13:19:00 -04:00
1924f75647 Support corecursive structs 2024-05-14 13:30:46 -04:00
8bafe71f17 Add nested indentation for doctests that recursively invoke other
doctests while evaluating
2024-05-14 00:30:57 -04:00
02fe49a764 Deprecate interfaces (RIP) 2024-05-12 20:13:19 -04:00
934fd8a173 Revert "Deprecate stack macro"
This reverts commit 00ec635718.
2024-05-12 20:12:00 -04:00
00ec635718 Deprecate stack macro 2024-05-12 19:47:34 -04:00
79556883b4 Bugfixes 2024-05-12 19:45:49 -04:00
e171d4a98c Fix up some promotion logic for closures 2024-05-12 19:21:44 -04:00
3c50c182a8 Typecheck method promotion for interfaces 2024-05-12 16:09:24 -04:00
3481042259 Simplify interfaces by requiring all functions are pointer methods 2024-05-12 15:56:24 -04:00
f6f89265b7 Guard against calling interfaces with values 2024-05-12 15:48:52 -04:00
4dbe046866 Add interface fields 2024-05-12 15:18:46 -04:00
d143c72b22 WIP, but functional interfaces 2024-05-12 13:50:06 -04:00
c2daf6a928 Clean up 'when' syntax 2024-05-01 13:53:51 -04:00
2e27b88c1b Improved syntax for optionals 2024-04-30 13:18:47 -04:00
061ec4fd8f Support naked 'use' statements 2024-04-24 13:53:37 -04:00
6308325252 Add constructor/casting for ints and nums 2024-04-23 13:12:49 -04:00
3c64616ac1 Bugfix for doctest assignments that promote 2024-04-23 12:54:56 -04:00
fbb25decf0 Support struct literals as constants 2024-04-23 12:50:30 -04:00
3590bf3407 Better imports for types 2024-04-21 14:58:33 -04:00
3f10460a6e Support loading imports as top-level statements 2024-04-21 11:22:11 -04:00
b7881a480f Bugfix for enum num types 2024-04-20 15:18:20 -04:00
a4ffdb1798 Fix no-argument main funcs 2024-04-20 15:00:31 -04:00
ff3e1c1328 Move arg parsing to inline logic in main() function 2024-04-20 14:55:27 -04:00
3b0dce04a0 Add heapify(), heap_push(), and heap_pop() 2024-04-19 13:29:04 -04:00
85a7f9e1c1 Fix arg parsing 2024-04-17 13:52:07 -04:00
e98f6854f5 Use leading underscore for file-local variables and functions instead of
"private" keyword
2024-04-17 13:44:01 -04:00
35339e2aa0 Fix globals issue 2024-04-16 14:02:39 -04:00
f290edbad9 Fix globals 2024-04-16 13:56:11 -04:00
369c601a56 Invert escaping so user symbols get prepended with "$" and builtin
symbols don't
2024-04-16 13:50:07 -04:00
c8e2f0faad Rudimentary stack traces 2024-04-13 15:20:42 -04:00
fab547ebc8 Fix issue with empty command line args 2024-04-13 15:03:37 -04:00
48d272c3fa Support Text arrays as main function arguments 2024-04-12 13:43:23 -04:00
6c01eef851 Introducing the main() function 2024-04-12 13:09:31 -04:00
4f514378ac Fix corecursive functions and global variables 2024-04-10 11:49:43 -04:00
6eb680f1b7 Add array:sample(n, weights) 2024-04-02 23:40:18 -04:00
fae2b2caa0 Add array:sample() 2024-04-02 23:28:59 -04:00
95100469b6 Add array:sorted() 2024-04-02 13:13:33 -04:00
c73e96ff91 Add comparison operator <> and array method to sort by a custom
comparison function
2024-04-02 13:08:06 -04:00
04d9adc813 Switch naming convention to use '$' in symbols more 2024-03-29 12:54:31 -04:00
d94053ca77 Add array:reversed() 2024-03-26 14:59:52 -04:00
135e23094c Improve codegen for table/array iteration by inlining the iteration
macros
2024-03-26 14:02:48 -04:00
5157988efa Implement 'extern' functionality 2024-03-24 15:06:59 -04:00
a29d2ed6d1 Improve COW/etc handling for update assignments 2024-03-24 14:28:20 -04:00
20d75db79a Fix/improve assignment to arrays and tables 2024-03-22 13:53:23 -04:00
f21fc700bb Handle type namespaces in other modules 2024-03-22 01:52:00 -04:00
4592e95fa9 Pull namespaces from the type binding 2024-03-21 13:33:10 -04:00
f142b4ae53 Fix issue with quoted string cords 2024-03-21 13:32:52 -04:00
a47bd2d569 Improvements to module imports 2024-03-19 23:29:32 -04:00
80ea0f8507 Corecursive modules 2024-03-19 14:30:40 -04:00
71f4da18f2 Prevent mulitple imports 2024-03-19 14:23:48 -04:00
adbb07fdc2 Module imports 2024-03-19 14:22:03 -04:00
7b444cd824 Insert semicolons where they should go 2024-03-18 18:06:20 -04:00
43ce0f4c1b Fix array:clear() 2024-03-18 18:03:41 -04:00
df2e01c15e Add some better file comments 2024-03-18 12:47:07 -04:00
0f70411cbf Fix doctests with functions 2024-03-17 22:08:05 -04:00
03b223ac51 Fix switch statement 2024-03-17 21:47:40 -04:00
655b677895 Preface symbols with file prefix 2024-03-17 20:40:40 -04:00
46ee3fc0ef Temporary fix for newlines between statements 2024-03-17 15:59:06 -04:00
a0faef7102 Support nested comprehensions 2024-03-17 15:26:25 -04:00
9932841530 Improve comprehensions for both arrays and tables 2024-03-17 14:46:36 -04:00
46decc9232 Skip/stop for 'while' loops 2024-03-15 13:45:25 -04:00
bc92bb72c8 Simplify loop code 2024-03-15 13:38:25 -04:00
5cdaf3e3fa Fancy skip/stop implementation 2024-03-15 13:35:30 -04:00
9454c5fa0d Properly compile conditionals with abort types in them 2024-03-15 13:07:41 -04:00
6f70286a4b Clean up codegen to not use macros 2024-03-14 13:50:24 -04:00
80ffb8044a Better codegen for negation 2024-03-14 13:47:40 -04:00
ecf425fb9a Rearrange expression/statement compilation code 2024-03-14 13:28:30 -04:00
d5d3f564bb Remove some shadowed variables 2024-03-14 02:48:07 -04:00
8847eaa660 Bugfix for looping 2024-03-14 02:44:37 -04:00
fdc3eadba2 Array comprehensions 2024-03-14 02:37:56 -04:00
130ddc8ea0 Improve codegen for assignment doctests 2024-03-10 01:42:21 -05:00
a90f8581c3 Clean up doctesting for assignments 2024-03-10 00:59:42 -05:00
a33f730617 Rearranging some files 2024-03-10 00:03:21 -05:00
fcd1381e3d Minor cleanups to get compilation working on clang 2024-03-09 23:21:44 -05:00
cbdd357b41 Deprecate secret langs (just use one-member structs) 2024-03-09 19:02:13 -05:00
5131fdff62 Improve handling of secret text 2024-03-09 18:47:56 -05:00
77c9669d41 Change lang stringification to include type name 2024-03-09 18:32:36 -05:00
2b83ab279d Add langs to the language 2024-03-09 18:22:12 -05:00
69162964e0 Implement function caching 2024-03-09 16:44:02 -05:00
b04a1b3090 Implement lambdas and closures 2024-03-09 16:03:38 -05:00
42da91936e Simplify reduction code a little bit 2024-03-09 14:54:36 -05:00
1627a913a4 Lambda fixes/improvements 2024-03-09 14:09:18 -05:00
955f047e06 First pass at lambdas/closures 2024-03-09 14:02:19 -05:00
b33aa8c11f Back to using ARRAY_FOREACH 2024-03-09 02:53:20 -05:00
18ef4c5b3f Table methods 2024-03-09 02:48:09 -05:00
8427037bb9 Refactor table methods to take table structs where possible 2024-03-08 14:33:54 -05:00
55eacb8a04 Array methods 2024-03-08 14:25:17 -05:00
07c2b0ec26 Array methods 2024-03-08 14:23:16 -05:00
fa66053e13 Use '$' for min/max variable 2024-03-07 12:15:38 -05:00
9479b3937c Just use mathlib symbols, don't redefine them 2024-03-07 00:44:57 -05:00
425466ce6e Add 'if x := var' conditionals for optional pointers 2024-03-06 13:36:36 -05:00
93b8e0ae17 Support more variants of looping over integers 2024-03-06 12:56:30 -05:00
03f8742eb7 Fix namespace initializers 2024-03-06 12:41:18 -05:00
211af05381 Fix up some array literal stuff with TCC 2024-03-06 02:27:01 -05:00
4968d45f5a Fix array iteration by inlining 2024-03-06 02:15:23 -05:00
38d5245a9a Fix up some min/max stuff 2024-03-05 14:46:01 -05:00
e29aa52460 Struct and enum methods and static members 2024-03-04 13:51:47 -05:00
0b7ca098ae Fix some bugs relating to NUL termination of strings 2024-03-04 01:34:12 -05:00
dc04286e3a Unicode normalization for equality, hashing, tests, and printing 2024-03-03 19:12:53 -05:00
23478e7036 Rename as_str -> as_text 2024-03-03 18:16:33 -05:00
8fab88c56f Rename Str -> Text 2024-03-03 18:15:45 -05:00
0fe255a7c1 Fix up unicode escapes 2024-03-03 17:49:40 -05:00
9512eb74d2 Bugfix 2024-03-03 17:30:23 -05:00
2eafa7a4da Fix issue with unnamed args getting name flag 2024-03-03 17:21:55 -05:00
32f27b6206 Fix table literals 2024-03-03 16:08:38 -05:00
5486cdcedb Only put 'pragma once' in compiled header file 2024-03-03 15:22:22 -05:00
b8640a2c30 Bugfix for module name parsing 2024-03-03 15:18:15 -05:00
2a7cfd7c36 Fix table literal issue for TCC compatibility 2024-03-03 15:14:59 -05:00
ea7fcd85b4 Make load method be "use$name" 2024-03-03 15:04:36 -05:00
09b1d07d8b Clean up transpiling into separate .c/.h files 2024-03-03 14:45:36 -05:00
fce79cf578 Wrap "&x" in parens to avoid ambiguity 2024-03-03 14:34:13 -05:00
c72d4ec8eb Make constructors actually functions for enums 2024-03-03 14:12:40 -05:00
bf5a725345 Definitively go with "Int" and "Num" over "Int64" and "Num64", plus add
Int__bits()
2024-03-03 13:37:05 -05:00
ec7a9e5f10 Initial pass at namespacing 2024-03-03 13:04:50 -05:00
4dc70c84d4 First working method calls 2024-02-29 13:49:24 -05:00
8171a38b71 Add type namespaces 2024-02-29 13:28:39 -05:00
ab17cf7539 Flip COW bit when dereferencing pointers 2024-02-29 13:00:28 -05:00
0f34bd8f53 Bump refcounts for .keys/.values 2024-02-29 12:54:29 -05:00
291a0ed40c Simplify/clean up table iteration code 2024-02-29 12:45:10 -05:00
ec75208980 Fix up some import issues and improve arrays to use saturating refcounts
instead of .copy_on_write
2024-02-29 12:37:09 -05:00
805c26e65a Pass typeinfos 2024-02-27 13:43:38 -05:00
ce0e1c25e2 Stop using namespace types 2024-02-27 13:39:12 -05:00
1e6df09900 Fix up some type namespace issues 2024-02-26 23:10:19 -05:00
115c75692b Better error checking 2024-02-26 23:02:09 -05:00
32e3aba554 Remove comment 2024-02-25 16:32:45 -05:00
741617a17e Add for-else block 2024-02-25 16:02:36 -05:00
70f7f15781 Implement reductions 2024-02-25 15:28:46 -05:00
d06c63c70c Table field access for .keys, .values, .default, .fallback 2024-02-25 14:35:25 -05:00
7c889a4d0a Properly check mutability of lvalues 2024-02-25 13:13:36 -05:00
f7d403c358 WIP on stackrefs 2024-02-25 13:04:35 -05:00
394f720fb0 Make stack references work with local vars 2024-02-25 12:24:38 -05:00
7704a95a0b Implement obj[] 2024-02-25 12:20:25 -05:00
c2228bf986 Rename 'nextlang'->'tomo' 2024-02-24 16:06:49 -05:00
dbad340c29 Bugfix table compilation 2024-02-24 15:39:33 -05:00
106704b956 Improve enums with metamethods 2024-02-24 15:24:44 -05:00
c9cd667450 Fix some string literal stuff and table default stuff 2024-02-24 14:36:08 -05:00
50fedc8f44 Fixing up structs 2024-02-24 14:29:40 -05:00
a4c3faa525 Split struct code into a separate file 2024-02-24 13:27:49 -05:00
8bee541c76 Support ++= item 2024-02-23 13:47:06 -05:00
87bc0cfdbd Fix up some ++ stuff for arrays 2024-02-23 13:29:20 -05:00
9f56266ae4 Implement Array__concat and ++= 2024-02-23 13:24:06 -05:00
9aec32149f Code cleanup for KeywordArg 2024-02-23 12:50:01 -05:00
197da905f5 Add TODO 2024-02-22 23:14:23 -05:00
9e2645ade7 Fix up keyword args and default args 2024-02-22 22:15:09 -05:00
54b8b7af12 Fix function compiling 2024-02-22 13:35:28 -05:00
58b3b84bd9 Fix up some update operators 2024-02-22 13:26:43 -05:00
f9df7afb8d Fix comparisons 2024-02-22 13:18:47 -05:00
bfdb2da9e1 Implement power (^) 2024-02-22 13:09:46 -05:00
663182abdf Implement concatenation 2024-02-22 13:00:27 -05:00
2ecd8e11fd Implement 'when' statement for matching on enums 2024-02-22 12:45:12 -05:00
f9cc44f145 Fixing up enums 2024-02-20 13:06:03 -05:00
69d41fa068 Add source information to runtime errors 2024-02-18 14:53:52 -05:00
095970170c Implement indexing 2024-02-18 14:28:35 -05:00
88261bcbbd Fix single-thing iteration 2024-02-18 04:27:52 -05:00
5ce55a6a29 Better table literals 2024-02-18 04:26:26 -05:00
30c34a7243 Use known types instead of $var macro 2024-02-18 02:42:40 -05:00
bd0a618f4c Type compiling stuff 2024-02-18 02:34:39 -05:00
6d54150755 Split module code into header/c file 2024-02-18 02:22:31 -05:00
0d3022b34a Move file compilation into a separate file 2024-02-18 02:17:44 -05:00
1b5a95c30d Trim codegen 2024-02-18 02:12:44 -05:00
eabff011ea Add in '#' operator for length 2024-02-18 01:27:25 -05:00
733ebfd234 Fix up some Str stuff 2024-02-18 01:03:23 -05:00
221be79e88 Add enum as_string() 2024-02-18 01:00:47 -05:00
d502f5e552 Clean up struc stringifying 2024-02-18 00:49:23 -05:00
24a703199b Compile tables 2024-02-18 00:12:23 -05:00
fbf39cd7e9 Various fixes, including for Null values 2024-02-17 23:43:55 -05:00
86f3a80544 Split out parts into appropriate headers 2024-02-17 23:27:02 -05:00
9564118202 Fix some more alignment issues and partial rename of Type_type 2024-02-17 22:09:44 -05:00
8f451d0271 Custom tostring functions working 2024-02-17 21:04:35 -05:00
26723deea2 Incremental fixes 2024-02-17 20:47:43 -05:00
6fcc7840d1 Clean up more binops 2024-02-17 20:25:31 -05:00
7cbd200624 Clean up some binops to use generic ops 2024-02-17 20:21:01 -05:00
b34c5c5774 Fix up doctests 2024-02-17 20:07:04 -05:00
dd2de31666 Fix up USE_COLOR 2024-02-17 19:52:37 -05:00
d46925dbfa Cleanup of builtins 2024-02-17 19:32:30 -05:00
7355b2f7fe Change things up to use type params for all array and table methods 2024-02-17 18:38:29 -05:00
dbd7502a1d Fix up some builtins 2024-02-17 17:29:56 -05:00
5c49314ed4 Add typechecking logic 2024-02-17 17:00:21 -05:00
de3eeacfa0 Major cleanup 2024-02-17 16:56:19 -05:00
5d2d54ae0e Tweak cord formatting 2024-02-17 14:47:14 -05:00
f156f915f4 Moving builtin strings over to cords 2024-02-16 13:29:02 -05:00
317b8f5319 Progress towards environments 2024-02-15 13:43:46 -05:00
0577469f9c Bit flags for enums too 2024-02-14 23:45:37 -05:00
f2307aee53 Make bools more compact 2024-02-14 23:44:39 -05:00
2d9afed93a Use dollar identifiers 2024-02-14 13:28:28 -05:00
1af5ab6d4e Add #line directives for source code mapping 2024-02-14 00:19:16 -05:00
b71624abff Fix floating point literals to be exactly precise 2024-02-13 23:37:24 -05:00
1f2b288b32 Slightly more concise generated code for ints 2024-02-13 23:12:20 -05:00
187cbc7610 Whitespace and ordering tweaks 2024-02-13 22:56:10 -05:00
85bd567d3c Add kwargs as a macro hack 2024-02-13 22:13:54 -05:00
853b8e505e Add secret structs 2024-02-13 20:27:19 -05:00
2e8f8b348a Change compilation ordering by splitting into chunks 2024-02-13 14:42:33 -05:00
5de71394a3 Doctests for assignment 2024-02-13 13:32:08 -05:00
45d646be10 Improvements to cording 2024-02-13 13:15:28 -05:00
cf70dac0be Fix multi-assignment 2024-02-13 13:08:00 -05:00