-
Notifications
You must be signed in to change notification settings - Fork 515
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
WIP: Started working on the Parser #21
Conversation
src/the-parser.md
Outdated
|
||
- lexical analysis - turn a stream of characters into a stream of token trees | ||
- macro expansion - run `proc-macros` and expand `macro_rules` macros | ||
- parsing - turn the token trees into an AST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I think I would link to the relevant chapter of the guide -- oh, wait, do we not have a chapter for the AST? We should add one =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the AST would fall under the parser section, maybe as a short sub-chapter.
src/the-parser.md
Outdated
|
||
The parser is responsible for converting raw Rust source code into a structured | ||
form which is easier for the compiler to work with, usually called an *Abstract | ||
Syntax Tree*. The bulk of the parser lives in the [libsyntax] crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to wikipedia? Maybe pointless?
I just added another commit which points out a couple of (what I perceive to be) the key players in What things would someone need to know when either working on the parser or trying to use the parser (e.g. because you're using |
Yeah, that's tricky. For now let's do that. Eventually rustdoc would probably be better.
Hmm, good question. I imagine it'd be good to look at a few PRs that modified the parser to see what they had to do. Actually, it might be worth just including a link to those PRs in the guide to help people get oriented. rust-lang/rust#45047 is such a PR, and here is a link to some of the relevant content. Some things immediately jump out as worth explaining:
|
This is the first instalment towards #13. I'm planning to do a quick high-level overview of the parser and
libsyntax
and mentioning the major players (Parser
,ParseSess
, etc) and what they do.