Commit Graph

183 Commits (9b7f438882b4f283d252d8ca364607fae385cc1a)

Author SHA1 Message Date
Andrew Kelley 1fba7f3696 IR: add inline goto 2016-11-26 23:33:07 -05:00
Andrew Kelley 4619b5de06 IR: support inline switch 2016-11-26 15:38:07 -05:00
Andrew Kelley 24b65e41ee IR: add error for non static const on switch case range 2016-11-26 04:37:34 -05:00
Andrew Kelley 0c22358cc1 IR: generating a switch statement 2016-11-24 02:44:03 -05:00
Andrew Kelley 67d565136a IR: implement ctz and clz builtins 2016-11-21 13:27:44 -05:00
Andrew Kelley d94cb0566b IR: correctly codegening memset and memcpy 2016-11-18 22:24:41 -05:00
Andrew Kelley c8333d0cc9 add concept of inline for, inline while, inline var 2016-11-03 14:13:57 -04:00
François Saint-Jacques c2710283b5 capitalize builtins in doc 2016-10-21 22:43:08 -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 077cd4b9a4 langref: correct builtin function names 2016-09-10 20:53:57 -04:00
Andrew Kelley d324b1befa ability to infer parameter types 2016-09-08 00:24:48 -04:00
Andrew Kelley 1f7ec741fa implement `?return` expression 2016-08-29 22:14:09 -07:00
Andrew Kelley ed50bd1b65 progress toward stack trace printing 2016-08-17 20:11:04 -07:00
Andrew Kelley 37d167f6e0 std: conform to style guidelines 2016-08-16 22:42:50 -07:00
Andrew Kelley 0a482bbbfe add style guide 2016-08-11 21:13:02 -07: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 1fa0cabf9d remove multiline comments
closes #161
2016-07-27 23:26:12 -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 bc81ddfea6 unsigned integers for sizes of things
Closes #62.
2016-07-26 20:40:11 -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 da8e30fe46 add some docs about builtin functions 2016-05-18 16:59:55 -07:00
Andrew Kelley f1e5be9686 fix ability to use previous generic params and
add error when `%return` shows up in a function with incorrect
return type
2016-05-09 13:44:29 -07:00
Andrew Kelley 745c325d0f support variable declarations in structs
See #22
2016-05-09 12:34:03 -07:00
Andrew Kelley 2ed72022ce support generic data structures
See #22
2016-05-07 17:00:58 -07:00
Andrew Kelley 094336f07c add integer wrapping
see #46
2016-05-05 17:19:01 -07:00
Andrew Kelley 7f589c0cab support maybe destructuring into a pointer variable 2016-05-03 15:06:34 -07:00
Andrew Kelley 9ccd0ba961 implement string escapes 2016-05-01 14:53:48 -07:00
Andrew Kelley d908afe105 add array multiplication operator 2016-04-28 18:03:44 -07:00
Andrew Kelley 46b0b84b90 ability to specify body of an extern function
closes #101
2016-04-28 16:04:44 -07:00
Josh Wolfe 61e6c49bc5 vim syntax: single-line strings must be contained in a single line 2016-04-26 01:50:21 -07:00
Andrew Kelley 46ab981787 add skeleton for union support 2016-04-24 11:24:04 -07:00
Josh Wolfe 97fae8cc85 fix vim syntax highlighting for multiline strings 2016-04-23 01:32:18 -07:00
Andrew Kelley 6acc354957 for loop: add ability to get pointer to elem var
see #51
2016-04-20 11:58:01 -07:00
Andrew Kelley a25307c0a1 add optional continue expression to while loop
closes #139
2016-04-19 20:28:44 -07:00
Andrew Kelley 67152f7294 support simple generic functions 2016-04-06 12:58:54 -07:00
Andrew Kelley e144ddab24 add multiline string literal
and make multiple lines in normal string literals an error
2016-04-03 18:59:43 -07:00
Andrew Kelley 5df091fea9 c_void is provided outside of C imports 2016-03-01 15:26:41 -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 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 7828456b30 std: delete malloc and free
later we'll add a full featured allocator instead of this
2016-02-12 02:23:22 -07:00
Andrew Kelley b642604691 targets command shows which ones are native 2016-02-10 16:35:07 -07:00
Andrew Kelley 1ff2edf67e add "targets" command to list architectures, oses, abis 2016-02-10 15:41:50 -07:00
Andrew Kelley c4f5a00253 rhs of ?? and %% can be any expression 2016-02-06 19:28:11 -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 4339d55562 update for loop syntax
it matches more closely the %% binary operator syntax

See #51
2016-02-05 17:15:19 -07:00
Andrew Kelley 5490f907fe switch statements resolve peer compatibility 2016-02-04 15:50:06 -07:00
Andrew Kelley 5ad84e4724 unreachable causes a trap in debug mode 2016-02-02 02:43:33 -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
Andrew Kelley 1053172854 parseh handles typedef void better
and introduce c_long_double type
2016-01-31 15:44:02 -07:00
Andrew Kelley 3c2093fec6 parseh understands types better and handles some situations better
See #88

Also, includes partial implementation of typedef top level declaration.
See #95

Also, fix function types. Previously the way we were deduping function type
pointers was incorrect.
2016-01-31 01:20:47 -07:00
Andrew Kelley e4b0435946 parseh understands variable declarations
and some initializers such as integers
2016-01-29 16:06:17 -07:00
Andrew Kelley a5c2de5fee ability to specify function type
closes #14
2016-01-28 20:26:40 -07:00
Andrew Kelley 2bb2e61ee2 parser: allow missing fn name and missing param names
now these problems are caught in analyzer

