Commit Graph

201 Commits (2a49c876be76dc98996a3251310728ad32b22363)

Author SHA1 Message Date
Andrew Kelley 0a922d3bca move docs to website 2017-08-20 17:30:02 -04:00
Andrew Kelley d1e68c3ca8 better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
Andrew Kelley 6a93dda3e1 progress toward windows hello world working 2017-06-14 00:04:34 -04:00
Andrew Kelley 051ee8e626 change slicing syntax from ... to ..
See #359
2017-05-19 10:39:59 -04:00
Andrew Kelley 6237411716 inline function call with builtin function instead...
...of special syntax.

partially reverts 41144a8566

closes #306
2017-05-09 22:54:23 -04:00
Andrew Kelley 304cfb7122 move docs to ziglang.org 2017-05-08 00:13:54 -04:00
Andrew Kelley 5774b48ceb rename c_long_double to c_longdouble
to be consistent with other c primitive type names
2017-05-07 19:51:44 -04:00
Andrew Kelley 157af4332a builtin functions for division and remainder division
* add `@divTrunc` and `@divFloor` functions
 * add `@rem` and `@mod` functions
 * add compile error for `/` and `%` with signed integers
 * add `.bit_count` for float primitive types

closes #217
2017-05-06 23:13:12 -04:00
Andrew Kelley b6a679c0ed implement else on loops and break can give an expression
closes #357
2017-05-04 12:43:11 -04:00
Andrew Kelley 698829b772 change while syntax
Old:

```
while (condition; expression) {}
```

New:

```
while (condition) : (expression) {}
```

This is in preparation to allow nullable and
error union types as the condition. See #357
2017-05-03 18:12:07 -04:00
Andrew Kelley 644ea2dde9 remove test and try expressions in favor of if expressions
See #357
2017-05-03 17:23:11 -04:00
Andrew Kelley 17b935325e `@import("builtin")` instead of `@compileVar`
See #226
Closes #220
2017-05-01 13:12:38 -04:00
Andrew Kelley 7e11ef79d6 zig test no longer requires a separate test_runner.o file
See #298
2017-04-27 16:19:20 -04:00
Andrew Kelley aafb0b9082 slicing now returns correct const-ness
also remove the ability to override constness when slicing

closes #334
2017-04-22 12:19:20 -04:00
Andrew Kelley 0cce115476 update syntax for try and nullable unwrapping
closes #285
2017-04-21 16:46:33 -04:00
Andrew Kelley d5346d7a80 remove `?return` and `?defer`
closes #309
2017-04-21 15:08:03 -04:00
Andrew Kelley e3c524c1d4 rename `@ptrcast` to `@ptrCast` to follow convention 2017-04-21 10:39:13 -04:00
Raul Leal 5234016561 Add @offsetOf builtin function 2017-04-20 11:53:00 +00:00
Andrew Kelley a791417552 add `@fieldParentPtr` builtin function
closes #320
2017-04-18 02:28:05 -04:00
Andrew Kelley 407916cd2f rename `@intType` to `@IntType` to follow convention
closes #327
2017-04-18 00:05:09 -04:00
Andrew Kelley a6bd3d8ca2 move emacs/vim files to separate repos 2017-04-13 05:27:59 -04:00
Andrew Kelley bf57d8a7e3 typedefpocalypse
closes #314
2017-04-13 03:07:58 -04:00
Andrew Kelley 41144a8566 ability to inline at function callsite
closes #306
2017-04-13 00:13:54 -04:00
Andrew Kelley 095591f0b0 add enumTagName builtin function
closes #299
2017-04-08 17:45:22 -04:00
Andrew Kelley f7e9d7aa5d ability to implicitly cast integer literal to &const Int
where Int is an integer type

also introduce `@intToPtr` builtin for converting a usize
to a pointer. users now have to use this instead of `(&T)(int)`.

closes #311
2017-04-07 15:35:38 -04:00
Andrew Kelley 47f58d6d02 fix runtime struct initialization of bitfield
closes #308
2017-04-06 15:04:18 -04:00
Andrew Kelley d97285eb65 doc: link to Andrea's emacs mode 2017-04-04 15:37:42 -04:00
Andrew Kelley c9ae30d27e delete alloca builtin function
See #225

introduce os.EnvMap
2017-04-03 18:11:57 -04:00
Josh Wolfe 0594487a2e fix else-if parsing
implicit semicolon rules apply recursively to the "else" clause of if and try

if (a) {} else {} // implicit semicolon
if (a) {} else if (a) {} // implicit semicolon
if (a) {} else while (a) {} // implicit semicolon
2017-04-02 15:15:48 -07:00
Josh Wolfe 4b9e782d37 fix confusion in block expression parsing
closes #292

