Commit Graph

58 Commits

Author SHA1 Message Date
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
Andrew Kelley fcedc35551 fix crash with generic function and implicit cast 2016-04-14 10:39:03 -07:00
Andrew Kelley 67152f7294 support simple generic functions 2016-04-06 12:58:54 -07:00
Andrew Kelley f1d338194e rewrite how importing works
* Introduce the concept of packages. Closes #3
 * Add support for error notes.
 * Introduce `@import` and `@c_import` builtin functions and
   remove the `import` and `c_import` top level declarations.
 * Introduce the `use` top level declaration.
 * Add `--check-unused` parameter to perform semantic
   analysis and codegen on all top level declarations, not
   just exported ones and ones referenced by exported ones.
 * Delete the root export node and add `--library` argument.
2016-03-01 03:13:40 -07:00
Andrew Kelley 06398a22d0 back to normal print specifiers
disable warnings for format specifiers on mingw since the
compiler emits bogus warnings
2016-02-16 21:43:38 -07:00
Andrew Kelley bb806f941c use PRIuMAX instead of PRIu64 for mingw 2016-02-16 20:24:51 -07:00
Andrew Kelley 77ffb5075b update bootstrap to work for macos too
* Directives can have arbitrary expressions as parameters
 * Fix switch statement not generating code sometimes
 * Rename "main" fn in bootstrap.zig to "zig_user_main" to
   avoid name collisions
 * codegen: fix badref when unreachable is last thing in an
   expression
 * support #condition directive on exported functions
2016-02-16 16:41:56 -07:00
Andrew Kelley 1d92700d08 fix build with GCC 2016-02-09 08:46:55 -07:00
Andrew Kelley ec33e5a638 simple unconditional defer support
See #110
2016-02-06 01:00:29 -07:00
Andrew Kelley 6a2ede5a6e parsing code for defer and more
* disable goto and label support see #44
 * refactor the way block contexts work
2016-02-05 23:20:34 -07:00
Andrew Kelley 06f6acb4b1 inline is a keyword instead of a directive 2016-02-01 17:25:38 -07:00
Andrew Kelley 179443bd61 add ?? prefix operator 2016-02-01 02:11:46 -07:00