zig/src-self-hosted
Andrew Kelley 89763c9a0d
stage1 is now a hybrid of C++ and Zig
This modifies the build process of Zig to put all of the source files
into libcompiler.a, except main.cpp and userland.cpp.

Next, the build process links main.cpp, userland.cpp, and libcompiler.a
into zig1. userland.cpp is a shim for functions that will later be
replaced with self-hosted implementations.

Next, the build process uses zig1 to build src-self-hosted/stage1.zig
into libuserland.a, which does not depend on any of the things that
are shimmed in userland.cpp, such as translate-c.

Finally, the build process re-links main.cpp and libcompiler.a, except
with libuserland.a instead of userland.cpp. Now the shims are replaced
with .zig code. This provides all of the Zig standard library to the
stage1 C++ compiler, and enables us to move certain things to userland,
such as translate-c.

As a proof of concept I have made the `zig zen` command use text defined
in userland. I added `zig translate-c-2` which is a work-in-progress
reimplementation of translate-c in userland, which currently calls
`std.debug.panic("unimplemented")` and you can see the stack trace makes
it all the way back into the C++ main() function (Thanks LemonBoy for
improving that!).

This could potentially let us move other things into userland, such as
hashing algorithms, the entire cache system, .d file parsing, pretty
much anything that libuserland.a itself doesn't need to depend on.

This can also let us have `zig fmt` in stage1 without the overhead
of child process execution, and without the initial compilation delay
before it gets cached.

See #1964
2019-04-16 19:12:20 -04:00
..
arg.zig std.debug.assert: remove special case for test builds 2019-02-08 18:23:38 -05:00
c.zig self-hosted: share C++ code for finding libc on windows 2018-07-20 23:38:13 -04:00
c_int.zig New Zig formal grammar (#1685) 2018-11-13 05:08:37 -08:00
codegen.zig add compile error for ignoring error 2019-03-23 19:33:00 -04:00
compilation.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
decl.zig New Zig formal grammar (#1685) 2018-11-13 05:08:37 -08:00
errmsg.zig `std.mem.Allocator.create` replaced with better API 2019-02-03 16:13:28 -05:00
introspect.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
ir.zig introduce the enum literal type 2019-03-24 00:44:18 -04:00
libc_installation.zig fix regressions on Windows 2019-02-26 16:24:32 -05:00
link.zig breaking changes to the way targets work in zig 2019-02-26 15:58:10 -05:00
llvm.zig stage2: fix llvm.zig with opaque types back to single-item pointer 2019-02-14 23:17:11 -05:00
main.zig stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
package.zig `std.mem.Allocator.create` replaced with better API 2019-02-03 16:13:28 -05:00
scope.zig fix implicit cast error unions with non-optional to optional pointer 2019-02-14 15:48:28 -05:00
stage1.zig stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
target.zig stage2: update for changes regarding sub-architecture 2019-02-28 14:10:45 -05:00
test.zig std.debug.assert: remove special case for test builds 2019-02-08 18:23:38 -05:00
translate_c.zig stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
type.zig introduce the enum literal type 2019-03-24 00:44:18 -04:00
value.zig Pack big.Int sign and length fields 2019-04-11 19:36:35 +12:00
visib.zig New Zig formal grammar (#1685) 2018-11-13 05:08:37 -08:00