Andrew Kelley
c0b37e8514
add try expression
...
See #83
2017-02-02 17:09:27 -05:00
Andrew Kelley
b78c91951a
remove ability to mark if and switch as inline
...
if and switch are implicitly inline if the condition/target
expression is known at compile time.
instead of:
```
inline if (condition) ...
inline switch (target) ...
```
one can use:
```
if (comptime condition) ...
switch (comptime target) ...
```
2017-02-02 13:23:18 -05:00
Andrew Kelley
32d8686da8
various fixes
...
* comptime expression is a block expression as it should be
* fix var args when number of args passed is 0
* implement const value equality for structs
* fix indent when rendering container decl AST
* IR: prevent duplicate generation of code when it is partially
compile-time evaluated
* implement compile time struct field pointer evaluation
* fix compile time evaluation of slicing
2017-01-23 23:30:20 -05:00
Andrew Kelley
17cb85dfb8
basic support for functions with variable length arguments
...
See #77
2017-01-23 16:40:17 -05:00
Andrew Kelley
201a3c121a
introduce comptime expression
...
closes #221
2017-01-22 22:59:52 -05:00
Andrew Kelley
6a5e61acd1
get rid of zeroes literal
...
closes #222
2017-01-16 17:24:13 -05:00
Andrew Kelley
d784705353
IR: implement macro for function aliasing function pointer
2017-01-12 03:15:06 -05:00
Andrew Kelley
76b1cbc2ea
pass some parseh tests
2017-01-11 22:25:17 -05:00
Andrew Kelley
25a670d74e
pass more tests
2017-01-11 19:09:17 -05:00
Andrew Kelley
430e33b869
partially fix parseh command
2017-01-10 15:39:52 -05:00
Andrew Kelley
4816121e00
remove duplicate definition of container_string
2016-12-18 17:53:12 -05:00
Andrew Kelley
e50ced44a2
IR: all structs anonymous
2016-12-18 16:56:50 -05:00
Andrew Kelley
12fcbecbf8
IR: add more instructions
...
* MaybeWrap
* TestErr
* UnwrapErrCode
* UnwrapErrPayload
* ErrUnionTypeChild
* ErrWrapCode
* ErrWrapPayload
2016-12-17 16:16:17 -05:00
Andrew Kelley
647d13168a
IR: implement maybe return expression
2016-12-13 19:36:56 -05:00
Andrew Kelley
ef63bc9cca
IR: implement memcpy, memset, and slice expression
2016-12-12 00:31:35 -05:00
Andrew Kelley
2dd85d52cc
IR: fix implementation of parseh
...
libc hello world works now
2016-12-11 00:13:43 -05:00
Andrew Kelley
6ed202ab16
IR: implement defer
2016-12-06 21:26:17 -05:00
Andrew Kelley
24048b2af6
IR: implement break and continue
2016-12-05 18:43:16 -05:00
Andrew Kelley
0541532ed6
IR: implement generic function calls
2016-12-05 05:12:44 -05:00
Andrew Kelley
9f23475b17
add missing copyright notices
2016-12-04 21:06:13 -05:00
Andrew Kelley
2f259b8176
IR: re-organize where state goes to prepare for generics
...
* Rip out legacy code for generics
* put scope in instruction instead of AST nodes
* separate top level decl stuff from AST nodes
- remove the assumption that there is a 1:1 correspondence
between an output instruction and an AST node
- This way we won't have to clone AST nodes for generics.
2016-12-04 03:40:40 -05:00
Andrew Kelley
a52ede6494
IR: support goto and labels
2016-11-26 23:16:38 -05:00
Andrew Kelley
84f7805029
IR: support import builtin function
2016-11-26 20:52:22 -05:00
Andrew Kelley
bbf785bc1d
IR: switch expression works with numbers
2016-11-26 00:25:48 -05:00
Andrew Kelley
0c22358cc1
IR: generating a switch statement
2016-11-24 02:44:03 -05:00
Andrew Kelley
71d95c6597
IR: support unwrap maybe operation
2016-11-21 03:08:24 -05:00
Andrew Kelley
2f8dd46174
IR: error for uncasted null lit variable
2016-11-19 01:53:14 -05:00
Andrew Kelley
8a81f8aa13
IR: implement compileVar builtin and more
...
* implicit array to slice cast
* fix if statements at global scope
* implement array type IR
2016-11-19 01:39:51 -05:00
Andrew Kelley
19037014e5
IR: more maybe type support
2016-11-18 23:52:42 -05:00
Andrew Kelley
bf7cde62c5
IR: support setDebugSafety builtin function
2016-11-18 20:57:27 -05:00
Andrew Kelley
c3b603fdf9
remove AST cloning code and add AST render for while loops
2016-11-17 21:17:58 -05:00
Andrew Kelley
2edc6c1a3f
IR: add assembly instruction
2016-11-13 21:07:30 -05:00
Andrew Kelley
e2fd3b2b1b
IR: fix prefix op eval setting wrong type
2016-11-13 13:42:04 -05:00
Andrew Kelley
d4f2394dcf
IR handles global variables correctly
2016-11-13 01:56:28 -05:00
Andrew Kelley
a2e3293930
WIP moving all analysis to IR
2016-11-04 15:36:30 -04:00
Andrew Kelley
b581da41f8
remove compiler directives
...
* add `setFnTest`, `setFnVisible`, `setFnStaticEval`,
`setFnNoInline` builtin functions to replace previous
directive functionality
* add `coldcc` and `nakedcc` as keywords which can be used as part
of a function prototype.
* `setDebugSafety` builtin can be used to set debug safety features
at a per block scope level.
* closes #169
2016-09-28 02:33:32 -04:00
Andrew Kelley
183976b242
add this keyword refers to thing in immediate scope
...
See #169
2016-09-26 23:47:30 -04:00
Andrew Kelley
3239b3cb69
use size_t for indexes
...
protect against incorrect copies in debug mode
2016-09-19 11:54:01 -04:00
Andrew Kelley
d324b1befa
ability to infer parameter types
2016-09-08 00:24:48 -04:00
Andrew Kelley
2ed949a6ae
add zeroes value
2016-08-08 20:43:38 -07:00
Andrew Kelley
d0b11af2bd
new multiline string syntax
...
This patch also moves a bunch of the parser code into the tokenizer.
Closes #162 .
2016-08-04 22:52:38 -07:00
Andrew Kelley
8552d7fd19
explicit wrapping integer operations
...
instead of wrapping integer types
closes #159
2016-07-27 23:08:27 -07:00
Andrew Kelley
78d4fb20c4
inline parameters
...
This replaces the current generic syntax for functions and replaces
it with the concept of inline parameters.
This paves the way for the "all structs anonymous" proposal.
Closes #151 .
2016-07-25 22:55:15 -07:00
Andrew Kelley
425c0ffa01
rename NodeTypeStructDecl to NodeTypeContainerDecl
2016-07-17 16:30:41 -07:00
Andrew Kelley
a5251a1c10
parseh: support octal in C macro string literal
2016-07-09 12:17:31 -07:00
Andrew Kelley
8c79438f6b
better array concatenation semantics
...
closes #87
2016-05-07 10:05:59 -07:00
Andrew Kelley
d908afe105
add array multiplication operator
2016-04-28 18:03:44 -07:00
Andrew Kelley
46ab981787
add skeleton for union support
2016-04-24 11:24:04 -07:00
Andrew Kelley
66163692ad
parseh: support anonymous enums and enums with initializers
2016-04-22 21:43:48 -07:00
Andrew Kelley
8187396f64
add syntax to allow symbols to have arbitrary strings as names
2016-04-22 15:24:18 -07:00