this is for purpose of function type, see #14
2016-01-28 18:58:28 -07:00
Andrew Kelley f1c5d3d3a1 add parseh tests 2016-01-28 11:54:34 -07:00
Andrew Kelley b6354ddd5a move AST rendering code to separate file 2016-01-27 21:10:38 -07:00
Andrew Kelley 5afe473a86 different extern syntax and simplify parsing top level decls 2016-01-26 13:08:21 -07:00
Andrew Kelley 4e43973413 variable initializations are now mandatory
use `undefined` if you want uninitialized memory
2016-01-25 23:56:46 -07:00
Andrew Kelley a37bb4a4da add the C integer types 2016-01-25 23:21:13 -07:00
Andrew Kelley a3e288ab5b implement compile time string concatenation
See #76
2016-01-25 21:56:29 -07:00
Andrew Kelley 50854226a6 syntax: back to -> for return type, no more => 2016-01-25 17:08:18 -07:00
Andrew Kelley deb3586884 implement %% prefix operator
See #23

also make undefined constants use llvm undef value
2016-01-25 15:45:05 -07:00
Andrew Kelley 6db6609df8 implement %% operator
See #23
2016-01-25 13:53:40 -07:00
Andrew Kelley 5c18826240 introduce the error keyword and type
See #23
2016-01-24 01:34:57 -07:00
Andrew Kelley 37aae53009 various small cleanups 2016-01-23 03:06:29 -07:00
Andrew Kelley 72fa03bada add undefined reserved word 2016-01-22 16:05:29 -07:00
Andrew Kelley 5e212db29c parsing error value decls and error value literals
and return with '?' or '%' prefix
2016-01-20 18:18:50 -07:00
Andrew Kelley 82d1b51b1d doc: remove string keyword from vim syntax highlighting 2016-01-20 03:05:53 -07:00
Andrew Kelley 961adc0909 Merge branch 'master' of github.com:andrewrk/zig 2016-01-20 02:16:36 -07:00
Andrew Kelley ad9759bc8e basic support for switch expression 2016-01-20 02:12:24 -07:00
MovingtoMars 26b9d709aa start working on lang spec 2016-01-20 21:27:53 +13:00
Andrew Kelley c17309dbc5 add switch statement support to parser 2016-01-19 20:29:36 -07:00
Andrew Kelley 17e574fec6 add switch statement to language reference 2016-01-19 19:15:36 -07:00
Andrew Kelley fbbef14013 add for loop which can iterate over arrays
See #51
2016-01-18 07:00:45 -07:00
Andrew Kelley dc162c7f83 rename "use" to "import" 2016-01-15 18:45:52 -07:00
Andrew Kelley 0311b35a21 reduce precedence of {} suffix operator
this makes []u8 {1, 2, 3, 4} work for array literal
2016-01-15 17:40:12 -07:00
Andrew Kelley b0f608a6a7 merge constant expression evaluator with analyzer 2016-01-15 04:45:25 -07:00
Andrew Kelley 1645fa681f parser: type expressions cannot be assignment 2016-01-14 15:21:41 -07:00
Andrew Kelley 5f9ecb8566 instead of 'as' to cast, call type as function 2016-01-14 02:52:33 -07:00
Andrew Kelley b28b7f63d1 all types are now expressions
See #22
2016-01-13 18:15:51 -07:00
Andrew Kelley 733830f8a5 doc: rename match to switch in vim syntax 2016-01-11 03:03:35 -07:00
Andrew Kelley fc748e2ccd update enum parsing to new plan 2016-01-10 16:58:21 -07:00
Andrew Kelley d4b8852d78 parsing enum declarations 2016-01-10 11:48:54 -07:00
Andrew Kelley 0c24ed8a81 rename `restrict` to `noalias` 2016-01-08 23:48:24 -07:00
Andrew Kelley b7dd88ad68 suport checked arithmetic operations via intrinsics
closes #32
2016-01-08 23:41:40 -07:00
Andrew Kelley 14b9cbd43c add restrict qualifier on pointer arguments 2016-01-08 20:59:47 -07:00
Andrew Kelley 9aea99a999 implement array slicing syntax
closes #52
2016-01-07 05:29:11 -07:00
Andrew Kelley a3c97081ca add ?? maybe unwrapping binary operator
add null literal
fix number literal / maybe interactions
2016-01-07 03:23:38 -07:00
Andrew Kelley 5e64c4d92f support pub structs. move rand to std lib.
guess number example prints the answer now
2016-01-06 04:41:11 -07:00
Andrew Kelley 3c43bc9208 support unknown size arrays 2016-01-06 01:28:58 -07:00
Andrew Kelley 4ef062b9c8 array syntax is [10]i32 instead of [i32; 10] 2016-01-05 22:47:47 -07:00
Andrew Kelley e0aa0736be add pointer dereferencing operator 2016-01-04 19:11:36 -07:00
Andrew Kelley 4514661cfe add member functions 2016-01-04 16:57:22 -07:00
Andrew Kelley e64c0941f9 implement #sizeof()
closes #8
2016-01-03 19:38:36 -07:00
Andrew Kelley fa6e3eec46 add #typeof() compiler function 2016-01-03 18:17:50 -07:00
Andrew Kelley 968b85ad77 closer to guess number example working 2016-01-02 03:38:45 -07:00
Andrew Kelley 9a8851515b basic maybe type working 2016-01-02 00:06:06 -07:00