Commit Graph

331 Commits (4c03746926562e4e9650eec7c4361836fabba5af)

Author SHA1 Message Date
Andrew Kelley b01c50d6fa find libc and zig std lib at runtime
this removes the following configure options:
 * ZIG_LIBC_LIB_DIR
 * ZIG_LIBC_STATIC_LIB_DIR
 * ZIG_LIBC_INCLUDE_DIR
 * ZIG_DYNAMIC_LINKER
 * ZIG_EACH_LIB_RPATH
 * zig's reliance on CMAKE_INSTALL_PREFIX

these options are still available as command line options, however,
the default will attempt to execute the system's C compiler to
collect system defaults for these values.

closes #870
2018-03-30 17:10:54 -04:00
Andrew Kelley f586acabdc add ZIG_STATIC cmake option
it's not compatible with glibc but it works with musl
2018-03-30 13:20:13 -04:00
Marc Tiehuis 0fd0f6fd1f Rewrite Rand functions
We now use a generic Rand structure which abstracts the core functions
from the backing engine.

The old Mersenne Twister engine is removed and replaced instead with
three alternatives:

 - Pcg32
 - Xoroshiro128+
 - Isaac64

These should provide sufficient coverage for most purposes, including a
CSPRNG using Isaac64. Consumers of the library that do not care about
the actual engine implementation should use DefaultPrng and DefaultCsprng.
2018-03-30 01:50:58 +13:00
Wander Lairson Costa 543952eb87 Include libxml2 and zlib as required libraries
libxml2 is a required library, but we only find out that when the build
fails to link against it, if it is not present. The same for zlib.

We use find_library to find these two libraries and print nice fail
messages if they are not found.
2018-03-20 18:15:02 +00:00
Andrew Kelley f073923ea0 Release 0.2.0 2018-03-15 09:15:05 -04:00
Andrew Kelley 5bc4f1e3f1 xml2 workaround is relevant for linux too 2018-03-10 18:23:08 -05:00
Andrew Kelley e4fd3fd52b workaround for llvm-config missing xml2 2018-03-10 14:48:41 -05:00
Andrew Kelley 5a7a0e8518 update to SoftFloat-3e
closes #823
2018-03-09 15:06:06 -05:00
Andrew Kelley 4955c4b8f9 update C headers to clang 6.0.0rc3 2018-02-23 13:15:16 -05:00
Andrew Kelley 9cfd7dea19 Merge remote-tracking branch 'origin/master' into llvm6 2018-02-23 12:56:41 -05:00
Ben Noordhuis ab48934e9c add support for stack traces on macosx
Add basic address->symbol resolution support.  Uses symtab data from the
MachO image, not external dSYM data; that's left as a future exercise.

The net effect is that we can now map addresses to function names but
not much more.  File names and line number data will have to wait until
a future pull request.

Partially fixes #434.
2018-02-19 23:11:11 +01:00
Andrew Kelley ef6260b3a7 Merge remote-tracking branch 'origin/master' into llvm6 2018-02-11 23:49:20 -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 1fb308ceee self hosted compiler: move tokenization and parsing to std lib 2018-02-09 13:08:02 -05:00
Andrew Kelley aa043a6339 Merge remote-tracking branch 'origin/master' into llvm6 2018-02-07 17:27:30 -05:00
Andrew Kelley 44d8d654a0 fix test failure, organize code, add new compile error 2018-02-05 09:26:39 -05:00
Ben Noordhuis 73ee434c8c Use /dev/urandom and sysctl(RANDOM_UUID) on Linux.
Add fallback paths for when the getrandom(2) system call is not
available.  Try /dev/urandom first and sysctl(RANDOM_UUID) second.

The sysctl issues a warning in the system logs with some kernels but
that seems like an acceptable tradeoff for the fallback of a fallback.
2018-02-04 18:58:36 +01:00
David McFarland 4ec856b0f0 make lld include paths private
This fixes a build failure on cygwin caused by <string.h> -> <strings.h> taking
the latter from one of the lld paths.
2018-02-02 10:49:31 -04:00
Andrew Kelley 4aed7ea6f8 update embedded LLD to 6.0.0rc1 2018-01-17 17:29:21 -05:00
Marc Tiehuis 7a3fd89d25 Add Sha3 hashing functions
These are on the slower side and could be improved. No performance optimizations
yet have been done.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
```

-- Sha3-256

```
Zig --release-fast
    93 Mb/s
Zig --release-safe
    99 Mb/s
Zig
    4 Mb/s
```

-- Sha3-512

```
Zig --release-fast
    49 Mb/s
Zig --release-safe
    54 Mb/s
Zig
    2 Mb/s
```

Interestingly, release-safe is producing slightly better code than
release-fast.
2018-01-17 21:19:45 +13:00
Marc Tiehuis fa7b33549e Change crypto functions to fill a buffer
- Rename blake2x -> blake2
 - Fix blake2s truncated tests
2018-01-17 00:17:48 +13:00
Marc Tiehuis 4cf86b4a94 Add Blake2X hash functions
The truncated output variants currently are dependent on a more complete
bigint implementation in the compiler.
2018-01-15 23:14:13 +13:00
Marc Tiehuis 2659ac01be Add Sha2 functions
We take the fastest time measurement taken across multiple runs. Tested
across multiple compiler flags and the best chosen.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly.

```
Gcc -O2
    219 Mb/s
Clang -O2
    213 Mb/s
Zig --release-fast
    284 Mb/s
Zig --release-safe
    211 Mb/s
Zig
    6 Mb/s
```

```
Gcc -O2
    350 Mb/s
Clang -O2
    354 Mb/s
Zig --release-fast
    426 Mb/s
Zig --release-safe
    300 Mb/s
Zig
    11 Mb/s
```
2018-01-13 22:37:47 +13:00
Marc Tiehuis 51fdbf7f8c Add Md5 and Sha1 hash functions
Some performance comparisons to C.

We take the fastest time measurement taken across multiple runs.

The block hashing functions use the same md5/sha1 methods.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-md5-hash-implementation-in-x86-assembly:

```
gcc -O2
    661 Mb/s
clang -O2
    490 Mb/s
zig --release-fast and zig --release-safe
    570 Mb/s
zig
    50 Mb/s
```

See https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly:

```
gcc -O2
    588 Mb/s
clang -O2
    563 Mb/s
zig --release-fast and zig --release-safe
    610 Mb/s
zig
    21 Mb/s
