Commit Graph

95 Commits

Author SHA1 Message Date
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
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
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
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
133bf29cdf Added straight-string optimization to regex, converted a bit more of the grammer 2016-05-10 01:23:37 -04:00
Nathan Braswell
4d31ca8b0f Added a partial fix to regex, started improving the krakenGrammer regexes 2016-05-10 00:40:46 -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
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
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
Nathan Braswell
d5b930739f Some fun adding in var var and var ref 2016-04-13 22:46:05 -04:00
Nathan Braswell
11eba1ba07 Port many tests and fix small bugs revealed in Kalypso (passes 24/72) - tests have also revealed more extensive features not yet implemented, and I seem to have messed up a test or two so that the C++ version also fails a couple more (it's at 59/71 now). Will investigate 2016-02-07 16:22:55 -05:00
Nathan Braswell
ca85edaeee added while loops and fixed unary operators (including correct precrement and decrement) 2016-01-19 03:16:16 -05:00
Nathan Braswell
4c569f4f8c Added function calls, printing out of pointers 2016-01-11 23:41:09 -05:00
Nathan Braswell
7f20a42178 Added type to values 2016-01-09 22:37:43 -05:00
Nathan Braswell
21a7afe66d Updated grammer to allow any statement as the child of an if_comp. Much more work incoming, but it will take past midnight, and I want to get what was finished earlier in before then to keep up my streak. 2016-01-03 23:50:07 -05:00
Nathan Braswell
33f97c0c82 work on ast_transformation, fix adt depending on type CGenerator order bug (correctly add poset dependencies) 2015-12-04 03:41:46 -05:00
Nathan Braswell
e7a49bf2e5 Match statements work with ADTs! (still no object stuff or anything though) 2015-11-14 19:05:28 -05:00
Nathan Braswell
fcc0e770a5 Fixed a limitToFunction bug or two, work on ADTs 2015-11-06 03:23:55 -05:00
Nathan Braswell
a84e2ee6e1 faster deserilitation, super basic enums 2015-08-29 21:45:55 -04:00
Nathan Braswell
b198cfb5b2 fix hex number maybe 2015-08-26 03:52:57 -04:00
Nathan Braswell
58ab3e311f Starting to really parse! Fixed the bad syntax trees (reduction copy_construct wasn't actually copying label because param and dest had same name) and fixed the krakenGrammer and CGenerator to allow escaped quotes in regular strings. add_children needs to be finished so the resulting trees don't go nuts with ambiguity, and some situations still cause vector access errors, which is odd. Also added the crazy simple write_file to io and the test_grammer.krak now outputs a syntax_tree.dot 2015-08-11 01:07:16 -04:00
Nathan Braswell
dec9b7d0bd some tests failing because things have been made reference in vector, but grammer actually generates the state set for the real grammer in 2 minutes or so after a day of profiling and bugfixing, so this is gonna be committed. 2015-08-05 03:43:34 -04:00
Nathan Braswell
602810002b reference type added and very basic pass by reference works in CGenerator. Much more work to go to make sure complicated cases work and return by reference 2015-07-14 19:32:54 -04:00
Nathan Braswell
8c490908d4 Saving work pre-references 2015-07-13 12:16:30 -04:00
Nathan Braswell
8e2e356e80 Fixed c_comment regex to handle odd corner cases like /*//hi*/, etc 2015-07-06 02:29:46 -04:00
Nathan Braswell
2c29846570 Swapped pointers to the other side for types to prevent ambiguity, i.e. *int instead of int* 2015-07-04 17:02:51 -04:00
Nathan Braswell
93cb0732cc Added back in float and double suffexes! 2015-06-28 20:50:07 -04:00
Nathan Braswell
ce6c8241fb Bugfixes, range(start,end,step), and beginning work on lexer and symbol 2015-06-28 20:25:27 -04:00
Nathan Braswell
dacfee6d22 Added the []= overloadable operator and implemented it for vector, map, and string 2015-06-27 11:46:31 -04:00
Nathan Braswell
5d688a5822 fix c_comments 2015-06-19 19:36:34 -04:00
Nathan Braswell
616b955bf9 new shorthand syntax for simple_passthrough if assigning to same name simple_passthrough(i=i, j=j : j = j:) becomes simple_passthrough(i,j : j :) 2015-06-19 13:28:02 -04:00
Nathan Braswell
30802fbcf8 Auto inferenced void return! 2015-06-19 11:27:37 -04:00
Nathan Braswell
48f613a38b More work on regex, fixed whitespace around && and operator= for vector 2015-06-14 11:13:30 -04:00
Nathan Braswell
d90cb4b6db Tons of stuff. Regex still a work in progress, along with related template member function scoping bugs 2015-06-09 20:02:02 -04:00
Nathan Braswell
47bc52f00c Some bugfixes, allow overloading of [] and add that to vector and string, work on regex. Need closures before that finishes.... 2015-06-08 21:47:02 -04:00
Nathan Braswell
b71bb84070 Now allow one-line functions without codeblocks\! (espically nice for lambdas) fun a():void println(4), or fun():void println(7) 2015-05-27 12:27:50 -04:00
Nathan Braswell
88bab7f0d7 Woo! Very basic lambdas! 2015-05-25 22:03:24 -04:00
Nathan Braswell
eebffb404e Ok, full functions as values support with types and fixes of earlier bugs. Now typedef the function pointer types when generateing C. 2015-05-22 22:30:25 -04:00
Nathan Braswell
65fd2ed9b7 Changed from typedef to obj and def 2015-05-16 12:05:23 -04:00
Nathan Braswell
aafb52d108 A kinda ugly/hacky addition, but overloading () as operator() works now! 2015-05-16 00:09:50 -04:00
Nathan Braswell
795f8715ff Break, continue, and DEFER statements! Woooo 2015-05-15 15:19:55 -04:00
Nathan Braswell
44d310c092 Got simple type inference for declaration statements working with test 2015-05-10 02:18:59 -04:00
Nathan Braswell
87e1853713 Wooo! Fixed up remaining bugs in new syntax! 2015-05-09 06:24:56 -04:00