Commit Graph

507 Commits (fce435db269162774106ce7e6ddf70871d5eeb49)

Author SHA1 Message Date
Andrew Kelley fc100d7b3b lots of miscellaneous things all in one big commit
* add `@compileLog(...)` builtin function
   - Helps debug code running at compile time
   - See #240
 * fix crash when there is an error on the start value of a slice
 * add implicit cast from int and float types to int and float
   literals if the value is known at compile time
 * make array concatenation work with slices in addition to
   arrays and c string literals
 * fix compile error message for something not having field access
 * fix crash when `@setDebugSafety()` was called from a
   function being evaluated at compile-time
 * fix compile-time evaluation of overflow math builtins.
 * avoid debug safety panic handler in builtin.o and compiler_rt.o
   since we use no debug safety in these modules anyway
 * add compiler_rt functions for division on ARM
   - Closes #254
 * move default panic handler to std.debug so users can
   call it manually
 * std.io.printf supports a width in the format specifier
2017-02-09 03:09:25 -05:00
Andrew Kelley 8a859afd58 std.io supports printing integers as hex values
remove "unnecessary if statement" error
this "depends on compile variable" code is too hard to validate,
and has false negatives. not worth it right now.

std.str removed, instead use std.mem.

std.mem.eql and std.mem.sliceEql merged and do not require explicit
type argument.
2017-02-07 17:23:50 -05:00
Andrew Kelley 07a71fc322 improved behavior on debug safety crash
* instead of emitting a breakpoint for a debug safety crash,
   zig calls a panic function which prints an error message
   and a stack trace and then calls abort.
 * on freestanding OS, this panic function has a default
   implementation of a simple infinite loop.
 * users can override the panic implementation by providing
   `pub fn panic(message: []const u8) -> unreachable { }`
 * workaround for LLVM segfaulting when you try to use cold
   calling convention on ARM.

closes #245
2017-02-06 03:10:32 -05:00
Andrew Kelley 0c88b1ce73 use printf in test runner code 2017-02-05 16:09:33 -05:00
Andrew Kelley e56f903522 memset and memcpy implementations need not return dest 2017-02-04 23:04:07 -05:00
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 88a253c64d fix crash when passing void to var args function
closes #235
2017-01-31 15:50:38 -05:00
Andrew Kelley 4b3f18de3c printf var args proof of concept
See #167

Need to troubleshoot when we send 2 slices to printf. It goes
into an infinite loop.

This commit introduces 4 builtin functions:

 * `@isInteger`
 * `@isFloat`
 * `@canImplictCast`
 * `@typeName`
2017-01-24 02:02:48 -05:00
Andrew Kelley 1826a96160 update charToDigit to take advantage of switch syntax 2017-01-23 01:19:03 -05:00
Andrew Kelley 0b34439c1f mem.free no longer requires explicit type argument 2017-01-23 00:11:21 -05:00
Andrew Kelley 47cf8520ad use comptime instead of inline for var and params
See #221
2017-01-22 19:51:37 -05:00
Andrew Kelley fdbc2d8da1 implement error when assigning to field of const struct
closes #48
2017-01-16 15:24:03 -05:00
Andrew Kelley c715309bc5 Merge branch 'master' into ir-merge 2017-01-16 14:23:32 -05:00
Andrew Kelley e621ad014e pass cannot assign to constant test 2017-01-05 18:50:36 -05:00
Andrew Kelley 97e1054890 fix compiler rt 2017-01-05 04:20:07 -05:00
Andrew Kelley ee09eb7f54 fix hash map implementation
standard library passes all tests now
2017-01-05 03:40:12 -05:00
Andrew Kelley 27a633b32a fix mem.sliceAsInt regression 2017-01-05 01:23:59 -05:00
Andrew Kelley ff5120c584 IR: std makes it to codegen 2016-12-31 18:25:10 -05:00
Andrew Kelley 69132bdeda IR: progress toward compiling standard library
* comptime fn call
 * is_comptime doesn't count as an instruction dependency
 * update more std code to latest zig
