Commit Graph

1760 Commits

Author SHA1 Message Date
Christoffer Lerno
9572c4afc9 Top level $if now uses $if: / $endif; Fix of boolean globals. Fix of $else: clause. Fix of $assert inside of $if 2021-06-24 18:01:59 +02:00
Christoffer Lerno
321ee81c9d Complete removal of /+ +/ 2021-06-24 01:29:53 +02:00
Christoffer Lerno
5a6cdd25ef Introduced ${...} syntax for constants. Fixed issue where constants were not correctly handled for macros. /* */ comments are nesting. Added LINE, FUNC, FILE defines. Corrected shallow resolution of subarrays. Added int defines. Removed Vararray. 2021-06-24 00:59:25 +02:00
Christoffer Lerno
dafe0e6fb6 Updated scope code and variable tracking. Added trailing body macros. 2021-06-10 15:06:12 +02:00
Christoffer Lerno
9f545c3f89 Added bigger test for regression. 2021-06-01 10:08:51 +02:00
Christoffer Lerno
95f39f42eb Fix nasty bug where the node copies did not get a proper id. 2021-05-31 21:11:10 +02:00
Christoffer Lerno
dd8b850544 Support for "static" keyword. 2021-05-30 16:30:16 +02:00
Christoffer Lerno
0605a8c500 Introduce "private" keyword and private modules / private import. 2021-05-30 16:30:16 +02:00
Christoffer Lerno
d9566ef894 Generic modules are back, slightly different. 2021-05-30 16:30:16 +02:00
Christoffer Lerno
97ac957cb7 "Public by default" 2021-05-30 16:30:16 +02:00
Christoffer Lerno
892c7e8874 Changed generic modules to internal templates. 2021-05-27 08:30:02 +02:00
Christoffer Lerno
cf82140a47 Adding min/max/elements to enums. 2021-05-23 23:55:10 +02:00
Christoffer Lerno
1f676c135c Removed func and rewrote typedefs. 2021-05-23 13:16:48 +02:00
Christoffer Lerno
fb6d80b0f6 Removed implicitly created modules. Fix classification of arrays in x64. Fix cast with direct-pair. With test cases. 2021-05-19 17:27:59 +02:00
Christoffer Lerno
fc31c15914 Updated cast syntax in code samples. 2021-05-18 17:23:27 +02:00
Christoffer Lerno
216467cbf8 Added alternative cast syntax: (type)(expr) 2021-05-18 14:57:41 +02:00
Christoffer Lerno
460c0d04d7 Generic modules. 2021-05-12 17:25:59 +02:00
Christoffer Lerno
9b86b00834 Compilation is now done with each module compiled together. 2021-05-11 14:58:21 +02:00
Christoffer Lerno
f7919edb35 Split modules into generic and normal modules on the top level. Prepare for static. Change local -> static as keyword. Add private include. Remove old sub module search. 2021-05-09 19:26:05 +02:00
Christoffer Lerno
3bd638bf77 Fixes to debug info in function pointer declarations. Incorrect x64 ABI code for structs by val. Change "Compiler" to "GlobalContext" storage of all types inside. Call debug symbol correct. 2021-05-02 16:42:28 +02:00
Christoffer Lerno
0e076234ca Set stdlib library for testing and profit. Fix bugs when using void* to step. Make constants private linkage. Compare pointers using unsigned comparison without conversion. Use manual ptrdiff code. Fix issue returning "void!". Unify pointers when doing Foo* - void*. Allow comparing for example void* < Foo* 2021-04-29 03:12:25 +02:00
Christoffer Lerno
01f7343945 Parsing of interface. Fix to unpacking arraypointers. Fix accidental unsplat. 2021-04-29 03:12:25 +02:00
Christoffer Lerno
3a74c4adfc Update to python test framework. 2021-04-07 11:14:55 +02:00
Christoffer Lerno
4536d3a270 Fix of missing O3 setting. Added safe/unsafe mode. Updated trapping on negation. Added trap on negative shift & shift exceeding bit width. Added trap on div by zero, rem by zero. Prevent UB on negative shift/shift exceeding bit width. Use ordered FP comparison. 2021-04-07 11:14:55 +02:00
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
1bc4400246 Incorrectly removed %=. Now restored with tests. 2021-03-17 19:39:55 +01: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
mathis2003
8a7f37e4d3 Test for explicit parentheses error 2021-03-15 16:56:44 +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
45c4f205bb More correct alignment. Foreach added. Removed dynamic designated array initialization. Use 16 byte alignment on arrays >= 16 for x64 2021-01-27 00:14:16 +01:00
Christoffer Lerno
26d25e3f74 Recursive references between globals are now correctly handled. 2021-01-27 00:14:16 +01:00
Christoffer Lerno
7fc12192f4 Added "distinct" types. 2021-01-24 21:10:57 +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
4da36dfed9 Optimized and improved aggregate initialization. Compound literal updated to Foo({ 1, 2 })-style. ".name = x" style initialization for named arguments and designated initializers. Added runtime messages on panics. subarrays convert implictly to pointers. len/len() functions. Fix taking slice of pointer. Vararg fixes
Consistent length typedef.

First stab at initializers.

Change compound literal to Foo({ 1, 2 }) style.

Fixed up some tests.

Optimize the zero struct codegen.

Optimize union empty initializer.

Fix issues with unions. Added alignment to globals. Added some union tests.

Use puts to emit error messages during runtime. Fixup of int[] -> int* style conversions.

Fix implicit conversion of int[3]* -> int*

Fix int[] size. Use () to invoke the length of a subarray. Fix taking a slice of a pointer. Limit the number of members in a struct.

Fixes to vararg using debug and cleanups to slices.
2020-12-22 21:55:52 +01:00
Christoffer Lerno
29730345b0 Moving llvm-emit / debug output separately. Started work on C headers. Started work getting packed unions and structs to work correctly. Also added some unfinished PIC code. 2020-11-27 23:43:39 +01:00
Christoffer Lerno
31e9ec3d52 Optimize load of return & some parameter types. Fix issue with non-exapanding coerce. Add support for specific arch_os in tests. 2020-11-24 20:31:18 +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
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
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
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
8586bf3f8d Constants are now variables. Constant compile time constants are typeless and act as #define and are now also correctly parsed. Enums are also correctly lowered. And expressions are copied when inlining constants. Compile time ints can no longer be bitnegated. 2020-07-29 22:08:47 +02:00
Christoffer Lerno
d0ed16e60e Fixes to !! operator + tests. 2020-07-29 12:07:56 +02:00
Christoffer Lerno
7853cb09ac Added check when omitting end index for pointers. 2020-07-28 17:37:48 +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