Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skeleton stage 2 support for 'zig build' #865

Merged
merged 2 commits into from Mar 29, 2018
Merged

skeleton stage 2 support for 'zig build' #865

merged 2 commits into from Mar 29, 2018

Conversation

bnoordhuis
Copy link
Contributor

Initial port of the 'zig build' logic from the stage 1 compiler to the
stage 2 compiler sans code generation and BUILD_INFO support.

Hope this is useful. Thought I'd get the ball rolling.

Make the stage 1 compiler exit with a non-zero status code
when `zig build --init` cannot create a new build.zig file.
Initial port of the 'zig build' logic from the stage 1 compiler to the
stage 2 compiler sans code generation and BUILD_INFO support.
@andrewrk andrewrk merged commit 5627347 into ziglang:master Mar 29, 2018
@andrewrk
Copy link
Member

Sweet, thanks!

If you're looking for more places to contribute to the self-hosted compiler, I think the first step is finishing the tokenizer and parser.

  • std/zig/tokenizer.zig
  • std/zig/parser.zig

At the bottom of std/zig/parser.zig there are "zig fmt" tests - that is, it tests tokenizing, parsing, and then rendering back again. This tests what will be the zig fmt command used to re-format code - so it preserves comments and up to 1 extra newline. So the test cases are in the canonical source form.

One big milestone for the self-hosted parser will be ability to parse and render all of std/* and test/*. I've been running std lib files through the parser, and then creating a "zig fmt" test case for the first parse error that occurs.

One thing going on right now is that the expression parsing code is kind of confusing. @thejoshwolfe had a cool idea for how expression parsing can work and then started an implementaion, but then got really busy, and I don't fully understand how it works. So I might rework it to be closer to the existing recursive descent design (except with a state machine instead of recursion).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants