Commit Graph

931 Commits

Author SHA1 Message Date
Erik Svedäng
e4dceb2405 More functional event handler in SDLApp. 2019-09-13 12:09:11 +02:00
hellerve
a2c859c586 all: remove local-include in favor of relative-include 2019-09-09 17:56:43 +02:00
Erik Svedäng
6d961860f4 Code example 2019-07-04 08:14:44 +02:00
hellerve
8b78fe453a core: optionally check malloc 2019-06-17 09:17:20 +02:00
Erik Svedäng
3b424293bf Disallow lambdas to mutate captured variables. 2019-06-13 16:10:15 +02:00
Erik Svedäng
99aa2f6d79 The bug. 2019-06-13 15:27:39 +02:00
Erik Svedäng
abf56fb1af Fix bug in issue #323 2019-06-13 14:07:49 +02:00
Erik Svedäng
f2bd1f3127 Solve infinite loop when evaluating (<undefined symbol> <module name>) 2019-06-13 13:09:33 +02:00
hellerve
e9fcf87ff5 core: remove stringcopy.append 2019-05-27 18:05:44 +02:00
Erik Svedäng
dbef5a0d51 Temp. 2019-05-23 15:36:37 +02:00
Erik Svedäng
491a88cb67 Temp code. 2019-03-26 14:42:04 +01:00
Erik Svedäng
32f14cd9e3 Work in progress... 2019-03-26 10:23:27 +01:00
Erik Svedäng
5ad6e94579 The '(load)' command will work relative to the file containing it, if
put into a file.
2019-03-22 20:33:06 +01:00
Erik Svedäng
c65f82a972 Better error message when loading file. 2019-03-22 11:15:07 +01:00
Erik Svedäng
2113cda53d Respect --check flag for EvalErrors inside Expand module too. 2019-03-22 11:07:21 +01:00
Erik Svedäng
dedeb6a38d Respect --check flag when reporting Eval errors. 2019-03-22 11:00:23 +01:00
Erik Svedäng
cb680c90e0 Validation of members in sumtype. 2019-03-22 08:59:22 +01:00
Erik Svedäng
07ea1b2d2f Renamed example/map.carp because it got loaded by core.carp when
running inside examples directory.
2019-03-21 14:31:19 +01:00
Erik Svedäng
19abe6ac75 Support for 'defdynamic' - dynamic global variables. 2019-03-15 08:47:55 +01:00
Erik Svedäng
87de6fbb76 Even more fixes 2019-03-05 16:37:27 +01:00
Erik Svedäng
6a685f4bf4 Merge branch 'master' of https://github.com/carp-lang/Carp 2019-03-05 15:03:58 +01:00
Erik Svedäng
275c7d845a More windows tweaks. 2019-03-05 15:03:18 +01:00
Erik Svedäng
194ab6a639 BUGFIX: Can set! globals that live inside modules now. 2019-03-02 22:09:44 +01:00
Erik Svedäng
c5680b3e1f Found a critical bug with setting global variables inside modules. 2019-03-02 21:37:26 +01:00
Erik Svedäng
14df37cc55 Merge branch 'master' of https://github.com/carp-lang/Carp 2019-02-28 14:53:29 +01:00
Randy Valis
b13231e451 Fixed issue 365: Invalid C generated with arrays of functions 2019-02-26 21:45:14 -05:00
Erik Svedäng
0e1228b58b Right now recursive types are implicitly forbidden, working on it... 2019-02-21 16:40:40 +01:00
Erik Svedäng
dc1bf6e6d2 Work on more complicated sumtypes. 2019-02-21 14:54:40 +01:00
Erik Svedäng
475b7389ea Validation for sumtype cases. 2019-02-20 15:25:00 +01:00
hellerve
e24fd38258 sumtypes: multiple fixes
- add test suite for Result
- make Array a little safer overall
- document Maybe and Result comprehensively
- rework Array documentation
2019-02-15 10:24:47 +01:00
Erik Svedäng
7a0ae9de7f More bugfixes concerning wildcards. 2019-02-12 23:01:33 +01:00
Erik Svedäng
90375fd0ff Use _ in example. Some cleanup. 2019-02-12 22:25:11 +01:00
Erik Svedäng
4d61162b68 ...and now it compiles 2019-02-12 22:16:10 +01:00
Erik Svedäng
9cd7ccc38a Wildcard improvements, pt 1. 2019-02-12 19:43:22 +01:00
Erik Svedäng
8d45cfb7ec Kinda support for wildcards, but a lot of the code is a mess
unfortunately. Will fix after sleeping...
2019-02-12 00:20:20 +01:00
Erik Svedäng
acc4b16dc7 Equal for Maybe example. 2019-02-11 19:16:34 +01:00
Erik Svedäng
d5fed5e4f9 More example. 2019-02-11 16:28:42 +01:00
Erik Svedäng
c2c0c19575 Big refactor of the sumtype system, using "normal" symbol resolution. 2019-02-11 16:22:44 +01:00
Erik Svedäng
d845601d05 Next challenge: figure out which sumtype based on matchers. 2019-02-11 10:25:47 +01:00
Erik Svedäng
9aecc93c81 Can define simple sumtype cases in an easier way. 2019-02-08 16:31:19 +01:00
Erik Svedäng
1b846621cd Allow more convenient syntax in left part of match. 2019-02-08 16:10:49 +01:00
Erik Svedäng
2dacb54256 In progress. 2019-02-05 11:52:42 +01:00
Erik Svedäng
82fe859aed A little bit of convenience. 2019-02-05 11:37:44 +01:00
Erik Svedäng
8c80c9d004 Merge branch 'master' into sumtypes 2019-02-02 20:08:45 +01:00
hellerve
f31474cecb all: (see #317)
- add copy-filter
- rename filter to endo-filter
2019-02-02 10:32:26 +01:00
Erik Svedäng
2ab79b396a Two tests for errors. 2019-02-01 16:12:55 +01:00
Erik Svedäng
30450b78dd Comment. 2019-02-01 15:04:23 +01:00
Erik Svedäng
fd67f83cc0 Bug fixed. 2019-02-01 15:02:10 +01:00
Erik Svedäng
e230909625 Bug with name shadowing identified. 2019-02-01 14:19:41 +01:00
Erik Svedäng
da8fb684c9 Some memory tests, etc. 2019-02-01 14:07:10 +01:00
Erik Svedäng
3e3643c914 Looks like it might work now. 2019-02-01 12:21:16 +01:00
Erik Svedäng
fe15dc7f65 Progress? 2019-01-31 20:05:41 +01:00
Erik Svedäng
337c85d853 Time to think. 2019-01-30 14:23:35 +01:00
Erik Svedäng
2e06deb62c More tricky situation. 2019-01-29 22:21:33 +01:00
Erik Svedäng
c80d642920 Rudimentary support for memory management in 'match'. 2019-01-29 21:00:39 +01:00
Erik Svedäng
c7982d099a Clarification. 2019-01-29 18:41:39 +01:00
Erik Svedäng
07abcbd9c3 Panic! when falling through match. 2019-01-29 12:50:46 +01:00
Erik Svedäng
2f98c322df Comments. 2019-01-28 22:58:34 +01:00
Erik Svedäng
af6c83ce21 Can compile code using the Maybe type! 2019-01-28 22:53:23 +01:00
Erik Svedäng
85ed0c6132 Moved logic for finding types of variable matches to
'GenerateConstraints' module which solves some issues.
2019-01-28 22:40:35 +01:00
Erik Svedäng
d4c1bb9dc4 Can kind of (in an ugly way) figure out what type the expr of a
match-statement should be.
2019-01-25 23:59:26 +01:00
Erik Svedäng
59f4f43694 Bug with rhs in cases fixed. 2019-01-25 23:27:58 +01:00
Erik Svedäng
249405784f Qualify inside match cases. 2019-01-25 21:32:03 +01:00
Erik Svedäng
8239d00836 Macro expansion in match expressions. 2019-01-25 21:02:59 +01:00
Erik Svedäng
141190a023 Work, work. 2019-01-25 19:46:38 +01:00
Erik Svedäng
f9664dd5f7 Environment is extended with matching variables in each 'case'. 2019-01-25 09:51:24 +01:00
Erik Svedäng
16e7bea6e5 Can figure out the type to set on matching variables (left side). 2019-01-24 23:25:51 +01:00
Erik Svedäng
7bddc09065 Some preparations before getting matching to work properly. 2019-01-24 15:06:55 +01:00
Erik Svedäng
9ed5cbd35d Cleanup of temp. 2019-01-24 12:25:11 +01:00
Erik Svedäng
01a5c2a83b Bugfix with copy for sumtypes. 2019-01-24 11:54:30 +01:00
Erik Svedäng
6aab8d2106 Printing of nested sumtypes work. 2019-01-24 10:55:18 +01:00
Erik Svedäng
54992d35a2 Can calculate correct amount to allocate for 'str' of Sumtypes. 2019-01-24 09:48:36 +01:00
Erik Svedäng
ab9ee1246e A beginning of 'str' and 'prn' for sumtypes. 2019-01-23 20:26:42 +01:00
Erik Svedäng
d51f3b94f2 Tags are assigned correctly in init functions. 2019-01-22 15:15:20 +01:00
Erik Svedäng
d7a1f769ae Merge branch 'master' into sumtypes 2019-01-22 14:43:33 +01:00
hellerve
8b6ab7357e core: refactor the vector module; generic types and use module system 2019-01-21 21:52:45 +01:00
Erik Svedäng
f441cb865d Some examples of that capturing refs to lambdas now work. 2018-12-15 10:00:48 +01:00
Erik Svedäng
2173f8083f Bug test case. 2018-12-15 09:54:29 +01:00
Erik Svedäng
3274b241c8 Bugs. And emit more info to help with the bugs. 2018-12-14 22:59:47 +01:00
Erik Svedäng
1b355a3c88 Lambda fix pt 1. Fixes capturing of two nested lambdas. Still other bugs! 2018-12-07 22:40:33 +01:00
Erik Svedäng
fe075705a6 Can match. 2018-11-15 09:02:58 +01:00
Erik Svedäng
cd96ccbf39 Tests run again. 2018-11-14 21:21:56 +01:00
Erik Svedäng
584e2394ca Can instantiate generic sum type. 2018-11-14 16:19:58 +01:00
Erik Svedäng
8b4df870b1 Merge branch 'lambdas' into sumtypes 2018-11-14 15:02:07 +01:00
Erik Svedäng
1dc8b536fc Deftype generates 'update' functions that expect refs to functions too. 2018-11-14 14:21:12 +01:00
Erik Svedäng
fe55144273 Follow convention of passing lambdas as refs as default. 2018-11-14 14:09:43 +01:00
Erik Svedäng
9f85a2b96c Proof of concept of (~f x y z) syntax. 2018-11-13 22:38:24 +01:00
Erik Svedäng
670d90fa3b Trying out deref... 2018-11-13 21:56:40 +01:00
Erik Svedäng
157fbf4ab2 Gotcha. 2018-11-12 09:19:36 +01:00
Johan Burell
ddd8d120a9 Fixed SDL import capitalization in Life example 2018-11-08 19:36:23 +01:00
hellerve
e887a5633b core: remove put! and remove! from map and set 2018-10-31 13:42:05 +01:00
hellerve
16e2d7fb85 core: add remove! and put! and make reduce take ownership 2018-10-31 11:33:29 +01:00
Erik Svedäng
f4f3af31e3 Scoring works now. 2018-10-30 19:47:36 +01:00
Erik Svedäng
90efca992c Scoring fails, but can generate init methods now. 2018-10-30 19:25:02 +01:00
Erik Svedäng
5d66b828b0 Can emit a struct based on sumtype definition (no unions or tags though). 2018-10-30 14:33:20 +01:00
Erik Svedäng
cbbc9cb9db
Merge pull request #316 from hellerve/fix-gol
Fix game of life example
2018-10-25 15:45:54 +02:00
hellerve
48e42a9aae examples: fix game of life example 2018-10-25 12:45:31 +02:00
Erik Svedäng
abb9da7ffc new bug 2018-10-23 22:41:41 +02:00
hellerve
59f636f051 core: Random.seed with a good default, rename old version to Random.seed-from 2018-10-19 10:31:00 +02:00
Erik Svedäng
cf4f4da084 BUGFIX: Don't emit lambdas where some captured type is not concretized. 2018-09-26 22:15:45 +02:00
Erik Svedäng
a4b250ad2c Bug, see issue #299. 2018-09-25 16:30:48 +02:00
Erik Svedäng
85a2c56598 Make lambdas carry a SymPath instead of a String to their lambda function. 2018-09-25 15:59:55 +02:00
Erik Svedäng
58a51af7fd BUGFIX: Missing case in GenerateConstraints patched. 2018-09-21 23:31:29 +02:00
Erik Svedäng
6f457a3aa3 Interesting memory bug with 'and' (and 'or'?) 2018-09-21 19:59:49 +02:00
Erik Svedäng
2d1a8205d4 reload.carp tests 2018-09-21 18:09:14 +02:00
Erik Svedäng
2aed141ac7 Tests for ensuring that recursion works properly. 2018-09-21 18:02:43 +02:00
Erik Svedäng
6d813837ac Move example functions of functions/lambdas from temp. 2018-09-21 17:47:37 +02:00
Erik Svedäng
021cfd04da One more test for error message. 2018-09-21 15:17:12 +02:00
Erik Svedäng
53dc991129 Enable testing for error messages, using the check.sh functionality. 2018-09-21 14:53:06 +02:00
Erik Svedäng
e15e7b93b0 Can make error reporting when using --check print long or short file paths. 2018-09-21 13:57:39 +02:00
Erik Svedäng
3f94dc3eaa Reproduce issue #288 in bugs.carp 2018-09-18 15:32:16 +02:00
Erik Svedäng
7166a23f58 Three memory tests work for lambdas. 2018-09-11 16:37:46 +02:00
Erik Svedäng
e17222cb1b Environments of lambdas are sent by POINTER to their deleter
function. Very important.
2018-09-11 16:31:25 +02:00
Erik Svedäng
0056588d4f Problem with env-pointer in lambdas. 2018-09-11 15:45:00 +02:00
Erik Svedäng
c6fabf68e3 Bugfix for issue #289, recursive functions didn't work when reloading code. 2018-09-07 14:38:58 +02:00
Erik Svedäng
5f0debd674 Lambda bugfixes, can know if a global variable lookup is a function or
a variable now.
2018-08-31 15:12:14 +02:00
Erik Svedäng
78fe6d3856 More mangling. 2018-08-30 15:13:13 +02:00
Erik Svedäng
b6a51f4a0a Rudimentary analysis of ownership in lambdas. 2018-08-30 09:53:32 +02:00
Erik Svedäng
2854a63fa5 Next up: Make this example compile... 2018-08-29 16:29:56 +02:00
Erik Svedäng
fdd14614dd Remove duplicates when collecting captured vars. 2018-08-29 16:14:04 +02:00
Erik Svedäng
2d38eeba2c Delete and copy functions are set and called. 2018-08-29 15:10:41 +02:00
Erik Svedäng
72c2330bab Added 'copy'-callback on Lambda struct. 2018-08-29 12:13:56 +02:00
Erik Svedäng
78b192bb36 BIG CHANGE: Functions are managed now. 2018-08-29 11:32:33 +02:00
Erik Svedäng
26ea939813 Handle hyphens in function names in regards to lambdas. 2018-08-28 15:03:23 +02:00
Erik Svedäng
f6abc6a3a3 Can capture variables in an environment (leaks though!) 2018-08-28 14:51:20 +02:00
Erik Svedäng
3e8ea4c22b Lookup mode for local variables, Capture / NoCapture 2018-08-28 13:26:51 +02:00
Erik Svedäng
93efaea0ea Lambda environment is set up correctly, just need to know what
variables to capture.
2018-08-28 12:25:22 +02:00
Erik Svedäng
c74dac0616 Can generate an environment struct and set its members when lambda is created. 2018-08-28 11:44:59 +02:00
Erik Svedäng
a69640ca98 Gotta switch computer... 2018-08-28 09:32:45 +02:00
Erik Svedäng
5f4d803831 Simple, non-capturing lambda works. 2018-08-27 14:07:36 +02:00
Erik Svedäng
60ed86e9ad More advanced example. 2018-08-27 11:42:23 +02:00
Erik Svedäng
370ca228e7 Preparing for optimization. 2018-08-27 11:08:01 +02:00
Erik Svedäng
65ade0848f Calling works. 2018-08-24 15:20:05 +02:00
Erik Svedäng
2bf5695324 Need to make arguments to external functions non-lambdas. 2018-08-24 09:13:38 +02:00
Erik Svedäng
278cfdb725 Merge branch 'master' into lambdas 2018-08-24 08:08:38 +02:00
Erik Svedäng
f4977be7b0 Fixed the bug with recursive functions inside modules. 2018-08-17 17:26:12 +02:00
Erik Svedäng
846f5a11e9 Prep for fixing the bug. 2018-08-17 16:46:19 +02:00
Erik Svedäng
5207c255a4
Merge pull request #275 from hellerve/parse-function-macros
Headerparser: Parse function-like macros and multiline macros
2018-08-17 14:59:25 +02:00
Erik Svedäng
b1ee9ac07f Bug example: recursive + generic function fails to qualify. 2018-08-07 17:59:54 +02:00
hellerve
c44e018b73 header parser: add multiline macros 2018-08-07 17:35:00 +02:00
Erik Svedäng
65ef8e18ae Fix. 2018-08-07 11:14:11 +02:00
Erik Svedäng
396d84802a Regression test for resolving interfaces. 2018-08-07 11:12:00 +02:00
hellerve
d95c28ad5d core: fixed set and tests 2018-08-07 09:32:32 +02:00
Chris Hall
8d20bb90df Removing Sort as a module name 2018-06-26 18:03:34 +10:00
Chris Hall
85c625b62d Removing Array.sort and Array.sort-with 2018-06-26 15:48:15 +10:00
Erik Svedäng
29fcfb7885 Trying to get template functions and deftype to play well with lambdas. 2018-06-19 15:51:07 +02:00
Erik Svedäng
1b6c1ba7c9 Can compile hello world again, most examples run. 2018-06-19 11:13:16 +02:00
Erik Svedäng
2275c1bd02 Core compiles again. 2018-06-19 09:19:54 +02:00
Erik Svedäng
1749584a89 Things are not working but at least some progress. 2018-06-18 17:22:20 +02:00
Erik Svedäng
797eea591f Make use of y. 2018-06-18 14:13:04 +02:00