2016-12-31 17:10:29 -05:00
Andrew Kelley 76fa6cdce3 eradicate use of zeroes in std 2016-12-31 01:31:23 -05:00
Andrew Kelley b55efe5fab update more std library to new zig 2016-12-21 23:34:14 -05:00
Andrew Kelley 132e2fa5d9 errors from inline fn calls include stack trace 2016-12-18 20:52:40 -05:00
Andrew Kelley 82101198f1 workaround for Arch being a primitive type 2016-12-18 20:09:34 -05:00
Andrew Kelley a71fbe49cb IR: add FnProto instruction 2016-12-18 19:40:26 -05:00
Andrew Kelley 37b13bf151 hello.zig working with all structs anonymous 2016-12-18 17:24:52 -05:00
Andrew Kelley 0d2f2b79ea IR: basic support for implicit casting to const pointer 2016-12-18 01:54:27 -05:00
Andrew Kelley 05b3b6a45e IR: update some std code to newest zig 2016-12-18 00:25:26 -05:00
Andrew Kelley 0f047337ac IR: fix `this` expression
Previously it returned a block instead of a function when
a function had any arguments.
2016-12-17 20:47:35 -05:00
Andrew Kelley a07d7ee53d IR: fix compile time switch eval for enums 2016-12-17 17:57:26 -05:00
Andrew Kelley c64f9991d5 IR: fix switching on enum 2016-12-17 17:48:07 -05:00
Andrew Kelley ef63bc9cca IR: implement memcpy, memset, and slice expression 2016-12-12 00:31:35 -05:00
Andrew Kelley a2257e4b81 IR: implement setFnVisible builtin 2016-11-21 15:36:25 -05:00
Andrew Kelley 19037014e5 IR: more maybe type support 2016-11-18 23:52:42 -05:00
Andrew Kelley d94cb0566b IR: correctly codegening memset and memcpy 2016-11-18 22:24:41 -05:00
Steve Perkins 4b55966a16 add sort to CMakeLists + std/index 2016-11-03 07:01:40 +00:00
Steve Perkins cf00245bf9 sort requires compare function.
Provide some handy functions for builtin comparable types.
2016-11-03 04:10:33 +00:00
Steve Perkins e761aa2d2f sortCmp allows for a custom cmp function 2016-11-02 18:52:00 -04:00
Steve Perkins c5b2bdae11 quicksort 2016-11-02 18:10:44 -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 f4d7c91363 std/rand: remove unneeded TODO 2016-09-26 22:42:25 -04:00
Andrew Kelley 87b7c28c9a cstr.len and cstr.cmp can run at compile time
closes #140
2016-09-26 22:33:33 -04:00
Andrew Kelley 7ce7e2c9d1 emit error for extern function
with byvalue return value or parameter.

currently we don't codegen byvalue parameters or return values
correctly for C compatibilty functions so instead of generating
incorrect code, we emit a compile error.

eventually we'll support this feature and remove the compile error.

See #180
2016-09-26 20:01:42 -04:00
Andrew Kelley 46eb77dbb2 stack trace is able to figure out compilation unit
each address is contained within

also fix a bug having to do with codegen for enum value
initialization expressions
2016-09-23 02:00:23 -04:00
Andrew Kelley 7aeca9bfed fix incorrect linking from previous commit 2016-09-21 17:40:50 -04:00
Andrew Kelley b97bfc3ecb fix error when switch prong has implicit cast
closes #194
2016-09-20 16:10:34 -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 f1761632da darwin compat fixups
- delete commented out code
 - delete redundant check for missing
   mmacosx-version-min/maxdir
 - add TODO comment in std library
 - rename 'os' to 'self' in io.zig
 - `openSelfExe` aborts on darwin instead of compile error
 - only allow warnings on the one parseh test that has
   `#include <stdint.h>`.
2016-09-14 02:47:16 -04:00
alter cf9b21c09f MacOSX compatibility
- Implemented some syscall for MacOSX
- tested on : El Capitan 10.11 x86_64
- make self hosted test run on macosx
- modified run_test so it does not fail when parseh throws
  warnings (most of them are related to buildin types from
  gcc that arent defined in header files and unions)