* if, try, while, for, comptime, defer are "greedy" with {} blocks,
  meaning if their bodies are blocks, then no suffix operator is allowed
  after the block. The {} block gets "built into" the containing statement,
  like the body of a switch statement.
* the Expression syntactic element is no longer "greedy" with {} blocks,
  meaning it's possible to have suffix operators after {} blocks without
  needing the {} block to be an rhs operand first.
2017-04-02 11:50:34 -07:00
Josh Wolfe 087324a639 show implicit semicolon rules in langref grammar 2017-04-02 10:53:00 -07:00
Andrew Kelley f8e63c4584 change `@bitcast` to `@ptrcast`
See #290
2017-03-31 06:18:20 -04:00
Andrew Kelley 3ca027ca82 first pass at zig build system
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`,
   `zig build_lib` and `zig build_exe` respectively.
 * `--name` parameter is optional when it can be inferred from the
   root source filename. closes #207
 * `zig build` now looks for `build.zig` which interacts with
   `std.build.Builder` to describe the targets, and then the zig
   build system prints TODO: build these targets. See #204
 * add `@bitcast` which is mainly used for pointer reinterpret
   casting and make explicit casting not do pointer reinterpretation.
   Closes #290
 * fix debug info for byval parameters
 * sort command line help options
 * `std.debug.panic` supports format string printing
 * add `std.mem.IncrementingAllocator`
 * fix const ptr to a variable with data changing at runtime.
   closes #289
2017-03-31 05:55:41 -04:00
Andrew Kelley a32b5929cc add stack protector safety when linking libc
* introduce zigrt file. it contains only weak symbols so that
   multiple instances can be merged. it contains __zig_panic
   so that multiple .o files can call the same panic function.
 * remove `@setFnVisible` builtin and add @setGlobalLinkage builtin
   which is more powerful
 * add `@panic` builtin function.
 * fix collision of symbols with extern prototypes and internal
   function names
 * add stack protector safety when linking against libc. To add
   the safety mechanism without libc requires implementing
   Thread Local Storage. See #276
2017-03-26 21:07:07 -04:00
Andrew Kelley 8aeea72654 add debug safety checks for remainder division
See #217
2017-03-26 15:06:43 -04:00
Andrew Kelley 6ee63c8f58 update langref
&&= and ||= are gone
2017-03-26 14:48:23 -04:00
Andrew Kelley 7ce753a16b replace "&&" and "||" with "and" and "or"
closes #272
2017-03-26 05:21:28 -04:00
Andrew Kelley 451ce09067 new unreachable syntax
* `noreturn` is the primitive type.
 * `unreachable` is a control flow keyword.
 * `@unreachable()` builtin function is deleted.

closes #214
2017-03-26 04:58:48 -04:00
Andrew Kelley 22e6bfca96 add comptime top level declaration
closes #255
2017-03-26 04:32:13 -04:00
Andrew Kelley af536ac343 introduce new test syntax
* remove setFnTest builtin
 * add test "name" { ... } syntax
 * remove --check-unused argument. functions are always lazy now.
2017-03-16 16:02:35 -04:00
Andrew Kelley eb9f1e2d53 add basic emacs syntax file 2017-03-02 23:03:44 -05:00
Andrew Kelley b78752e2d2 remove zeroes from vim syntax file 2017-03-02 23:03:30 -05:00
Andrew Kelley 6dba1f1c8e slice and array re-work plus some misc. changes
* `@truncate` builtin allows casting to the same size integer.
   It also performs two's complement casting between signed and
   unsigned integers.
 * The idiomatic way to convert between bytes and numbers is now
   `mem.readInt` and `mem.writeInt` instead of an unsafe cast.
   It works at compile time, is safer, and looks cleaner.
 * Implicitly casting an array to a slice is allowed only if the
   slice is const.
 * Constant pointer values know if their memory is from a compile-
   time constant value or a compile-time variable.
 * Cast from [N]u8 to []T no longer allowed, but [N]u8 to []const T
   still allowed.
 * Fix inability to pass a mutable pointer to comptime variable at
   compile-time to a function and have the function modify the
   memory pointed to by the pointer.
 * Add the `comptime T: type` parameter back to mem.eql. Prevents
   accidentally creating instantiations for arrays.
2017-02-12 17:35:51 -05:00
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 7749ffd797 try expression can omit variable assignments 2017-02-05 18:58:58 -05:00
Andrew Kelley 419e75eb23 remove volatileStore builtin; add volatile pointers
closes #238
2017-02-04 21:49:27 -05:00
Andrew Kelley 8c9016b6d1 add setGlobalAlign and setGlobalSection builtin functions
closes #241
2017-02-03 13:56:56 -05:00
Andrew Kelley 71d335e5cc implement packed structs
closes #183
2017-02-03 11:39:24 -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