.gitattributes | 1 + .gitignore | 12 + .travis.yml | 22 +- CMakeLists.txt | 99 +- README.md | 83 +- build.zig | 241 +- ci/appveyor/appveyor.yml | 1 - deps/lld/COFF/Driver.cpp | 3 + doc/codegen.md | 8 +- doc/docgen.zig | 275 +- doc/langref.html.in | 2931 ++++++++++---- doc/semantic_analysis.md | 74 - example/cat/main.zig | 4 +- example/guess_number/main.zig | 2 +- example/hello_world/hello_libc.zig | 7 +- example/mix_o_files/base64.zig | 2 +- example/mix_o_files/build.zig | 6 +- example/shared_library/build.zig | 6 +- src-self-hosted/arg.zig | 96 +- src-self-hosted/c.zig | 3 + src-self-hosted/c_int.zig | 68 + src-self-hosted/codegen.zig | 450 +++ src-self-hosted/compilation.zig | 1303 +++++++ src-self-hosted/decl.zig | 98 + src-self-hosted/errmsg.zig | 237 ++ src-self-hosted/introspect.zig | 17 +- src-self-hosted/ir.zig | 2688 ++++++++++++- src-self-hosted/libc_installation.zig | 462 +++ src-self-hosted/link.zig | 737 ++++ src-self-hosted/llvm.zig | 209 +- src-self-hosted/main.zig | 1052 +++-- src-self-hosted/module.zig | 326 -- src-self-hosted/package.zig | 29 + src-self-hosted/scope.zig | 392 +- src-self-hosted/target.zig | 556 ++- src-self-hosted/test.zig | 243 ++ src-self-hosted/type.zig | 1101 ++++++ src-self-hosted/value.zig | 581 +++ src-self-hosted/visib.zig | 4 + src/all_types.hpp | 333 +- src/analyze.cpp | 969 +++-- src/analyze.hpp | 20 +- src/ast_render.cpp | 66 +- src/bigfloat.cpp | 12 + src/bigfloat.hpp | 3 + src/bigint.cpp | 59 +- src/bigint.hpp | 2 + src/codegen.cpp | 1335 +++++-- src/codegen.hpp | 2 + src/ir.cpp | 6533 +++++++++++++++++++++++--------- src/ir_print.cpp | 217 +- src/link.cpp | 35 +- src/main.cpp | 37 +- src/os.cpp | 275 +- src/os.hpp | 10 +- src/parser.cpp | 131 +- src/target.cpp | 121 +- src/target.hpp | 2 + src/tokenizer.cpp | 98 +- src/tokenizer.hpp | 8 +- src/translate_c.cpp | 330 +- src/util.hpp | 48 +- src/windows_sdk.cpp | 352 ++ src/windows_sdk.h | 47 + src/zig_llvm.cpp | 19 +- src/zig_llvm.h | 10 +- std/array_list.zig | 330 +- std/atomic/index.zig | 9 + std/atomic/int.zig | 33 + std/atomic/queue.zig | 240 ++ std/atomic/stack.zig | 150 + std/base64.zig | 136 +- std/buf_map.zig | 36 +- std/buf_set.zig | 46 +- std/buffer.zig | 93 +- std/build.zig | 595 +-- std/c/darwin.zig | 105 +- std/c/index.zig | 73 +- std/c/linux.zig | 9 +- std/c/windows.zig | 2 +- std/crypto/blake2.zig | 507 +-- std/crypto/hmac.zig | 4 +- std/crypto/md5.zig | 154 +- std/crypto/sha1.zig | 104 +- std/crypto/sha2.zig | 861 +++-- std/crypto/sha3.zig | 281 +- std/crypto/test.zig | 3 +- std/crypto/throughput_test.zig | 29 +- std/cstr.zig | 32 +- std/debug/failing_allocator.zig | 14 +- std/debug/index.zig | 458 +-- std/dwarf.zig | 39 +- std/dynamic_library.zig | 156 + std/elf.zig | 666 +++- std/event.zig | 250 +- std/event/channel.zig | 235 ++ std/event/future.zig | 130 + std/event/group.zig | 170 + std/event/lock.zig | 190 + std/event/locked.zig | 43 + std/event/loop.zig | 634 ++++ std/event/tcp.zig | 184 + std/fmt/errol/enum3.zig | 7 +- std/fmt/errol/index.zig | 216 +- std/fmt/errol/lookup.zig | 1200 +++--- std/fmt/index.zig | 1131 ++++-- std/hash/adler.zig | 21 +- std/hash/crc.zig | 47 +- std/hash/fnv.zig | 10 +- std/hash/siphash.zig | 22 +- std/hash_map.zig | 194 +- std/heap.zig | 386 +- std/index.zig | 10 + std/io.zig | 327 +- std/io_test.zig | 92 +- std/json.zig | 1389 +++++++ std/json_test.zig | 1904 ++++++++++ std/lazy_init.zig | 85 + std/linked_list.zig | 131 +- std/macho.zig | 44 +- std/math/acos.zig | 18 +- std/math/asin.zig | 22 +- std/math/atan.zig | 36 +- std/math/atan2.zig | 72 +- std/math/atanh.zig | 2 +- std/math/big/index.zig | 5 + std/math/big/int.zig | 2103 ++++++++++ std/math/cbrt.zig | 16 +- std/math/ceil.zig | 8 +- std/math/complex/abs.zig | 18 + std/math/complex/acos.zig | 21 + std/math/complex/acosh.zig | 21 + std/math/complex/arg.zig | 18 + std/math/complex/asin.zig | 27 + std/math/complex/asinh.zig | 22 + std/math/complex/atan.zig | 130 + std/math/complex/atanh.zig | 22 + std/math/complex/conj.zig | 17 + std/math/complex/cos.zig | 21 + std/math/complex/cosh.zig | 165 + std/math/complex/exp.zig | 134 + std/math/complex/index.zig | 171 + std/math/complex/ldexp.zig | 73 + std/math/complex/log.zig | 23 + std/math/complex/pow.zig | 22 + std/math/complex/proj.zig | 24 + std/math/complex/sin.zig | 22 + std/math/complex/sinh.zig | 164 + std/math/complex/sqrt.zig | 138 + std/math/complex/tan.zig | 22 + std/math/complex/tanh.zig | 113 + std/math/copysign.zig | 18 + std/math/cos.zig | 16 +- std/math/cosh.zig | 2 +- std/math/exp.zig | 47 +- std/math/exp2.zig | 316 +- std/math/expm1.zig | 52 +- std/math/fabs.zig | 19 + std/math/floor.zig | 58 +- std/math/fma.zig | 13 +- std/math/frexp.zig | 4 +- std/math/hypot.zig | 12 +- std/math/ilogb.zig | 4 +- std/math/index.zig | 197 +- std/math/inf.zig | 2 +- std/math/isfinite.zig | 8 + std/math/isinf.zig | 22 + std/math/isnan.zig | 6 + std/math/isnormal.zig | 9 + std/math/ln.zig | 24 +- std/math/log.zig | 17 +- std/math/log10.zig | 36 +- std/math/log1p.zig | 15 +- std/math/log2.zig | 30 +- std/math/modf.zig | 8 +- std/math/nan.zig | 2 + std/math/pow.zig | 5 +- std/math/round.zig | 8 +- std/math/scalbn.zig | 4 +- std/math/signbit.zig | 12 + std/math/sin.zig | 16 +- std/math/sinh.zig | 2 +- std/math/sqrt.zig | 318 +- std/math/tan.zig | 10 +- std/math/tanh.zig | 4 +- std/math/trunc.zig | 8 +- std/math/x86_64/sqrt.zig | 15 - std/mem.zig | 369 +- std/net.zig | 28 +- std/os/child_process.zig | 270 +- std/os/darwin.zig | 773 +++- std/os/darwin/errno.zig | 328 ++ std/os/darwin_errno.zig | 142 - std/os/epoch.zig | 26 + std/os/file.zig | 185 +- std/os/get_app_data_dir.zig | 69 + std/os/get_user_id.zig | 14 +- std/os/index.zig | 1155 ++++-- std/os/linux/errno.zig | 569 ++- std/os/linux/index.zig | 709 ++-- std/os/linux/test.zig | 24 +- std/os/linux/vdso.zig | 91 + std/os/linux/x86_64.zig | 139 +- std/os/path.zig | 195 +- std/os/test.zig | 47 +- std/os/time.zig | 282 ++ std/os/windows/advapi32.zig | 35 + std/os/windows/error.zig | 1188 ++++++ std/os/windows/index.zig | 338 +- std/os/windows/kernel32.zig | 162 + std/os/windows/ole32.zig | 18 + std/os/windows/shell32.zig | 4 + std/os/windows/shlwapi.zig | 4 + std/os/windows/user32.zig | 4 + std/os/windows/util.zig | 135 +- std/os/zen.zig | 124 +- std/rand/index.zig | 187 +- std/rand/ziggurat.zig | 166 + std/segmented_list.zig | 389 ++ std/sort.zig | 456 ++- std/special/bootstrap.zig | 45 +- std/special/bootstrap_lib.zig | 11 +- std/special/build_file_template.zig | 2 +- std/special/build_runner.zig | 33 +- std/special/builtin.zig | 322 +- std/special/compiler_rt/comparetf2.zig | 63 +- std/special/compiler_rt/divti3.zig | 26 + std/special/compiler_rt/divti3_test.zig | 21 + std/special/compiler_rt/extendXfYf2.zig | 89 + std/special/compiler_rt/extendXfYf2_test.zig | 155 + std/special/compiler_rt/fixuint.zig | 20 +- std/special/compiler_rt/fixunsdfdi.zig | 1 - std/special/compiler_rt/fixunsdfdi_test.zig | 2 +- std/special/compiler_rt/fixunsdfsi.zig | 1 - std/special/compiler_rt/fixunsdfsi_test.zig | 2 +- std/special/compiler_rt/fixunsdfti_test.zig | 3 +- std/special/compiler_rt/fixunssfdi_test.zig | 2 +- std/special/compiler_rt/fixunssfsi_test.zig | 2 +- std/special/compiler_rt/fixunssfti.zig | 1 - std/special/compiler_rt/fixunssfti_test.zig | 2 +- std/special/compiler_rt/fixunstfdi_test.zig | 23 +- std/special/compiler_rt/fixunstfsi_test.zig | 6 +- std/special/compiler_rt/fixunstfti.zig | 1 - std/special/compiler_rt/fixunstfti_test.zig | 2 +- std/special/compiler_rt/floattidf.zig | 69 + std/special/compiler_rt/floattidf_test.zig | 84 + std/special/compiler_rt/floattisf.zig | 69 + std/special/compiler_rt/floattisf_test.zig | 60 + std/special/compiler_rt/floattitf.zig | 69 + std/special/compiler_rt/floattitf_test.zig | 96 + std/special/compiler_rt/floatunditf.zig | 28 + std/special/compiler_rt/floatunditf_test.zig | 33 + std/special/compiler_rt/floatunsitf.zig | 29 + std/special/compiler_rt/floatunsitf_test.zig | 29 + std/special/compiler_rt/floatuntidf.zig | 60 + std/special/compiler_rt/floatuntidf_test.zig | 81 + std/special/compiler_rt/floatuntisf.zig | 59 + std/special/compiler_rt/floatuntisf_test.zig | 72 + std/special/compiler_rt/floatuntitf.zig | 60 + std/special/compiler_rt/floatuntitf_test.zig | 99 + std/special/compiler_rt/index.zig | 885 ++++- std/special/compiler_rt/muloti4.zig | 55 + std/special/compiler_rt/muloti4_test.zig | 76 + std/special/compiler_rt/truncXfYf2.zig | 117 + std/special/compiler_rt/truncXfYf2_test.zig | 134 + std/special/compiler_rt/udivmod.zig | 81 +- std/special/compiler_rt/udivmoddi4.zig | 2 +- std/special/compiler_rt/udivmoddi4_test.zig | 2 + std/special/compiler_rt/udivmodti4.zig | 8 +- std/special/compiler_rt/udivmodti4_test.zig | 2 + std/special/compiler_rt/udivti3.zig | 9 +- std/special/compiler_rt/umodti3.zig | 10 +- std/special/panic.zig | 2 +- std/special/test_runner.zig | 20 +- std/unicode.zig | 306 +- std/zig/ast.zig | 3117 ++++++++------- std/zig/bench.zig | 36 + std/zig/index.zig | 11 +- std/zig/parse.zig | 3358 ++++++++++++++++ std/zig/parse_string_literal.zig | 76 + std/zig/parser.zig | 5265 ------------------------- std/zig/parser_test.zig | 1945 ++++++++++ std/zig/render.zig | 2015 ++++++++++ std/zig/tokenizer.zig | 558 ++- test/assemble_and_link.zig | 2 +- test/behavior.zig | 15 + test/build_examples.zig | 16 +- test/cases/align.zig | 141 +- test/cases/alignof.zig | 6 +- test/cases/array.zig | 84 +- test/cases/atomics.zig | 52 +- test/cases/bitcast.zig | 8 +- test/cases/bool.zig | 8 +- test/cases/bugs/1111.zig | 12 + test/cases/bugs/1230.zig | 14 + test/cases/bugs/394.zig | 15 +- test/cases/bugs/655.zig | 6 +- test/cases/bugs/656.zig | 11 +- test/cases/bugs/828.zig | 24 +- test/cases/bugs/920.zig | 65 + test/cases/byval_arg_var.zig | 27 + test/cases/cancel.zig | 92 + test/cases/cast.zig | 262 +- test/cases/const_slice_child.zig | 9 +- test/cases/coroutine_await_struct.zig | 47 + test/cases/coroutines.zig | 108 +- test/cases/defer.zig | 41 +- test/cases/enum.zig | 644 +++- test/cases/enum_with_members.zig | 8 +- test/cases/error.zig | 112 +- test/cases/eval.zig | 279 +- test/cases/field_parent_ptr.zig | 6 +- test/cases/fn.zig | 103 +- test/cases/fn_in_struct_in_comptime.zig | 17 + test/cases/for.zig | 26 +- test/cases/generics.zig | 48 +- test/cases/if.zig | 1 - test/cases/import/a_namespace.zig | 4 +- test/cases/incomplete_struct_param_tld.zig | 12 +- test/cases/ir_block_deps.zig | 4 +- test/cases/math.zig | 203 +- test/cases/merge_error_sets.zig | 21 + test/cases/misc.zig | 303 +- test/cases/namespace_depends_on_compile_var/index.zig | 2 +- test/cases/new_stack_call.zig | 26 + test/cases/null.zig | 86 +- test/cases/optional.zig | 30 + test/cases/pointers.zig | 44 + test/cases/popcount.zig | 24 + test/cases/ref_var_in_if_after_if_2nd_switch_prong.zig | 2 +- test/cases/reflection.zig | 31 +- test/cases/slice.zig | 10 +- test/cases/struct.zig | 131 +- test/cases/struct_contains_null_ptr_itself.zig | 5 +- test/cases/struct_contains_slice_of_itself.zig | 14 +- test/cases/switch.zig | 33 +- test/cases/switch_prong_err_enum.zig | 6 +- test/cases/switch_prong_implicit_cast.zig | 4 +- test/cases/syntax.zig | 8 +- test/cases/this.zig | 4 +- test/cases/try.zig | 5 +- test/cases/type_info.zig | 259 ++ test/cases/undefined.zig | 8 +- test/cases/underscore.zig | 28 + test/cases/union.zig | 139 +- test/cases/var_args.zig | 37 +- test/cases/void.zig | 14 +- test/cases/while.zig | 75 +- test/cases/widening.zig | 27 + test/compare_output.zig | 38 +- test/compile_errors.zig | 3426 ++++++++++++----- test/gen_h.zig | 52 +- test/runtime_safety.zig | 123 +- test/stage2/compare_output.zig | 25 + test/stage2/compile_errors.zig | 30 + test/standalone/brace_expansion/build.zig | 2 +- test/standalone/brace_expansion/main.zig | 38 +- test/standalone/issue_339/build.zig | 2 +- test/standalone/issue_339/test.zig | 5 +- test/standalone/issue_794/build.zig | 2 +- test/standalone/load_dynamic_library/add.zig | 3 + test/standalone/load_dynamic_library/build.zig | 21 + test/standalone/load_dynamic_library/main.zig | 17 + test/standalone/pkg_import/build.zig | 2 +- test/standalone/pkg_import/pkg.zig | 4 +- test/standalone/use_alias/build.zig | 2 +- test/standalone/use_alias/main.zig | 2 +- test/tests.zig | 357 +- test/translate_c.zig | 307 +- 369 files changed, 60719 insertions(+), 20923 deletions(-)