Commit Graph

184 Commits

Author SHA1 Message Date
Christoffer Lerno
4210f1ccb2 Some work on vararray. Fix span on post unary. Updated error recovery. Updated return analysis to handle void functions. "while" now disallows error prone next line statement. Working on auto linking. Failable load optimized. Optimization and corrections for call returns + documentation. 2021-04-05 23:34:40 +02:00
Christoffer Lerno
07595df412 Change cast and int rules: constant folding always starts. Promotion using left side on all operands to bit width. Implicit narrowing to max size on right hand side. 2021-03-17 18:25:00 +01:00
Christoffer Lerno
1d50beb330 Work on constant string and inferred array sizes. 2021-02-03 23:01:37 +01:00
Christoffer Lerno
4f064e7da2 Initial checkin of docs parsing. char is now unsigned, and signed char is "ichar". 2021-01-29 18:46:17 +01:00
Christoffer Lerno
26d25e3f74 Recursive references between globals are now correctly handled. 2021-01-27 00:14:16 +01:00
Christoffer Lerno
3a24fbfa6d Moved examples around. Updated (and corrected) const initialization. Removed "in" keyword. Added "member" attribute domain. Many fixes in struct padding and alignment and tests. Fixed extern global. 2021-01-24 00:55:09 +01:00
Christoffer Lerno
564c93700e Fixed bug that would intermittently arise from multiple contexts having the same pointer (should preferably be fixed in a different way later). Free all the arenas before codegen. Change "next" to "nextcase". Allow missing function parameters. Add "inline" structs. 2021-01-03 00:15:51 +01:00
Christoffer Lerno
6a5a0f2b94 Moved ABI lowering from codegen to semantic analysis. Fixes for failables in the ABI and the codegen. 2020-12-04 19:19:57 +01:00
Christoffer Lerno
3c15e495dd Add macro arguments &foo $foo #foo.
C ABI compatibility aarch64, win64, x86, x64
Added debug info
2020-11-22 22:16:19 +01:00
Christoffer Lerno
4222f2731e &&temp operator. Macro evaluation. 2020-10-16 18:11:30 +02:00
Christoffer Lerno
77ccfc1f7c Added CT_SWITCH parsing in top level. Nil changed to null. Parsing more in line with grammar. Parse type as expressions. Zero init by default for locals. Corrected bool/fp conversion. Add memcpy pass to fix issue with value load/stores. 2020-09-21 11:38:12 +02:00
Christoffer Lerno
fb937156fe Work on debug + fix of failable bug. 2020-09-02 10:18:30 +02:00
Christoffer Lerno
9709cb61a4 Struct constants stored in globals. 2020-08-09 19:01:46 +02:00
Christoffer Lerno
d070a5e7ff Allow "if (...) else if (...)". Disallow 'if (...) doSomething()' unless the "doSomething" is in the same line. 2020-08-03 17:33:07 +02:00
Christoffer Lerno
b45c866071 Adding $switch and rearranging parser somewhat. Removing the need for "store" of context. 2020-08-02 13:53:17 +02:00
Christoffer Lerno
31d2c15dba Adding $unreachable 2020-08-02 00:06:43 +02:00
Christoffer Lerno
009ccfd730 Adding assert. 2020-08-01 20:53:47 +02:00
Christoffer Lerno
21357c4fc1 Fix crash when having return value errors. Updated docs. Find and load builtin.c3 locate std lib. 2020-07-31 16:29:52 +02:00
Christoffer Lerno
380c1c8ab4 Support for $assert. Also change order of checking global declarations from parsing to semantic analysis. 2020-07-30 17:44:41 +02:00
Christoffer Lerno
ce68bda86c Corrected ptr->bool conversion. Avoid checking function body if function is invalid. Switch defer test cases. Slices with test cases. 2020-07-28 17:37:48 +02:00
Christoffer Lerno
90ab4f07b9 Corrected ptr->bool conversion. Avoid checking function body if function is invalid. Switch defer test cases. 2020-07-28 17:37:48 +02:00
Christoffer Lerno
c839eb50c8 Simplified defer and now also allow nested defers. 2020-07-27 11:40:45 +02:00
Christoffer Lerno
a533cbb1a7 Fixes to tester for multiple file support. 2020-07-27 11:40:45 +02:00
Christoffer Lerno
34c7df9ee1 Fixed multi line error reporting for tokens. Handle infinite empty for loops. Changed cast syntax to "cast(foo as Foo)". Completed enum casts. Added more tests. 2020-07-25 21:54:32 +02:00
Christoffer Lerno
f45d6ef84b Fix, separate out the function pass from the decl pass. Diagnose non-visible symbols as not visible rather than missing. Fix crash when module identifier is incorrect. !! operator added. New character literal parsing. Added simple test framework. 2020-07-21 23:43:28 +02:00
Christoffer Lerno
b4c661eaad Pre lexing and mmap allocation together with exact exits. 2020-07-15 15:42:54 +02:00
Christoffer Lerno
dc86c21210 New failable based error handling. Labelled break/continue/next. 2020-07-09 13:07:08 +02:00
Christoffer Lerno
a6a4136685 Updated examples and grammar for big error change. 2020-06-17 18:19:00 +02:00
Christoffer Lerno
50c36789bf Fixes bug handling chained && ||. Work towards more macro functionality. Correctly emit stdcall. Corrected character parsing in escaped string entries. 2020-06-11 15:45:58 +02:00
Christoffer Lerno
f96ab76195 Type parsing and expr parsing unified. 2020-06-02 00:41:35 +02:00
Christoffer Lerno
3bdfe3e05e Refactored structs. 2020-06-01 21:00:21 +02:00
Christoffer Lerno
c9ab05bfec Prepare for struct refactoring. 2020-05-30 20:58:09 +02:00
Christoffer Lerno
1b69423f45 Method functions now work. 2020-05-27 12:26:38 +02:00
Christoffer Lerno
28f307d467 Fixed correct calculation for warning on unused throw. 2020-05-27 10:23:03 +02:00
Christoffer Lerno
2b97241908 Nicer print of errors when using typedef. Error cast of pointers should not have error when optionally implicit. Improved func pointer printout. 2020-05-20 16:51:44 +02:00
Christoffer Lerno
b2bfd87a06 Started work on ranges. Added weak/noreturn/inline/cname/stdcall/section/alignment attributes. Some work on subarrays. Fixes to throws. Function pointers work. 2020-05-20 14:22:22 +02:00
Christoffer Lerno
dbce72146f More AST dumps fixed. Throw simplified by removing "DECL_THROW", which also unearthed a bug. 2020-05-07 11:46:16 +02:00
Christoffer Lerno
f62a094f75 Simple globals now work correctly, but structs don't. 2020-05-05 16:57:11 +02:00
Christoffer Lerno
93bd0fb337 Jumping on else added. 2020-05-05 11:28:49 +02:00
Christoffer Lerno
d23c271289 Throw/catch works correctly with defer. 2020-05-03 16:45:16 +02:00
Christoffer Lerno
373001fd12 Error -> errset (temporarily). Catch / throw now works, but it will not yet correctly handle defer. 2020-05-03 02:04:13 +02:00
Christoffer Lerno
78aa49cc0e Work on getting typeof up and running. Try-else now works. 2020-04-22 20:19:55 +02:00
Christoffer Lerno
df0433d746 Fix fallthrough case handling. 2020-04-18 23:55:53 +02:00
Christoffer Lerno
982a9e7b58 Minor cleanup 2020-04-18 22:23:42 +02:00
Christoffer Lerno
6da6b0f571 Compound literal works properly. 2020-04-18 14:29:17 +02:00
Christoffer Lerno
6117a1be7c Lots of fixes and optimizations to structs. Now there are no unnecessary intermediary types. 2020-04-18 14:29:17 +02:00
Christoffer Lerno
ff31bd17c0 Improved error messages for initializers. Array initializers work. 2020-04-18 14:29:17 +02:00
Christoffer Lerno
1d73338fb0 Order of function resolution is different. Function prototypes resolved first. Same with LLVM gen. Designated initializer and anonymous fields fixed mostly. 2020-04-12 21:35:25 +02:00
Christoffer Lerno
9bf89574f9 Updated TODO 2020-04-12 21:35:25 +02:00
Christoffer Lerno
f5dd5bf203 Support named parameters, default parameters and varargs. 2020-04-09 16:48:38 +02:00