Commit Graph

374 Commits (d9ed3d186dc09cab05b841b924664fc886077275)

Author SHA1 Message Date
Andrew Kelley 897e783763 add promise->T syntax parsing
closes #857
2018-03-24 19:25:53 -04:00
Andrew Kelley 7a99d63c76 ability to use async function pointers
closes #817
2018-03-22 16:56:03 -04:00
Andrew Kelley f885a1ab61 change async function call syntax
* instead of `async(allocator) call()`, now it is
   `async<allocator> call()`.
 * Fixes syntax ambiguity when leaving off the allocator
 * Fixes parse failure when call is a field access

This sets a precedent for using `<` to pass arguments
to a keyword. This will affect `enum`, `union`, and
`fn` (see #661)
2018-03-21 19:56:41 -04:00
Tesla Ice Zhang c4544df011
Remove unnecessary rule and re-fix an old bug
The "old bug" is cause my last pr. I'm fixing it now.
2018-03-20 03:00:11 +08:00
Tesla Ice Zhang cc6ac77913
Fix some explicit errors 2018-03-17 23:17:07 +08:00
Andrew Kelley 50e25f6cec add missing docs for setAlignStack builtin 2018-03-14 21:51:06 -04:00
Andrew Kelley eff3530dfa var is no longer a pseudo-type, it is syntax
closes #779
2018-03-06 18:31:31 -05:00
Andrew Kelley de5c0c9f40 Merge remote-tracking branch 'origin/master' into async 2018-03-01 20:47:35 -05:00
Andrew Kelley 8429d4ceac implement coroutine resume 2018-02-28 22:18:48 -05:00
Andrew Kelley 807a5e94e9 add atomicrmw builtin function 2018-02-28 21:19:51 -05:00
Andrew Kelley c60496a297 parse await and suspend syntax
See #727
2018-02-26 00:04:11 -05:00
Andrew Kelley 8db7a1420f update errors section of docs
closes #768
2018-02-23 20:43:47 -05:00
Andrew Kelley 236bbe1183 implement IR analysis for async function calls
See #727
2018-02-21 00:52:20 -05:00
Andrew Kelley a06f3c74fd parse async fn definitions
See #727
2018-02-20 00:31:52 -05:00
Andrew Kelley 3d58d7232a parse async fn calls and cancel expressions 2018-02-20 00:05:38 -05:00
Andrew Kelley 445b03384a introduce std.heap.ArenaAllocator and std.heap.DirectAllocator
* DirectAllocator does the underlying syscall for every allocation.
 * ArenaAllocator takes another allocator as an argument and
   allocates bytes up front, falling back to DirectAllocator with
   increasingly large allocation sizes, to avoid calling it too often.
   Then the entire arena can be freed at once.

The self hosted parser is updated to take advantage of ArenaAllocator
for the AST that it returns. This significantly reduces the complexity
of cleanup code.

docgen and build runner are updated to use the combination of
ArenaAllocator and DirectAllocator instead of IncrementingAllocator,
which is now deprecated in favor of FixedBufferAllocator combined
with DirectAllocator.

The C allocator calls aligned_alloc instead of malloc, in order to
respect the alignment parameter.

Added asserts in Allocator to ensure that implementors of the
interface return slices of the correct size.

Fixed a bug in Allocator when you call realloc to grow the allocation.
2018-02-12 02:14:44 -05:00
Andrew Kelley 46aa416c48 std.os and std.io API update
* move std.io.File to std.os.File
 * add `zig fmt` to self hosted compiler
 * introduce std.io.BufferedAtomicFile API
 * introduce std.os.AtomicFile API
 * add `std.os.default_file_mode`
 * change FileMode on posix from being a usize to a u32
 * add std.os.File.mode to return mode of an open file
 * std.os.copyFile copies the mode from the source file instead of
   using the default file mode for the dest file
 * move `std.os.line_sep` to `std.cstr.line_sep`
2018-02-10 21:02:24 -05:00
Andrew Kelley a2bd9f8912 std lib: modify allocator idiom
Before we accepted a nullable allocator for some stuff like
opening files. Now we require an allocator.

Use the mem.FixedBufferAllocator pattern if a bound on the amount
to allocate is known.

This also establishes the pattern that usually an allocator is the
first argument to a function (possibly after "self").

fix docs for std.cstr.addNullByte

self hosted compiler:
 * only build docs when explicitly asked to
 * clean up main
 * stub out zig fmt
2018-02-09 18:27:50 -05:00
Andrew Kelley ee982ae162 syntax: parse `?error!i32` as `?(error!i32)` 2018-02-08 22:30:08 -05:00
Andrew Kelley f9be970375 Merge remote-tracking branch 'origin/master' into error-sets 2018-02-08 20:45:26 -05:00
Andrew Kelley 76239f2089 error sets - update langref. all tests passing 2018-02-08 03:02:41 -05:00
Andrew Kelley 0d5ff6f462 error sets - most tests passing 2018-02-08 02:08:45 -05:00
Andrew Kelley b8f59e14cd *WIP* error sets - correctly resolve inferred error sets 2018-02-02 18:13:32 -05:00
Andrew Kelley 5f518dbeb9 *WIP* error sets converting std lib 2018-01-31 22:48:40 -05:00
Andrew Kelley 02b61224b2 add docs for memberType, memberCount, memberName 2018-01-31 20:56:53 -05:00
Andrew Kelley e6d4028a84 docs: move source encoding section 2018-01-31 20:42:27 -05:00
Andrew Kelley 3a11757d57 add docs recommending to only have 1 cImport 2018-01-31 20:18:47 -05:00
Andrew Kelley a795e4ce32 add some docs for reflection 2018-01-31 11:47:56 -05:00
Andrew Kelley 5161d70620 *WIP* error sets 2018-01-31 01:51:31 -05:00
Andrew Kelley 0995a81b8b langref: remove page title header 2018-01-30 10:31:01 -05:00
Marc Tiehuis 5e9f87c3bd Improve documentation styling for mobile devices
- No overscrolling on small screens
 - Font-size is reduced for more content per screen
 - Tables + Code blocks scroll within a block to avoid page-widenening
2018-01-30 17:33:38 +13:00
Andrew Kelley 3671582c15 syntax: functions require return type. remove `->`
The purpose of this is:

 * Only one way to do things
 * Changing a function with void return type to return a possible
   error becomes a 1 character change, subtly encouraging
   people to use errors.

See #632

Here are some imperfect sed commands for performing this update:

remove arrow:

```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```

add void:

```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```

Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley e5bc5873d7 rename "debug safety" to "runtime safety"
closes #437
2018-01-25 01:46:12 -05:00
Andrew Kelley b71a56c9df cleanups that I meant to put in the previous commit 2018-01-23 23:12:38 -05:00
Andrew Kelley b3a6faf13e replace %defer with errdefer
See #632

now we have 1 less sigil
2018-01-23 23:08:09 -05:00
Andrew Kelley fa7072f3f2 docgen: verify internal links 2018-01-22 23:06:07 -05:00
Andrew Kelley cf39819478 add new kind of test: generating .h files. and more
* docgen supports obj_err code kind for demonstrating
   errors without explicit test cases
 * add documentation for `extern enum`. See #367
 * remove coldcc keyword and add @setIsCold. See #661
 * add compile errors for non-extern struct, enum, unions
   in function signatures
 * add .h file generation for extern struct, enum, unions
2018-01-22 22:24:07 -05:00
Andrew Kelley ddd04a7b46 fix docgen on windows 2018-01-19 22:17:31 -05:00
Andrew Kelley 613c4dbf58 temporary workaround for os.deleteTree not implemented for windows/mac
See #709
2018-01-19 15:51:37 -05:00
Andrew Kelley 2c25c8aeed docs: remove references to %% prefix operator
also cleanup the table of contents
2018-01-19 03:47:27 -05:00
Andrew Kelley ea623f2d39 all doc code examples are now tested
improve color scheme of docs
make docs depend on no external files
fix broken example code in docs

closes #465
2018-01-19 03:21:47 -05:00
Andrew Kelley 2e6125bc66 ziglang.org home page no longer in this repo
update docs examples which use build-exe to be tested

See #465
2018-01-17 03:24:49 -05:00
Andrew Kelley 1eda7e0fde docgen: support executing exe code examples
See #465
2018-01-17 01:50:35 -05:00
Andrew Kelley 5aefabe045 docgen: validate See Also sections
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley 2774fe8a1b docgen auto generates table of contents
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley 7b57454cc1 clean up error return tracing
* error return tracing is disabled in release-fast mode
 * add @errorReturnTrace
 * zig build API changes build return type from `void` to `%void`
 * allow `void`, `noreturn`, and `u8` from main. closes #535
2018-01-15 00:01:02 -05:00
Andrew Kelley 3c094116aa remove %% prefix operator
See #632
closes #545
closes #510

this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrew Kelley 632d143bff replace `a %% b` with `a catch b`
See #632

better fits the convention of using keywords for control flow
2018-01-07 17:28:20 -05:00
Andrew Kelley 66717db735 replace `%return` with `try`
See #632

better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrew Kelley 32ba0dcea9 update hello world docs 2018-01-07 01:59:23 -05:00
Andrew Kelley 5c8600d790 add december in review to reading material; fix docs 2018-01-03 21:11:58 -05:00
Andrew Kelley 6281a511e1 add noInlineCall to docs 2018-01-03 03:27:48 -05:00
Andrew Kelley d9d61ed563 doc fixes 2018-01-03 02:51:45 -05:00
Josh Wolfe 192a039173 move utf8 parsing to std
source files no longer need to end with a newline
2017-12-26 23:17:33 -07:00
Andrew Kelley 86397a532e docs: fix typo 2017-12-24 02:52:30 -05:00
Josh Wolfe f0a1753607 add source encoding rules to the docs. see #663 2017-12-23 22:23:06 -07:00
Andrew Kelley d917815d81 explicitly return from blocks
instead of last statement being expression value

closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley 8bc523219c add labeled loops, labeled break, labeled continue. remove goto
closes #346
closes #630

regression: translate-c can no longer translate switch statements.
after #629 we can ressurect and modify the code to utilize arbitrarily
returning from blocks.
2017-12-20 23:00:19 -05:00
Andrew Kelley 9d9201c3b4 bring back code that uses export and fix tests
partial revert of 1fdebc1dc4
2017-12-19 02:39:43 -05:00
Andrew Kelley c627f9ea18 wip bring back export keyword 2017-12-19 01:19:49 -05:00
Andrew Kelley 1fdebc1dc4 wip export rewrite 2017-12-18 09:59:57 -05:00
Andrew Kelley f55fdc00fc fix const and volatile qualifiers being dropped sometimes
in the expression `&const a.b`, the const (and/or volatile)
qualifiers would be incorrectly dropped.

closes #655
2017-12-13 21:53:52 -05:00
Andrew Kelley 942b250895 update docs regarding enums and unions 2017-12-04 01:43:06 -05:00
Andrew Kelley 0ad1239522 rework enums and unions and their relationship to each other
* @enumTagName renamed to @tagName and it works on enums and
   union-enums
 * Remove the EnumTag type. Now there is only enum and union,
   and the tag type of a union is always an enum.
 * unions support specifying the tag enum type, and they support
   inferring an enum tag type.
 * Enums no longer support field types but they do support
   setting the tag values. Likewise union-enums when inferring
   an enum tag type support setting the tag values.
 * It is now an error for enums and unions to have 0 fields.
 * switch statements support union-enums

closes #618
2017-12-03 20:43:56 -05:00
Andrew Kelley 137c8f5e8a ability to set tag values of enums
also remove support for enums with 0 values

closes #305
2017-12-02 22:32:39 -05:00
Andrew Kelley b62e2fd870 ability to specify tag type of enums
see #305
2017-11-30 22:08:11 -05:00
Andrew Kelley 741504862c update homepage docs 2017-11-24 15:06:12 -05:00
Josh Wolfe afbbdb2c67 move base64 functions into structs 2017-11-20 23:26:45 -07:00
Josh Wolfe a44283b0b2 rework std.base64 api
* rename decode to decodeExactUnsafe.
* add decodeExact, which checks for invalid chars and padding.
* add decodeWithIgnore, which also allows ignoring chars.
* alphabets are supplied to the decoders with their
  char-to-index mapping already built, which enables it to be
  done at comptime.
* all decode/encode apis except decodeWithIgnore require dest
  to be the exactly correct length. This is calculated by a
  calc function corresponding to each api. These apis no longer
  return the dest parameter.
* for decodeWithIgnore, an exact size cannot be known a priori.
  Instead, a calc function gives an upperbound, and a runtime
  error is returned in case of overflow. decodeWithIgnore
  returns the number of bytes written to dest.

closes #611
2017-11-20 23:26:45 -07:00
Andrew Kelley 1473eb9ae0 add documentation placeholders for unions 2017-11-16 22:13:20 -05:00
Andrew Kelley 4543413491 std.io: introduce buffered I/O and change API
I started working on #465 and made some corresponding std.io
API changes.

New structs:
 * std.io.FileInStream
 * std.io.FileOutStream
 * std.io.BufferedOutStream
 * std.io.BufferedInStream

Removed:
 * std.io.File.in_stream
 * std.io.File.out_stream

Now instead of &file.out_stream or &file.in_stream to get access to
the stream API for a file, you get it like this:

var file_in_stream = io.FileInStream.init(&file);
const in_stream = &file_in_stream.stream;

var file_out_stream = io.FileOutStream.init(&file);
const out_stream = &file_out_stream.stream;

This is evidence that we might not need any OOP features -
See #130.
2017-11-07 03:22:27 -05:00
Andrew Kelley cd58b40011 update C headers to clang 5.0.0 2017-09-30 18:20:55 -04:00
Andrew Kelley 79400bfdfd fix docs 2017-09-25 15:04:52 -04:00
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
Andrew Kelley 4df1a9b251 document setDebugSafety builtin function 2017-02-01 03:28:40 -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 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 e5b1758010 remove staticEval builtin in favor of comptime expression 2017-01-22 23:21:00 -05:00
Andrew Kelley 201a3c121a introduce comptime expression
closes #221
2017-01-22 22:59:52 -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 6a5e61acd1 get rid of zeroes literal
closes #222
2017-01-16 17:24:13 -05:00
Andrew Kelley c715309bc5 Merge branch 'master' into ir-merge 2017-01-16 14:23:32 -05:00
Andrew Kelley 6caf32195a pass unnecessary if statement test 2017-01-08 22:25:38 -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 37b13bf151 hello.zig working with all structs anonymous 2016-12-18 17:24:52 -05:00
Andrew Kelley e50ced44a2 IR: all structs anonymous 2016-12-18 16:56:50 -05:00
Andrew Kelley ef63bc9cca IR: implement memcpy, memset, and slice expression 2016-12-12 00:31:35 -05:00
Andrew Kelley fb21570630 IR: implement alloca builtin 2016-12-11 19:43:06 -05:00
Andrew Kelley c0b2fe4d6c IR: add error for assigning runtime value to inline var 2016-12-07 00:22:14 -05:00
Andrew Kelley 6ed202ab16 IR: implement defer 2016-12-06 21:26:17 -05:00
Andrew Kelley 0c531d447d remove the boolean argument from setFnTest 2016-12-05 21:39:15 -05:00
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