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

Tracking issue for "Compiler walkthrough" section #1062

Open
4 of 7 tasks
camelid opened this issue Feb 18, 2021 · 6 comments
Open
4 of 7 tasks

Tracking issue for "Compiler walkthrough" section #1062

camelid opened this issue Feb 18, 2021 · 6 comments
Labels
C-tracking-issue Category: issues that track things E-hard Difficulty: might require advanced knowledge T-compiler Relevant to compiler team X-workthrough Effort: compiler walkthrough

Comments

@camelid
Copy link
Member

camelid commented Feb 18, 2021

@camelid camelid changed the title "Compiler walkthrough" section Tracking issue for "Compiler walkthrough" section Feb 18, 2021
@camelid
Copy link
Member Author

camelid commented Feb 18, 2021

As we discussed in the meeting, we're going to show each pass of the compiler,
each intermediate representation (before & after pass), and some internal data
structures (like TyCtxt).

However, we're going to start with just showing tokens, AST, and HIR (with no
internal data structures) going through the passes of lex, parse, resolve, and
macro-expand, which are actually interleaved together:

lex -> (parse <-> resolve <-> expand)

We're going to start with this example code (I modified it
slightly to use @LeSeulArtichaut's name suggestion, and to change String to
&str, which is more idiomatic and will let us show lifetimes in action):

fn is_awesome(name: &str) -> bool {
    matches!(name, "Rust" | "Ferris")
}

(See the Zulip discussion for details on why we chose this example.)

@camelid
Copy link
Member Author

camelid commented Mar 3, 2021

  • Implement (an MVP of) -Z dump-internal-data [@camelid]

What do you think would be a good MVP for -Z dump-internal-data? Maybe print the type of everything in the program?

@LeSeulArtichaut
Copy link
Contributor

LeSeulArtichaut commented Mar 3, 2021

"Internal data" is very broad. Let's maybe try to make a list of all the things we would like to be able to dump?

@camelid
Copy link
Member Author

camelid commented Mar 3, 2021

Sounds like a good idea :)

@LeSeulArtichaut
Copy link
Contributor

Opened https://rust-lang.zulipchat.com/#narrow/stream/196385-t-compiler.2Fwg-rustc-dev-guide/topic/-Z.20dump-internal-data for discussion about -Z dump-internal-data

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 4, 2021
…storino

Add `-Z unpretty` flags for the AST

Implements rust-lang/compiler-team#408.
Builds on rust-lang#82269, but if that PR is rejected or stalls out, I can implement this without rust-lang#82269.
cc rust-lang/rustc-dev-guide#1062
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 4, 2021
…orino

Add `-Z unpretty` flags for the AST

Implements rust-lang/compiler-team#408.
Builds on rust-lang#82269, but if that PR is rejected or stalls out, I can implement this without rust-lang#82269.
cc rust-lang/rustc-dev-guide#1062
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 11, 2021
…astorino

Add `-Z unpretty` flag for the THIR

This adds a new perma-unstable flag, `-Zunpretty=thir-tree`, that dumps the raw THIR tree for each body in the crate.

Implements the THIR part of MCP rust-lang/compiler-team#408, helps with rust-lang/rustc-dev-guide#1062.
Depends on rust-lang#82495, blocked on that. Only the two last commits are added by this PR.
r? `@spastorino` cc `@estebank`
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 11, 2021
…astorino

Add `-Z unpretty` flag for the THIR

This adds a new perma-unstable flag, `-Zunpretty=thir-tree`, that dumps the raw THIR tree for each body in the crate.

Implements the THIR part of MCP rust-lang/compiler-team#408, helps with rust-lang/rustc-dev-guide#1062.
Depends on rust-lang#82495, blocked on that. Only the two last commits are added by this PR.
r? ``@spastorino`` cc ``@estebank``
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 11, 2021
…astorino

Add `-Z unpretty` flag for the THIR

This adds a new perma-unstable flag, `-Zunpretty=thir-tree`, that dumps the raw THIR tree for each body in the crate.

Implements the THIR part of MCP rust-lang/compiler-team#408, helps with rust-lang/rustc-dev-guide#1062.
Depends on rust-lang#82495, blocked on that. Only the two last commits are added by this PR.
r? ```@spastorino``` cc ```@estebank```
@jieyouxu jieyouxu added C-tracking-issue Category: issues that track things T-compiler Relevant to compiler team X-workthrough Effort: compiler walkthrough E-hard Difficulty: might require advanced knowledge labels Nov 2, 2024
@LorrensP-2158466
Copy link

Hi, I just stumbled on this issue because i wanted to look at the ast in rust playground and noticed that this looks forgotten. -Zunpretty=ast is implemented: rust-lang/rust#82304, so i think the ast option can be looked at again.

Is it possible that rust-lang/rust-playground#722 can be looked at and possibly merged? It is 3 years ago, so it may be possible that someone needs to implement it again.
I don't know the specifics of this repo but if allowed and needed i can try to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: issues that track things E-hard Difficulty: might require advanced knowledge T-compiler Relevant to compiler team X-workthrough Effort: compiler walkthrough
Projects
None yet
Development

No branches or pull requests

4 participants