Skip to content

self-hosted parsing std progress #909

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

Closed
14 tasks done
tiehuis opened this issue Apr 11, 2018 · 3 comments
Closed
14 tasks done

self-hosted parsing std progress #909

tiehuis opened this issue Apr 11, 2018 · 3 comments
Milestone

Comments

@tiehuis
Copy link
Member

tiehuis commented Apr 11, 2018

Here is a summary of the remaining items left to parse std using the self-hosted parser. Using the following command:

zig fmt src/**/*.zig on the current master branch: (note: using compiler driver from here, shouldn't matter)

  • std/event.zig
std/event.zig:46:59: error: expected call or fn proto, found InfixOp.
        self.accept_coro = try async<self.loop.allocator> TcpServer.handler(self);
                                                          ~~~~~~~~~
error parsing file 'std/event.zig': error.ParseError
  • std/fmt/index.zig
std/fmt/index.zig:449:28: error: expected RBrace or Identifier, found Keyword_error
const ParseUnsignedError = error {
                           ~~~~~
error parsing file 'std/fmt/index.zig': error.ParseError
  • std/heap.zig
std/heap.zig:121:65: error: expected primary expression, found Keyword_if
                    const new_addr_end_rounded = new_addr_end + if (rem == 0) 0 else (os.page_size - rem);
                                                                ~~
error parsing file 'std/heap.zig': error.ParseError
  • std/io.zig
std/io.zig:284:12: error: expected Semicolon, found Keyword_struct
    return struct {
           ~~~~~~
error parsing file 'std/io.zig': error.ParseError
  • std/math/x86_64/sqrt.zig
std/math/x86_64/sqrt.zig:2:12: error: expected Semicolon, found Keyword_asm
    return asm (
           ~~~
error parsing file 'std/math/x86_64/sqrt.zig': error.ParseError
  • std/os/child_process.zig
std/os/child_process.zig:19:9: error: expected variable declaration or function, found Identifier
    pub pid: if (is_windows) void else i32,
        ~~~
error parsing file 'std/os/child_process.zig': error.ParseError
  • std/os/index.zig
std/os/index.zig:1083:53: error: expected ',' or RBrace, found Equal
            error.AccessDenied => got_access_denied = true,
                                                    ~
error parsing file 'std/os/index.zig': error.ParseError
  • std/os/zen.zig
std/os/zen.zig:180:1: error: expected variable declaration or function, found Keyword_inline
inline fn syscall0(number: Syscall) usize {
~~~~~~
error parsing file 'std/os/zen.zig': error.ParseError
  • std/special/build_runner.zig
std/special/build_runner.zig:200:77: error: expected RBrace or Comma, found Keyword_error
fn usageAndErr(builder: &Builder, already_ran_build: bool, out_stream: var) error {
                                                                            ~~~~~
error parsing file 'std/special/build_runner.zig': error.ParseError
  • std/special/compiler_rt/aulldiv.zig
std/special/compiler_rt/aulldiv.zig:4:9: error: expected StringLiteral, found MultilineStringLiteralLine
        \\.intel_syntax noprefix
        ~~~~~~~~~~~~~~~~~~~~~~~~~
error parsing file 'std/special/compiler_rt/aulldiv.zig': error.ParseError
  • std/special/compiler_rt/aullrem.zig
std/special/compiler_rt/aullrem.zig:4:9: error: expected StringLiteral, found MultilineStringLiteralLine
        \\.intel_syntax noprefix
        ~~~~~~~~~~~~~~~~~~~~~~~~~
error parsing file 'std/special/compiler_rt/aullrem.zig': error.ParseError
  • std/special/compiler_rt/index.zig
std/special/compiler_rt/index.zig:155:9: error: expected StringLiteral, found MultilineStringLiteralLine
        \\ push    { lr }
        ~~~~~~~~~~~~~~~~~~
error parsing file 'std/special/compiler_rt/index.zig': error.ParseError
  • std/zig/parser.zig
std/zig/parser.zig:74:45: error: expected ',' or RBrace, found Equal
                DestPtr.Field => |ptr| *ptr = value,
                                            ~
error parsing file 'std/zig/parser.zig': error.ParseError
  • std/zig/tokenizer.zig
std/zig/tokenizer.zig:1163:51: error: expected primary expression, found Keyword_switch
                std.debug.assert(expected_kind == switch (token.id) { Token.Id.StringLiteral => |kind| kind, else => unreachable });
                                                  ~~~~~~
error parsing file 'std/zig/tokenizer.zig': error.ParseError
@Hejsil
Copy link
Contributor

Hejsil commented Apr 11, 2018

I also think the code for optional expressions in return and friends, should be redone. The current solution produces bad error messages in some cases (see std/io.zig and std/math/x86_64/sqrt.zig). More thoughs here

Hejsil added a commit that referenced this issue Apr 11, 2018
Hejsil added a commit that referenced this issue Apr 11, 2018
Hejsil added a commit that referenced this issue Apr 11, 2018
related: #909
* Struct fields can now be pub
* Parsing of double deref now works
* Block expressions now have the right precedence
@Hejsil
Copy link
Contributor

Hejsil commented Apr 11, 2018

4b0556e also allows parsing of std/io.zig and std/zig/tokenizer.zig

Hejsil added a commit that referenced this issue Apr 11, 2018
This makes `std/os/index.zig` parse
related: #909
Hejsil added a commit that referenced this issue Apr 11, 2018
This allows parsing of `std/zig/parser.zig`. Related: #909
Hejsil added a commit that referenced this issue Apr 11, 2018
Related #909
Allows it to parse `std/special/compiler_rt/aullrem.zig`,
`std/special/compiler_rt/aulldiv.zig` and `std/math/x86_64/sqrt.zig`
Hejsil added a commit that referenced this issue Apr 11, 2018
Related #909
Allows parsing of `std/os/zen.zig`.
Hejsil added a commit that referenced this issue Apr 11, 2018
Related #909
Allowes parsing of `std/os/child_process.zig`
Hejsil added a commit that referenced this issue Apr 11, 2018
Related #909
This allows parsing of `std/special/build_runner.zig`
@andrewrk andrewrk added this to the 0.3.0 milestone Apr 12, 2018
Hejsil added a commit that referenced this issue Apr 12, 2018
Related #909
This allows it to parse `std/special/compiler_rt/index.zig`
@tiehuis
Copy link
Member Author

tiehuis commented Apr 12, 2018

Great work, @Hejsil. With that last commit zig fmt successfully parses all of std!

We can defer style changes to #911.

@tiehuis tiehuis closed this as completed Apr 12, 2018
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

No branches or pull requests

3 participants