Commit Graph

931 Commits

Author SHA1 Message Date
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
Erik Svedäng
6ad3a1e2ac Can call normal functions too. 2018-06-18 14:10:35 +02:00
Erik Svedäng
28d2e2de42 Handle arg. 2018-06-18 14:01:41 +02:00
Erik Svedäng
cd3002d815 Better. 2018-06-18 12:23:42 +02:00
Erik Svedäng
9002b7b806 New version. 2018-06-18 12:20:20 +02:00
Erik Svedäng
ea3abf0bae Bugfix. 2018-06-18 12:10:28 +02:00
Erik Svedäng
8a65fbecfa Better. 2018-06-18 12:09:25 +02:00
Erik Svedäng
8636a38c4a Examples of closures in C. 2018-06-18 12:04:47 +02:00
hellerve
c82916612a core: document string, remove string-join 2018-06-15 16:38:34 +02:00
Erik Svedäng
3161dff51f Playing around with examples. 2018-06-15 15:24:11 +02:00
Erik Svedäng
be02c82314 Existing modules are not destroyed when defining a type. Fixes
"(reload)" bug with self-recursive lookup of interface, see Tuples.carp
2018-06-15 11:53:33 +02:00
Erik Svedäng
ef4fc521de Prep for solving the reload bug. 2018-06-15 11:15:20 +02:00
Erik Svedäng
275947dc35 BUGFIX: Can't define '=' in terms of '=' on generic members of type, see Pair.= 2018-06-13 12:29:54 +02:00
Erik Svedäng
bcd4e6d298 Test for resolving correctly. 2018-06-13 11:59:13 +02:00
Erik Svedäng
3bcd2fe2eb Expression problem example. 2018-06-13 08:14:26 +02:00
Erik Svedäng
0b90452f66 Todo done. 2018-06-12 16:14:46 +02:00
Erik Svedäng
84b39f8b24 Bug is fixed? 2018-06-12 16:08:46 +02:00
Erik Svedäng
b1248ac376 BUGFIX: Prevent infinite loop in constraint solver. 2018-06-12 10:57:59 +02:00
Erik Svedäng
e80a41f2ce Test fixes. 2018-06-12 09:01:20 +02:00
Erik Svedäng
2935105172 More examples for map. 2018-06-12 08:43:51 +02:00
Erik Svedäng
d980f3c0e9 {} syntax expands to Map.from-array 2018-06-12 08:36:58 +02:00
Erik Svedäng
a5a9a186eb A test to ensure we don't introduce the same bug again. 2018-06-11 15:44:58 +02:00
Erik Svedäng
669aca2b96 Added dynamic function 'Project.no-echo' to disable echoing in examples. 2018-06-05 10:05:33 +02:00
Erik Svedäng
6fb5a48d48 Relaxed the requirement on 'main' so it allows generic types. 2018-06-04 15:17:14 +02:00
Erik Svedäng
1079075637 Various tweaks. 2018-06-01 16:40:14 +02:00
Erik Svedäng
b438edf09c BUGFIX: Parser now must consume whole input. 2018-06-01 10:24:46 +02:00
Erik Svedäng
718ed39d55 Example. 2018-06-01 09:42:02 +02:00
Erik Svedäng
b11e42887f Experimenting with 'private'. 2018-05-31 17:34:03 +02:00
Erik Svedäng
e0da601f36 Signature annotations are honored and a mismatch will lead to compiler error. 2018-05-31 14:37:57 +02:00
Erik Svedäng
bad64703ae Prep. 2018-05-31 13:09:34 +02:00
Erik Svedäng
d5ea81506b BUGFIX: def needs to come before hidden, or the compiler chokes 2018-05-31 12:05:55 +02:00
Erik Svedäng
d1fa3eb9d5 One more todo. 2018-05-31 10:02:56 +02:00
Chris Hall
7c1dd210d7 Renaming: String.count -> String.length, Array.count -> Array.length
Issue #236
2018-05-23 10:03:42 +10:00
Erik Svedäng
c93621b5de
Merge pull request #241 from hellerve/random
Add random module
2018-05-22 20:01:28 +02:00
hellerve
032249b342 core: add random module (referencing #227) 2018-05-22 19:34:38 +02:00
Erik Svedäng
707614e999
Merge pull request #232 from mkfifo/string-library-improvements
String library improvements
2018-05-22 19:10:22 +02:00
Erik Svedäng
0455d2d274 Note. 2018-05-22 14:01:20 +02:00
Chris Hall
b46b2a39e8 String.append is now by reference, StringCopy.append is by copy/linear
Adding memory leak tests to String.append and StringCopy.append

Issue #94
2018-05-20 14:16:10 +10:00
Chris Hall
f11969231a Removing (build), (run), (quit) from examples/updating.carp 2018-05-20 12:05:58 +10:00
Chris Hall
c42471ec7a Removing use of random from example/updating.carp to help issue #227 2018-05-20 12:05:58 +10:00
Chris Hall
24ae95bc65 Removing two buggy tests from example/basics.carp which were causing issue #227 2018-05-20 12:05:58 +10:00
Erik Svedäng
d25e1619ab Updated render-text-to-texture to allow setting the color of the text. 2018-04-24 15:02:06 +02:00
hellerve
414451f2fa tests: add test script recording 2018-04-10 12:34:36 +02:00
Erik Svedäng
6bbb0c8190 Can hide bindings with (hidden ...) 2018-03-27 14:32:47 +02:00
Erik Svedäng
891b34f0d1 Sidebar. 2018-03-27 10:51:16 +02:00
Erik Svedäng
ef1549250f More work on docs. 2018-03-27 09:43:39 +02:00
Erik Svedäng
32eaae7a5c Pretty nice looking docs. 2018-03-27 09:05:58 +02:00
Erik Svedäng
62df5ebfc8 Tweaked temp code. 2018-03-26 16:55:54 +02:00
Erik Svedäng
95b74e4179 Can set and preserve meta before def/defn/defmacro/defdynamic. 2018-03-26 16:51:43 +02:00
Erik Svedäng
c3ab3a43e3 Can set meta on non-existing binders (enables docstrings etc before
the definition).
2018-03-26 16:20:09 +02:00
Erik Svedäng
79bf4115a8 Resolution of symbols seems reasonable in meta set/get. 2018-03-26 16:02:17 +02:00
Erik Svedäng
92454c4f94 More keycodes. 2018-03-26 14:09:43 +02:00
Erik Svedäng
83cf727133 Moved keycodes into submodule. 2018-03-26 13:52:34 +02:00
Erik Svedäng
0cd8b4d3ac draw-texture-centered 2018-03-26 11:54:20 +02:00
Erik Svedäng
c91de4b87f Updated ant.carp so it doesn't crash when reaching the border. 2018-03-26 11:22:18 +02:00
Erik Svedäng
4f3882af78 Solving the qualification bug... 2018-03-26 09:29:29 +02:00
Erik Svedäng
8a7e662de7 Fixed typo in example. 2018-03-26 08:50:32 +02:00
Erik Svedäng
eda06f3bc1 Reproduced error in bugs.carp 2018-03-26 08:47:46 +02:00
Erik Svedäng
9e49684ad6 Change of maths. 2018-03-26 07:35:07 +02:00
Erik Svedäng
3d3b34f70f Bugfixes and cleanup of minimal example. 2018-03-24 16:28:35 +01:00
Erik Svedäng
a94338dfb0 indentation 2018-03-24 11:22:24 +01:00
Erik Svedäng
97e11d9303 Use nicer event handling in game.carp also. 2018-03-24 11:19:49 +01:00
Erik Svedäng
07878fc4a9 Nicer event handling with the help of 'foreach' macro and 'SDL.Event.all' function. 2018-03-24 11:17:56 +01:00
Erik Svedäng
45882daafa Replaced example in README.md 2018-03-24 10:34:49 +01:00
Erik Svedäng
c48b59e648 Show how to use mouse in game example. 2018-03-24 10:29:22 +01:00
Erik Svedäng
7fae010bb7 MP3 works! 2018-03-23 21:42:24 +01:00
Erik Svedäng
6fd6de0983 Have to use SDL_mixer v. 2.0.0, NOT 2.0.2. And the library 'mpg123'
needs to be installed before building SDL_mixer (v 1.25.10 works well).
2018-03-23 21:37:07 +01:00
Erik Svedäng
3889dff434 Still trying to figure out music playback... 2018-03-23 16:01:30 +01:00
Erik Svedäng
2253b890fa Can play sound effect but music is not working yet. 2018-03-23 15:13:17 +01:00
Erik Svedäng
e2aa4792a4 Starting wrapping SDL_mixer. 2018-03-23 09:55:32 +01:00
Erik Svedäng
24a1d98493 Remove debug text. 2018-03-23 07:28:51 +01:00
Erik Svedäng
f5f48c1b28 Disable address sanitizer. Also - font program doesn't seem to leak memory. 2018-03-22 21:24:15 +01:00
Erik Svedäng
a87753e3f4 Address sanitizer does not complain. 2018-03-22 21:21:46 +01:00
Erik Svedäng
1c8d554737 Fixed fonts.carp example. 2018-03-22 15:43:43 +01:00
Erik Svedäng
e037a481cd Some helper functions to make code much cleaner. 2018-03-22 14:17:26 +01:00
Erik Svedäng
482170ccd7 Nicer rendering of font. 2018-03-22 13:36:16 +01:00
Erik Svedäng
99132e3926 Basic support for font rendering (more to come). 2018-03-22 13:25:30 +01:00
Erik Svedäng
fb830c81d7 Refactoring of SDL complete? 2018-03-20 16:48:56 +01:00
Erik Svedäng
415600eb87 Better support for choosing if you want to use callbacks or not. 2018-03-20 16:38:50 +01:00
Erik Svedäng
e18cba50c6 Submodule for mouse state in SDL. 2018-03-20 16:15:26 +01:00
Erik Svedäng
f2742fe032 Moved event-related things into a submodule. 2018-03-20 16:05:52 +01:00
Erik Svedäng
10c1b62767 All tests run again, can build "game", "ant" and "reptile". 2018-03-20 14:34:49 +01:00
Erik Svedäng
eb7595b159 Game example works with kebab case. 2018-03-20 12:49:46 +01:00
Erik Svedäng
3965eaa73d Game example works with new SDLApp helper. 2018-03-20 12:26:27 +01:00
Erik Svedäng
7d9fd49e58 The SDLApp helper works fine now. 2018-03-20 12:17:48 +01:00
Erik Svedäng
39e16e9239 Started working on helper struct for SDL. 2018-03-20 11:53:24 +01:00
Erik Svedäng
0ef73eacfa Merge branch 'master' into sdl-refactor 2018-03-20 10:59:35 +01:00
Erik Svedäng
ca2ef7e16f Fixed some bugs regarding machine readable error reporting. 2018-03-19 21:54:05 +01:00
Erik Svedäng
b19aa7a9fb Machine readable error reporting for macro expand. 2018-03-19 11:26:07 +01:00
Erik Svedäng
3eba8a6d5a Machine readable error reporting for 'members' command. 2018-03-19 11:23:53 +01:00
Erik Svedäng
062cda1b7c Machine readable error reporting of non-matchin interface signatures. 2018-03-19 11:21:06 +01:00
Erik Svedäng
33996d0100 Removed some unused cases of ReplCommand type. Parse errors can be
reported in a machine readable way.
2018-03-19 11:03:40 +01:00
Erik Svedäng
0f6574193f Proper SDL module added, examples updated to work with it. 2018-03-15 21:14:18 +01:00
Erik Svedäng
b729181066 Handle more cases in 'templitizeTy'. 2018-03-15 14:02:44 +01:00
Erik Svedäng
2ec44059f3 Found the bug - did not handle Arr case in 'replaceGenericTypeSymbols'. 2018-03-15 13:59:21 +01:00
Erik Svedäng
d36f28c782 Everything works with function members except someting in 'str' for generic function members. 2018-03-15 13:34:48 +01:00
Erik Svedäng
18e3fcfd0b 'copy', 'prn' and 'str' for function pointers work. 2018-03-15 12:52:09 +01:00
Erik Svedäng
37b82bd884 Simple example with function as member works. 2018-03-15 09:32:26 +01:00
Erik Svedäng
fbb70c0c09 Merge branch 'master' into functions-as-members 2018-03-15 08:57:43 +01:00
Erik Svedäng
337039776e Set the project title for some of the examples. 2018-03-14 20:48:23 +01:00
Erik Svedäng
9d36c9e220 Fixed: 'assert' macro. Also -- reporting of errors in expanded macros now works. 2018-03-13 13:10:15 +01:00