- making -mmacosx-version-min and -mios-version-min works like
  gcc (command line paramers have precedence over enviroment variables)
2016-09-14 02:46:02 -04:00
Andrew Kelley 06f2f4d64b change `unreachable{}` to `@unreachable()`
instead of a container init expression, it's a builtin
function call.
2016-09-13 16:46:27 -04:00
Andrew Kelley ea2f6594ce std: fix compile error for unsupported os 2016-09-13 15:36:30 -04:00
Andrew Kelley 9e92dbdd08 std: use parameter type inference on min and max functions 2016-09-10 20:53:57 -04:00
Andrew Kelley fc9ff13fb6 std: avoid calling close twice in InStream
thanks ofelas for pointing this out
2016-09-08 14:21:42 -04:00
Andrew Kelley d324b1befa ability to infer parameter types 2016-09-08 00:24:48 -04:00
Andrew Kelley cfaced3f73 rename errName builtin to errorName 2016-09-05 17:03:11 -04:00
Andrew Kelley 768a9780ca rename compileErr builtin to compileError 2016-09-05 17:01:54 -04:00
Andrew Kelley 320e26590a fix std io input to work for non seekable fds 2016-08-31 20:23:47 -07:00
Andrew Kelley 651dc31247 implement null as a literal type 2016-08-29 22:14:09 -07:00
Andrew Kelley 6149f73189 std: more progress toward stack printing 2016-08-29 22:13:59 -07:00
Andrew Kelley ed50bd1b65 progress toward stack trace printing 2016-08-17 20:11:04 -07:00
Andrew Kelley a2ac06dcd5 std: replace print_u64/i64 with printInt 2016-08-16 22:59:32 -07:00
Andrew Kelley 37d167f6e0 std: conform to style guidelines 2016-08-16 22:42:50 -07:00
Andrew Kelley 0ae9023832 add CBuf to standard library
and fix ability to take address of variables
from other namespaces
2016-08-11 22:25:13 -07:00
Andrew Kelley 0d5ecc4312 ability to have a return type of 'type' 2016-08-07 20:08:37 -07:00
Andrew Kelley 0450b73e3e std: add tests for mt32 and mt64 2016-07-28 20:14:57 -07:00
Andrew Kelley 711e3d71b9 std: add vaporware plans for floating point builtins 2016-07-27 23:46:20 -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 3eb5afd245 std: cleanup of rand 2016-07-27 19:52:38 -07:00
Andrew Kelley 06c4b35eb1 std: improve rand implementation and API 2016-07-26 23:51:58 -07:00
Andrew Kelley bc81ddfea6 unsigned integers for sizes of things
Closes #62.
2016-07-26 20:40:11 -07:00
Andrew Kelley 76f87cdd96 std: add OutStream.write_byte 2016-07-26 18:13:22 -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 b08bc84a36 don't add no-frame-pointer-elim for inline functions
and make syscall functions inline
this gets the tests all passing on i386
2016-05-18 18:30:03 -07:00
Andrew Kelley 3273e99d70 linux: accept calls accept4 with 0 for flags 2016-05-18 17:18:28 -07:00
Andrew Kelley 7edef4f3fd add beginning of print stack trace function
introduce std.debug and move std.assert to std.debug.assert
add mem.copy
2016-05-17 13:32:43 -07:00
Andrew Kelley 3df9389215 compiler-rt: add __aeabi_uldivmod 2016-05-15 12:02:37 -07:00
Travis McDemus 7b0052abbb Add unsigned and signed generic print fns
Signed-off-by: Andrew Kelley <superjoe30@gmail.com>
2016-05-15 01:41:15 -07:00
Andrew Kelley 6ae6b5f5b5 add compile_err builtin 2016-05-14 18:54:37 -07:00
Andrew Kelley 76f909edeb std: take advantage of ability to cast maybe pointer to isize 2016-05-14 12:38:27 -07:00
Andrew Kelley 6a7f3c8df7 std: make parsing an unsigned number generic 2016-05-13 11:11:55 -07:00
Andrew Kelley 5d2f86116f std: fix linux.get_errno 2016-05-13 09:54:56 -07:00
Andrew Kelley 8e3ab28be9 ability to cast maybe pointer to isize/usize
also ability to put noalias on maybe pointer
2016-05-13 09:54:56 -07:00
Andrew Kelley 26718a619c recognize ar program and pass --gc-sections to ld
See #54
2016-05-11 14:44:10 -07:00
Andrew Kelley 6b7ffd4cbe builtin: use explicit type instead of typeof function 2016-05-11 13:18:28 -07:00
Andrew Kelley 22888ca524 some work in progress networking code
also, casting to or from a u8 slice makes a function impure
2016-05-10 15:00:59 -07:00
Andrew Kelley d92ae20f45 add hashmap to standard library
closes #22
2016-05-09 15:07:38 -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 56908dcb9d add debug safety for shortening casts
closes #150
2016-05-09 08:44:41 -07:00
Andrew Kelley 9e905ab364 not-yet-working implementation of generic hash map 2016-05-08 16:05:41 -07:00
Andrew Kelley 0c32b0b4ad add list implementation to standard library 2016-05-08 01:34:00 -07:00
Andrew Kelley 01c46eef3a std: separate str and cstr 2016-05-07 10:52:52 -07:00
Andrew Kelley 8c79438f6b better array concatenation semantics
closes #87
2016-05-07 10:05:59 -07:00
Andrew Kelley 094336f07c add integer wrapping
see #46
2016-05-05 17:19:01 -07:00
Andrew Kelley f2bc5ccbc2 more networking standard library code 2016-05-04 14:52:15 -07:00
Andrew Kelley 66ed7a5eb5 beginnings of network standard library code 2016-05-03 20:48:53 -07:00
Andrew Kelley 4815c03caa better parameter codegen
* ability to take address of a parameter (closes #97)
 * debug symbols work for parameters
2016-04-27 17:34:53 -07:00
Andrew Kelley d1fa5692c6 add array bounds checking in debug mode
closes #27
2016-04-26 11:36:11 -07:00
Andrew Kelley a25307c0a1 add optional continue expression to while loop
closes #139
2016-04-19 20:28:44 -07:00
Andrew Kelley 9658c05fd4 std: remove broken windows random implementation 2016-04-19 17:15:23 -07:00
Andrew Kelley f4c7e1bf49 rearrange standard library a bit 2016-04-18 16:42:56 -07:00
Andrew Kelley be4df96e4b passing all tests 2016-04-12 13:30:52 -07:00
Andrew Kelley 7a05e18efb implement @err_name builtin function 2016-04-09 08:55:53 -07:00
Andrew Kelley 5dbc21b511 update cat example, refactor std
partial implementation of @err_name
2016-04-08 16:21:30 -07:00
Andrew Kelley 1d4c66b56b support multiple generic function instances
See #22
2016-04-07 10:34:54 -07:00
Andrew Kelley 9c3d7b628c rename syscall.zig to linux.zig 2016-03-01 14:11:38 -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
notkild 8a827fafa6 Add support to open, create and close file 2016-02-28 23:12:58 +01: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 01fda6199e dummy implementation of os_get_random_bytes for windows 2016-02-13 22:59:49 -07:00
Andrew Kelley c8376af92d add @ctz, @clz and compiler_rt implementation 2016-02-13 12:50:13 -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 592210a173 i386 support
closes #115

Thanks to Seo Sanghyeon for the port code.
2016-02-12 02:04:46 -07:00
Andrew Kelley d8f6388b63 if statements can be const expr evaluated
also introduce error for unnecessary if statement
but if the condition depends on a compile variable, then
the if statement is OK
2016-02-09 18:53:28 -07:00
Andrew Kelley 207862647c std: fix parse_u64 implementation and add test
also codegen implement comparision with pure errors
2016-02-09 09:51:25 -07:00
Andrew Kelley 6b3ce918db array.len generates a constant number literal expression 2016-02-07 15:52:52 -07:00
Andrew Kelley 42fe4e3cc8 remove ptr field access of arrays
use &array[0] instead
2016-02-07 15:43:19 -07:00
Andrew Kelley 94ed9f622a blocks with one statement pass constant expression eval 2016-02-07 12:38:51 -07:00
Andrew Kelley 4c8f26e9f6 std: remove auto flushing of stderr. use printf 2016-02-06 19:48:42 -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 ff5673ae1b add rand.float32 to standard library 2016-02-05 04:30:19 -07:00
Andrew Kelley bb4a532785 move os_get_random_bytes to os.zig 2016-02-04 01:00:54 -07:00
Andrew Kelley a6d4335217 fix running tests when linking with libc 2016-02-03 23:07:55 -07:00
Andrew Kelley 2521afef69 add ability to call function pointer field
also introduce the self hosted tests

closes #108
2016-02-03 21:34:09 -07:00
Andrew Kelley c3123158b7 fix handling of implicit casts in binary operators 2016-02-03 19:07:15 -07:00
Andrew Kelley 39223c1847 test runner prints test names 2016-02-03 18:38:09 -07:00
Andrew Kelley 11a0644365 basic support for building a test target 2016-02-03 18:02:01 -07:00
Andrew Kelley 5ad84e4724 unreachable causes a trap in debug mode 2016-02-02 02:43:33 -07:00
Andrew Kelley 6f1a7a0d70 add abort function and "cold" fn attribute 2016-02-02 00:42:06 -07:00
MovingtoMars 3fd6c0ce25 fix some inaccuracy in float printing 2016-01-29 21:22:15 +13:00
MovingtoMars a6c2b013fd remove some magic numbers from float printing 2016-01-29 21:19:21 +13:00
MovingtoMars 850f6d2d02 better f64_is_nan 2016-01-29 21:12:33 +13:00
MovingtoMars 90a32629c0 float printing mostly works 2016-01-29 20:55:38 +13:00
Andrew Kelley 2fc4b3629a std: remove incorrect float printing code 2016-01-28 12:54:30 -07:00
MovingtoMars eb08fd5f5f remove accidental printf from float printing 2016-01-28 19:44:44 +13:00
MovingtoMars fb7a95b3c4 cleanup float printing 2016-01-28 19:43:08 +13:00
MovingtoMars dc08412895 basic float printing 2016-01-28 19:28:43 +13:00
MovingtoMars 401a3361ea malloc fails on mmap error code properly 2016-01-28 16:01:52 +13:00
MovingtoMars 9c502030a1 check mmap return against -1 2016-01-28 13:45:35 +13:00
MovingtoMars 04b721d535 malloc fails on proper errors 2016-01-28 13:18:29 +13:00
MovingtoMars 1a913f6bf2 simple malloc and free using mmap 2016-01-28 12:39:02 +13: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 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 e85e7ebcf0 bootstrap: use %% operator instead of cast 2016-01-25 14:13:25 -07:00
Andrew Kelley 6db6609df8 implement %% operator
See #23
2016-01-25 13:53:40 -07:00
Andrew Kelley bcb18338cd update std lib to use error type and global variables 2016-01-24 22:53:00 -07:00
Andrew Kelley f5cc7f65a3 fix parameter access of sret functions 2016-01-24 19:27:12 -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 c0ea9290c4 main returns %void 2016-01-23 02:14:01 -07:00
Andrew Kelley 91d911007b codegen: fix field access of arrays
also fix error type analyze error
2016-01-23 00:53:43 -07:00
Andrew Kelley bfceb18631 character literal returns a number literal 2016-01-22 23:24:09 -07:00
Andrew Kelley 523e3b86af support statically initialized array literal 2016-01-22 22:02:07 -07:00
Andrew Kelley b61406b607 add test for const number literal 2016-01-22 16:02:08 -07:00
Andrew Kelley 32e2196257 number literal rework 2016-01-21 03:02:25 -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 ae2151a751 use signed integer for sizes of things 2016-01-18 21:13:14 -07:00
Andrew Kelley 32821e7098 add function pointer support
See #14
2016-01-18 16:42:45 -07:00
Andrew Kelley 4c50606b9d refactor std to use for loop 2016-01-18 07:16:17 -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 5f7685336f better main symbol prototype
closes #64
2016-01-16 00:07:34 -07:00
Andrew Kelley dc162c7f83 rename "use" to "import" 2016-01-15 18:45:52 -07:00
Andrew Kelley 86f55bce53 add void arrays test 2016-01-15 18:41:19 -07:00
Andrew Kelley 0c9afede9e overflow intrinsics take type as first argument 2016-01-14 17:04:35 -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 49d0971cd4 detect and report top level decl dependency loop 2016-01-10 00:03:31 -07:00
Andrew Kelley 6d9119fcd9 add memcpy and memset intrinsics 2016-01-09 02:16:54 -07:00
Andrew Kelley bdca82ea66 implement pub const 2016-01-09 00:37:48 -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 d14a31100f implement unknown size array indexing and slicing 2016-01-08 17:52:45 -07:00
Andrew Kelley 0c84ecd19d codegen: fix else if expression and maybe unwrap expr 2016-01-08 03:59:37 -07:00
Andrew Kelley e1f498212c fix codegen for implicit maybe wrap 2016-01-08 02:52:27 -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 9b9fd5ad23 re-add errno.zig 2016-01-07 03:22:53 -07:00
Andrew Kelley c75d40680f while detects simple constant condition 2016-01-06 18:02:42 -07:00
Andrew Kelley 5f0bfcac24 fix undefined reference to memcpy in release mode
when not depending on libc, we generate memcpy and memset
implementations.
2016-01-06 06:40:25 -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 3327b0488d add #min_value() and #max_value() 2016-01-05 06:30:49 -07:00
Andrew Kelley 44d5d008d0 partial import segregation
See #3
2016-01-04 03:31:57 -07:00
Andrew Kelley b453345554 add rand example that doesn't yet work 2016-01-03 00:30:41 -07:00
Andrew Kelley 1abb4e59be fix various bugs related to guess number example 2016-01-02 21:56:33 -07:00
Andrew Kelley 258bc73eee fix implicit cast after unreachable bad code gen 2016-01-02 20:13:10 -07:00
Andrew Kelley 187d00ca83 ability to access pointers with array indexing syntax
closes #40
2016-01-02 19:47:36 -07:00
Andrew Kelley 968b85ad77 closer to guess number example working 2016-01-02 03:38:45 -07:00
Andrew Kelley 9ce36ba0cc inline assembly uses -> instead of return 2015-12-23 15:49:34 -07:00
Andrew Kelley 1f48b626a1 std: even more efficient inline assembly 2015-12-15 02:47:39 -07:00
Andrew Kelley 673d638070 std: more efficient inline assembly 2015-12-15 01:55:52 -07:00
Andrew Kelley a292eb8d64 support inline assembly expressions with return type 2015-12-15 00:46:56 -07:00
Andrew Kelley 66ca916805 std: expose exit syscall 2015-12-15 00:07:51 -07:00
Andrew Kelley 83b68c9f13 add global variable support
closes #12
2015-12-14 23:10:18 -07:00
Andrew Kelley 3049410260 `const` and `var` instead of `let` and `let mut`
closes #34
2015-12-14 18:51:07 -07:00
Andrew Kelley f17e20d5fe instead of *mut and *const, & and &const
closes #33
2015-12-14 18:10:25 -07:00
Andrew Kelley 630917b29b std: factor out the write syscall and make it public 2015-12-14 03:06:54 -07:00
Andrew Kelley e411467e1d add number literal type
it gets implicitly casted to whatever is needed.

closes #24
2015-12-14 02:46:37 -07:00
Andrew Kelley ac630d354d std: print_str no longer requires length argument
add explicit casting support from array to string
2015-12-12 02:05:08 -07:00
Andrew Kelley a10277bd94 prepare codebase for struct and string support
parsing code for structs, strings, and c string literals
partial semantic analyzing code for structs, strings, and c string literals
2015-12-12 00:10:37 -07:00
Andrew Kelley d697404f64 hello world working without libc 2015-12-11 03:55:26 -07:00
Andrew Kelley 15ba5bc54e provide std.zig and add it to import paths 2015-12-10 17:42:47 -07:00
Andrew Kelley 0dbee2300e add inline assembly support 2015-12-10 15:34:38 -07:00