```

In short, zig provides pretty useful tools for writing this sort of
code. We are in the lead against clang (which uses the same LLVM
backend) with us being slower only against md5 with GCC.
2018-01-13 14:40:21 +13:00
Marc Tiehuis 24cd99160c Add hw sqrt for x86_64 2018-01-10 19:53:36 +13:00
Andrea Orru 3182857224 Adding zen support 2018-01-07 04:43:08 -05:00
Andrew Kelley 1b120d1e49 update windows build to llvm 5.0.1
llvm-config.exe does not handle diaguids.lib for us so we have to
duplicate the work.
2018-01-04 22:46:26 -05:00
Andrew Kelley 5a800db48c build: std files and c header files are only specified once
In the CMakeLists.txt file. And then we communicate the list
to the zig build.
2018-01-03 19:39:04 -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
Josh Wolfe 08dd1b553b set compile flags for zip_cpp 2017-12-26 18:05:43 -07:00
Andrew Kelley 6fece14cfb self-hosted: build against zig_llvm and embedded LLD
Now the self-hosted compiler re-uses the same C++ code for interfacing
with LLVM as the C++ code.
It also links against the same LLD library files.
2017-12-26 19:44:08 -05:00
Andrew Kelley 4183c6f1a5 move std/debug.zig to a subdirectory
self hosted compiler parser tests do some fuzz testing
2017-12-23 22:15:48 -05:00
Andrew Kelley cf96b6f87b update to LLVM 5.0.1rc2 2017-12-01 13:44:28 -05:00
Andrew Kelley 5a25505668 rename "parsec" to "translate-c" 2017-11-24 14:56:05 -05:00
Andrew Kelley 9e234d4208 breaking change to std.io API
* Merge io.InStream and io.OutStream into io.File
 * Introduce io.OutStream and io.InStream interfaces
   - io.File implements both of these
 * Move mem.IncrementingAllocator to heap.IncrementingAllocator

Instead of:

```
%return std.io.stderr.printf("hello\n");
```

now do:

```
std.debug.warn("hello\n");
```

To print to stdout, see `io.getStdOut()`.

 * Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
2017-10-31 04:47:55 -04:00
Andrew Kelley 78cb4ce030 Release 0.1.1 2017-10-17 08:50:00 -04:00
Andrew Kelley 79193ffed2 build: fix logic for version when there is a git tag 2017-10-17 08:47:27 -04:00
Andrew Kelley ad07c68504 Release 0.1.0 2017-10-17 08:42:52 -04:00
Andrew Kelley 1d88f9b9a6 appveyor: build with msvc and publish artifacts
See #540
2017-10-16 12:22:13 -04:00
Andrew Kelley d08c57741a ability to make a DLL
See #302
2017-10-16 01:14:28 -04:00
Andrew Kelley f87f98015c 16MB stack size when building with msvc
fixes crash when evaluating user code that hits the branch limit

See #302
2017-10-15 19:04:19 -04:00
Andrew Kelley 0307dc0b77 organize windows utility functions 2017-10-14 16:59:43 -04:00
Andrew Kelley 1563574740 add git rev name to version string when available 2017-10-01 18:34:22 -04:00
Andrew Kelley 1962c8588f implement standard library path search
closes #463
See #302
2017-10-01 18:30:31 -04:00
Andrew Kelley 9636603a3b fix build when no cmake path args specified
broken by 0227becb56
2017-10-01 16:10:35 -04:00
Andrew Kelley 0227becb56 build: escape backslashes in path arguments given to cmake 2017-10-01 14:01:18 -04:00
Andrew Kelley c6295fe9ab remove zigrt
adds test case for #394

partially reverts a32b5929cc
2017-09-30 20:21:57 -04:00
Andrew Kelley cd58b40011 update C headers to clang 5.0.0 2017-09-30 18:20:55 -04:00
Andrew Kelley 845f22101b zig test on 64-bit windows runs 32-bit tests 2017-09-30 14:40:16 -04:00
Andrew Kelley 5c4504e005 disable /W4 on MSVC 2017-09-30 14:00:27 -04:00
Andrew Kelley 9c6e12ac29 compiler-rt: add _aulldiv and _aullrem for i386 windows 2017-09-30 13:58:05 -04:00
Andrew Kelley cba4a9ad4a update std.os.ChildProcess API
* add std.os.ChildProcess.setUserName
 * add std.os.getUserId
2017-09-26 01:01:49 -04:00
Andrew Kelley 41b588547c improvements to windows support
See #302
2017-09-23 18:46:03 -04:00
Andrew Kelley 14cda27b64 depend on embedded SoftFloat-3d instead of __float128
See #302
See #467
2017-09-14 01:46:47 -04:00
Andrew Kelley 57ea6e8c9f fix up msvc stuff to make it work on linux and macos too 2017-09-13 02:40:02 -04:00
Jonathan Marler 67021e2bff Modified cmake to use LLVM imported packages. 2017-09-11 18:27:41 -06:00
Jonathan Marler 7c81cd30de Add support for MSVC 2017-09-11 09:26:26 -06:00
Andrew Kelley 2c9bdad346 rename parseh to parsec 2017-09-05 22:55:03 -04:00
Andrew Kelley d302ddab08 build: fix embedded LLD build 2017-08-28 03:34:50 -04:00
Andrew Kelley 6c7e975b75 remove remnants of depending on darwin system linker 2017-08-28 03:31:57 -04:00
Andrew Kelley e6b7b8a070 build: use embedded LLD by default 2017-08-28 03:12:23 -04:00
Andrew Kelley ff2c794612 all behavior tests passing for macos
See #273
2017-08-27 05:15:24 -04:00
Andrew Kelley 29a418c9d5 progress toward tests passing on MacOS 2017-08-27 00:11:09 -04:00
Andrew Kelley 33c592e981 make udivmod generic and add tests 2017-08-18 17:20:03 -04:00
Andrew Kelley 51bde26842 add compiler-rt fns: udivmodti4, udivti3, umodti3 2017-08-18 16:26:09 -04:00
Andrew Kelley b73d4f74c2 depend on libquadmath
it seems to be shipped with gcc and clang
2017-08-18 13:13:03 -04:00
Andrew Kelley e63d864c1e add compiler_rt functions for f128
* __letf2
 * __cmptf2
 * __getf2
 * __unordtf2
 * __eqtf2
 * __lttf2
 * __netf2
 * __gttf2
2017-08-17 19:10:15 -04:00
Andrew Kelley 6a98bf3dba compiler_rt implementations for __fixuns* functions
* add u128 and i128 integer types
 * add f128 floating point type
 * implement big integer multiplication (See #405)
2017-08-16 19:07:35 -04:00
Andrew Kelley cf46cd5f2b organize file path of compiler_rt 2017-08-15 07:16:22 -04:00
Marc Tiehuis 3a0bfeb9d2 Fix coverage build command
Seems like this was deleted at some stage.

coverage command works as expected once removed. Do correct me if I've missed something, though.
2017-08-10 19:24:50 +12:00
Andrew Kelley 1268bdfa60 Revert "silence false positives about uninitialized variables"
This reverts commit 3d1a0f2ee9.

breaks build for older compilers
2017-08-06 18:33:30 -04:00
Andrew Kelley 3d1a0f2ee9 silence false positives about uninitialized variables 2017-08-06 18:13:48 -04:00
Andrew Kelley d1e68c3ca8 better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
Andrew Kelley dfa2d11167 fix incorrect install line in cmakelists 2017-06-20 11:10:54 -04:00
Marc Tiehuis aeb12d52b0 Add install targets for math library files 2017-06-20 23:10:50 +12:00
Andrew Kelley 91afdc58d2 update C headers to clang 4.0.0
closes #389
2017-06-16 14:35:00 -04:00
Andrew Kelley 7f0620a20f partial implementation of printing floating point numbers with errol3
also add bitCast builtin function. closes #387
2017-06-14 00:24:25 -04:00
Andrew Kelley 6a93dda3e1 progress toward windows hello world working 2017-06-14 00:04:34 -04:00
Andrew Kelley 199bbb6292 progress toward hello world without libc in windows 2017-06-04 10:08:55 -04:00
Andrew Kelley d8d45908fa building with mingw for windows 2017-05-23 00:26:12 -04:00
Andrew Kelley 29b488245d add setFloatMode builtin and std.math.floor
* skip installing std/rand_test.zig as it's not needed beyond running
   the std lib tests
 * add std.math.floor function
 * add setFloatMode builtin function to choose between
   builtin.FloatMode.Optimized (default) and builtin.FloatMode.Strict
   (Optimized is equivalent to -ffast-math in gcc)
2017-05-20 23:06:32 -04:00
Andrew Kelley 818a0a2629 switch expression - add compile errors
* for duplicate integer value
   * for missing integer values
   * for missing else prong

see #43
2017-05-07 12:07:35 -04:00
Andrew Kelley 5c094d7390 std: rename List to ArrayList and re-organize...
...the exports of std.

closes #356
2017-05-04 14:05:06 -04:00
Andrea Orru 6f66691214 Generic doubly linked list. (#361)
Standard linked list
2017-05-03 14:28:06 -04:00
Andrew Kelley 3a137c6ff0 add Travis CI integration 2017-04-21 13:27:11 -04:00
Andrew Kelley fb492d19eb zig build system supports building a library
See #329

Supporting work:
 * move std.cstr.Buffer0 to std.buffer.Buffer
 * add build.zig to example/shared_library/ and add an automated test
   for it
 * add std.list.List.resizeDown
 * improve std.os.makePath
   - no longer recursive
   - takes into account . and ..
 * add std.os.path.isAbsolute
 * add std.os.path.resolve
 * reimplement std.os.path.dirname
   - no longer requires an allocator
   - handles edge cases correctly
2017-04-21 01:56:12 -04:00
Andrew Kelley 1ff73a8e69 convert parseh tests to zig build system 2017-04-19 16:59:20 -04:00
Andrew Kelley 216e14891e zig build system creates symlinks atomically
* add std.base64
 * add std.os.rename
 * add std.os.atomicSymLink
2017-04-17 19:08:41 -04:00
Andrew Kelley 05b3082121 zig build system: progress toward install and uninstall
also:
 * add std.os.path.join
 * add std.os.deleteFile
2017-04-17 06:47:20 -04:00
Andrew Kelley 2864359950 zig build system writes template build.zig file when none exists
see #204
2017-04-11 06:14:46 -04:00
Andrew Kelley 1c6000d047 zig build system improvements, add some std API
* add std.buf_map.BufMap
 * add std.buf_set.BufSet
 * add std.mem.split
 * zig build system improvements (See #204)
   - automatically parses NIX_CFLAGS_COMPILE and NIX_LDFLAGS
   - add builder.addCIncludePath
   - add builder.addRPath
   - add builder.addLibPath
   - add exe.linkLibrary
2017-04-04 01:52:20 -04:00
Andrew Kelley 72fb2443e0 API for command line args
closes #300
2017-04-04 00:17:24 -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
Josh Wolfe 536c35136a fix cmake finding dependencies for ubuntu 2017-03-29 22:18:12 -07: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 5bc9feb5cb organize std and make import relative to current file
closes #216
2017-03-26 06:39:28 -04:00
Andrew Kelley d6856859d3 improvements for windows and libc integration
* standard library knows if it is linking against libc and will
   sometimes call libc functions in that case instead of providing
   redundant definitions
 * fix infinite loop bug when resolving use declarations
 * allow calling the same C function from different C imports.
   closes #277
 * push more logic from compiler to std/bootstrap.zig
 * standard library provides way to access errno
   closes #274
 * fix compile error in standard library for windows
 * add implementation of getRandomBytes for windows
2017-03-23 02:59:58 -04:00
Andrew Kelley 87bc97daef unify main entry point regardless of whether linking libc
closes #248
2017-03-22 11:26:30 -04:00
Andrew Kelley 7efa2cd81c add --each-lib-rpath option and corresponding config option
This adds an rpath entry for each used dynamic library directory.
This is necessary on some systems such as NixOS.
2017-03-13 13:11:55 -04:00
Andrew Kelley d10bbd28e9 use lld instead of system linker 2017-03-13 11:54:56 -04:00
Andrew Kelley 47f267d25f break off some of std.io into std.fmt, generalize printf
closes #250
2017-03-09 19:12:15 -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 c715309bc5 Merge branch 'master' into ir-merge 2017-01-16 14:23:32 -05:00
Andrew Kelley 0c1800a9c9 fix some stuff when llvm has assertions on 2017-01-13 17:33:19 -05:00
Andrew Kelley 1f6dacbb2f IR: enum init support 2016-12-20 01:50:32 -05:00
Andrew Kelley a71fbe49cb IR: add FnProto instruction 2016-12-18 19:40:26 -05:00
Andrew Kelley e50ced44a2 IR: all structs anonymous 2016-12-18 16:56:50 -05:00
Steve Perkins 4b55966a16 add sort to CMakeLists + std/index 2016-11-03 07:01:40 +00:00
Andrew Kelley d7a2b05a81 IR: introduce concept of lvalues 2016-10-23 00:21:29 -04:00
Andrew Kelley 633781e31d empty function compiles successfully with IR 2016-09-30 20:12:00 -04:00
Andrew Kelley 4e2fa2d15b *WIP* 2016-09-30 02:21:21 -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
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 de7e88c38f build: remove -Wmissing-prototypes
this causes errors with llvm's own h files which we have no control over.
2016-09-06 11:01:51 -04:00
Andrew Kelley 651dc31247 implement null as a literal type 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 0450b73e3e std: add tests for mt32 and mt64 2016-07-28 20:14:57 -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 26718a619c recognize ar program and pass --gc-sections to ld
See #54
2016-05-11 14:44:10 -07:00
Andrew Kelley d92ae20f45 add hashmap to standard library
closes #22
2016-05-09 15:07:38 -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 66ed7a5eb5 beginnings of network standard library code 2016-05-03 20:48:53 -07:00
Andrew Kelley da406cb112 build: add test coverage target 2016-04-23 09:57:38 -07:00
Andrew Kelley 35362f8137 better parsing of C macros
See #88
2016-04-21 15:48:13 -07:00
Andrew Kelley f4c7e1bf49 rearrange standard library a bit 2016-04-18 16:42:56 -07:00
Andrew Kelley a177e30534 compile-time function evaluation of pure functions 2016-04-12 09:35:33 -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 17a36859e7 build: std files each specify install destination 2016-03-01 19:00:03 -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
Andrew Kelley 04cc59be65 update run_tests to work on windows 2016-02-17 20:44:07 -07:00
Andrew Kelley 06398a22d0 back to normal print specifiers
disable warnings for format specifiers on mingw since the
compiler emits bogus warnings
2016-02-16 21:43:38 -07:00
Andrew Kelley 6793548868 fix 64 bit integer printing for mingw
in order to do this I had to turn off -pedantic
2016-02-16 20:21:37 -07:00
Andrew Kelley 984e7d6cc7 first pass at linking on macos 2016-02-15 20:56:52 -07:00
Andrew Kelley 3664e8e4e2 use llvm-config to find llvm include dirs 2016-02-15 15:52:19 -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 2bf6c28bc3 ability to cross compile
hello_libc.zig can produce a windows build
2016-02-11 01:33:27 -07:00
Andrew Kelley 1ff2edf67e add "targets" command to list architectures, oses, abis 2016-02-10 15:41:50 -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 11a0644365 basic support for building a test target 2016-02-03 18:02:01 -07:00
Andrew Kelley fc5ffd32e9 build: prefer llvm-config 2016-02-01 22:38:55 -07:00
Andrew Kelley c7eb8aaec5 build: fix release mode 2016-02-01 15:26:01 -07:00
Andrew Kelley 3f0062d7a9 Merge pull request #100 from MovingtoMars/float_print
basic float printing
2016-01-27 23:46:09 -07:00
MovingtoMars dc08412895 basic float printing 2016-01-28 19:28:43 +13:00
Andrew Kelley 51ab9b03ce Merge remote-tracking branch 'origin/master' 2016-01-27 21:11:53 -07:00
Andrew Kelley b6354ddd5a move AST rendering code to separate file 2016-01-27 21:10:38 -07:00
MovingtoMars 1a913f6bf2 simple malloc and free using mmap 2016-01-28 12:39:02 +13:00
Andrew Kelley 0278468479 upgrade to the libclang C++ API
c_import creates a tmp .h file and parses it with libclang,
reporting any errors found.

See #88
2016-01-27 00:01:49 -07:00
Andrew Kelley 32e2196257 number literal rework 2016-01-21 03:02:25 -07:00
Andrew Kelley 890714b8ca Revert "delete parseh"
This reverts commit 18374ea8f1.
2016-01-18 21:28:54 -07:00
Andrew Kelley 18374ea8f1 delete parseh
we'll have to switch to the clang C++ api anyway
we'll revive this code later
2016-01-15 14:16:07 -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 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 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
Andrew Kelley face8d65a8 parseh: add c header files 2015-12-08 17:51:59 -07:00
Andrew Kelley ad3f98c615 parseh command, parses a C .h file and produces extern decls 2015-12-03 16:00:14 -07:00
Andrew Kelley 257cf09472 colored error messages that tell the source file 2015-12-01 00:50:11 -07:00
Andrew Kelley 55b8472374 refactor code to prepare for multiple files
verbose compiler output is now behind --verbose flag
2015-11-30 20:00:39 -07:00
Josh Wolfe 9e0ff6faa2 factor analysis code out of codegen 2015-11-30 09:14:58 -07:00
Andrew Kelley 4068897b6b rename standalone.cpp to run_tests.cpp 2015-11-27 17:11:03 -07:00
Andrew Kelley 763ce1c485 add tests 2015-11-26 01:29:52 -07:00
Andrew Kelley a1771c76c3 build: improve findllvm script 2015-11-25 11:23:25 -07:00
Andrew Kelley 4fe366dfa6 cleanup 2015-11-24 23:56:35 -07:00
Andrew Kelley baf5167171 fix not using subtarget features 2015-11-24 15:01:37 -07:00
Andrew Kelley fefbee166d hello world example working 2015-11-24 13:51:36 -07:00
Andrew Kelley c2e5d50027 write object file and fix void return type 2015-11-24 13:00:38 -07:00
Andrew Kelley 3b4a2afb65 semantic analysis checks for multiple definitions of functions 2015-11-23 22:47:25 -07:00
Andrew Kelley 6b911f1e94 delete parser generator. let's try recursive descent 2015-11-23 19:21:52 -07:00
Andrew Kelley 775e98be5a experiment with being a linker 2015-11-05 00:05:25 -07:00
Andrew Kelley 174baa49bd progress toward more complex parser gen 2015-11-04 17:15:46 -07:00
Andrew Kelley 7cfceeca2d parser generator beginnings 2015-11-03 22:39:35 -07:00
Andrew Kelley d519ce87dd preprocessor runs once 2015-08-05 21:47:08 -07:00
Andrew Kelley 899c9fe94e read a file 2015-08-05 16:22:21 -07:00
Andrew Kelley 1d554f3161 input output 2015-08-05 15:46:40 -07:00
Andrew Kelley 50f0ed918c link against LLVM 2015-08-05 15:23:15 -07:00