Commit Graph

139 Commits

Author SHA1 Message Date
Nathan Braswell
e851d0eac5 Add basis for types in k, and move to new poset setup (depend on individual imports, functions, types, and global variables) 2018-06-22 20:58:47 -04:00
Nathan Braswell
405ee70db8 Change ADTs to generate a copy_construct() that returns this, which should be our new default. Fix storing functions in vectors (lots of bugs here, with funciton types in templates, sizeof, returned by ref, etc. might have missed a few more, put in some warning comments 2018-06-12 23:29:39 -04:00
Nathan Braswell
d85f388792 Shorter AST names 2018-05-22 20:14:15 -04:00
Nathan Braswell
eefa752d55 shortening of str and vec 2018-05-22 19:43:54 -04:00
Nathan Braswell
b8213dfc9f Fix character value handling. String stuff appears to work correctly in bytecode now 2018-03-22 00:51:57 -04:00
Nathan Braswell
8edfd88c28 Fix this handling, other bytecode fixes 2018-03-21 00:00:06 -04:00
Nathan Braswell
91768a042e Fix/refactor value handling: value strings are now parsed in ast_transformation and re-escaped in c_generator, and used raw in bytecode_generator 2018-03-19 21:03:06 -04:00
Nathan Braswell
cb720e5cd6 working on moving rest of obj stuff into obj_lower 2017-11-03 00:39:58 -04:00
Nathan Braswell
5b8ef4ce2e some cleanup 2017-10-29 17:53:30 -04:00
Nathan Braswell
13f1e9df89 More clean up; need to add return type checking pass so that can clean up c_generator more. 2017-10-23 01:08:25 -04:00
Nathan Braswell
18c53eb9be MOve it forwards a bit 2017-06-13 01:29:56 -04:00
Nathan Braswell
a0c040da36 more lowering 2017-04-08 16:10:57 -04:00
Nathan Braswell
8a676a1b5b More work. Doesn't compile at this point 2017-02-23 01:24:22 -05:00
Nathan Braswell
cb8124afc0 baby steps 2017-02-17 01:22:27 -05:00
Nathan Braswell
dad0f780bb Groundwork for closure lowering, run raw function pointer type 2017-01-26 23:58:48 -05:00
Nathan Braswell
caba8b310f Small speed improvement int trim by using stack (and DFS) instead of queue (and BFS) for remove and collapse, finally fix the unknown escape '\*' error 2017-01-25 01:47:05 -05:00
Nathan Braswell
987e6eb9a5 Cleaning up to bring into main. Speed problem seems to have dissapeard, but we have fixes and the ^ operator in here 2017-01-24 22:11:33 -05:00
Nathan Braswell
3a7f73b711 sigh 2017-01-23 01:09:31 -05:00
Nathan Braswell
e2639989c9 ref_lower now generates C, though a ton of syntax errors 2017-01-20 01:11:06 -05:00
Nathan Braswell
b0d2a6918d Regex rewrite for big speed gain, some extras (--no-c-compile), -O2 is default now 2016-08-02 01:33:16 -07:00
Nathan Braswell
fb63eee9e8 Commit pre enabling CTCE pass (which is quite slow, but does work). Had to add walking through cast nodes for finding variables to close over. Also had to remove the static in front of functions to prevent gcc compiling it so that it segfaults (doesn't segfault if compiled with clang, but wanted to make sure.) 2016-07-09 15:08:57 -07:00
Nathan Braswell
ddd250e7f3 Fixed baking the right integer types into values from #ctce, added the rest of the integer type literals (10ul, etc), fixed/added struct padding/alignment in interpreter 2016-07-09 00:45:40 -07:00
Nathan Braswell
0f2ac1421a Basic CTCE working! In between commit because #link(a) syntax changed to #link(a) 2016-07-03 22:50:42 -07:00
Nathan Braswell
6fee942756 Refactored interpreter into just functions, added a REPL to the main kraken. 2016-07-03 15:32:45 -07:00
Nathan Braswell
4195da6492 Added union and ref = ptr workaround to interpreter (fixing adt matching), allowing test_union and test_adt to pass. 2016-06-28 01:35:54 -07:00
Nathan Braswell
dd8fbc0489 moved munging while and for into obj_lower 2016-06-25 16:02:53 -07:00
Nathan Braswell
26e7ee249a Now using adt_lower, which also makes the backing deconstruct a reference, which makes sense 2016-06-20 01:52:28 -07:00
Nathan Braswell
4a33a94b15 Fixed, working unions. Had to move the is_union member to the end. I'm not sure if this is a C bug or an effect of me doing something weird somewhere 2016-06-16 23:06:38 -07:00
Nathan Braswell
3f89cb1e37 partial rollback, might still not work 2016-06-16 09:53:15 -07:00
Nathan Braswell
4de7dd1210 Added support for unions as a step towards lowering ADTs in the next pass to be written. 2016-06-15 22:26:03 -07:00
Nathan Braswell
27fea0e90c work on multithread, interpreter, and prototyped a #line-in-simple-passthrough ast changing pass turned on with -g 2016-06-14 02:14:25 -07:00
Nathan Braswell
2c8c3af48a Some speed improvements 2016-06-11 00:45:18 -07:00
Nathan Braswell
008cc01c70 Lambdas and function values starting to work - using the parameters or return value crashes 2016-06-01 23:28:32 -07:00
Nathan Braswell
ce2eff42a6 Moved over compiler information printing and error to use stderr, enabled interpreter testing in tester. The interpreter passes 34/74 tests 2016-05-22 14:10:19 -07:00
Nathan Braswell
12dfa837e3 Added in extern global variables and printing of *char and string to stderr with printlnerr, printerr. Note that this will still compile in a previous version, but instead of extern, stderr will be newly declared. This is ok, because this version of the compiler never uses it, so we'll only use it after this one is bootstrapped in. 2016-05-22 13:08:10 -07:00
Nathan Braswell
828f36daab Adding in proper copy_construct into function calls and destruct afterwards. Doesn't correctly destruct return values yet. 2016-05-21 11:20:29 -07:00
Nathan Braswell
cf8090f825 Moved c stdlib variadic functions over to use ... 2016-05-19 23:34:29 -07:00
Nathan Braswell
cfcaff7887 Add support for variadic extern functions, as it turns out that you can't just specialize them with declarations. I.e., int a_func(int, ...) is different from int a_func(int, int) even if you only ever call a_func(1,2), etc. This commit is in preperation for moving to correcty variadic extern functions for the c stdlib (like printf, snprintf) 2016-05-19 23:17:32 -07:00
Nathan Braswell
5183a02c64 Implemented variables as well as ++, -- 2016-05-13 15:14:19 -04:00
Nathan Braswell
e63b7cf770 Enough interpreter to do math on constant integers 2016-05-13 03:10:36 -04:00
Nathan Braswell
947384cced Started work on interpreter, commit to fix issues it will depend on 2016-05-12 02:03:20 -04:00
Nathan Braswell
9d7a65294f Optimizations, regex character ranges 2016-05-05 04:51:10 -04:00
Nathan Braswell
02c77899b8 Add #link(lib) intrinsic, used in SquidPong 2016-04-30 16:52:56 -04:00
Nathan Braswell
7aa1d9983b Some bugfixes/added errors, convert most to not use simple_passthrough 2016-04-30 15:38:28 -04:00
Nathan Braswell
d126cbf24b Added short/long and unsigned types for all int based types 2016-04-29 16:19:23 -04:00
Nathan Braswell
ecbbcb4eda C extern implemented 2016-04-29 01:14:26 -04:00
Nathan Braswell
2051f54b55 Added in sizeof intrinsic + piping for more in the future. Inbetween commit before removing sizeof function 2016-04-28 18:47:53 -04:00
Nathan Braswell
2cd43e5a21 most of hash map - have to commit fix for unify type first 2016-04-20 16:09:26 -04:00
Nathan Braswell
8d0996fb47 Added in bitwise operators 2016-04-19 18:39:01 -04:00
Nathan Braswell
cf46fb13af Add casting as a language feature. Have not removed the function yet as we need an inbetween version for the bootstrap 2016-04-18 22:56:29 -04:00