Skip to content

rewrite the stage2 parser to be recursive and adhere to the official grammar #1729

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
andrewrk opened this issue Nov 16, 2018 · 2 comments · Fixed by #2405
Closed

rewrite the stage2 parser to be recursive and adhere to the official grammar #1729

andrewrk opened this issue Nov 16, 2018 · 2 comments · Fixed by #2405
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

I'm creating this issue in case any contributors want to take a stab at it.

Now that @Hejsil created the formal grammar, and now that we know recursion is OK, there are 2 things that need to happen to std/zig/parse.zig:

  • rewrite it in recursive style so that it is easier to maintain
  • adhere to the formal grammar

It's a fairly large project, that will probably take a couple weeks for someone who isn't already familiar with the parser to do. You can look at src/parser.cpp and almost directly port the code.

@andrewrk andrewrk added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Nov 16, 2018
@andrewrk andrewrk added this to the 0.5.0 milestone Nov 16, 2018
@rayonix
Copy link

rayonix commented Apr 28, 2019

Has anyone started working on this rewrite? I have started looking at it but wanted to check. I'm new to Zig and thought this might be a good way to understand the compiler and language.

Also, is there any new information that would be helpful or important to know?

@hryx
Copy link
Contributor

hryx commented Apr 28, 2019

Hi @rayonix,

I already have a branch for this change with significant progress: master...hryx:stage2-recursive-parser

It's close to done, though I haven't opened a pull request yet; I'm aiming to do so by tomorrow or next week. If you want to take a look, comments are welcome, even before the PR is ready!

There are several other issues which would be good for newcomers, though I don't have any particular recommendations — someone else might.

@hryx hryx mentioned this issue May 2, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants