Skip to content

Implement translation phase 2#7

Open
newcomb-luke wants to merge 2 commits intodevelopfrom
feature/translation-phase-2
Open

Implement translation phase 2#7
newcomb-luke wants to merge 2 commits intodevelopfrom
feature/translation-phase-2

Conversation

@newcomb-luke
Copy link
Copy Markdown
Collaborator

Translation phase 2 is specified as a set of operations on the token stream in the C specification. Translation phase 2 in the spec is described as:
Each instance of a backslash character ( ) immediately followed by a new-line
character is deleted, splicing physical source lines to form logical source lines.
Only the last backslash on any physical source line shall be eligible for being part
of such a splice. A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character before any such
splicing takes place.

In our phase 2, we also remove single-line comments, while multi-line comments are removed during the lexing stage.

@newcomb-luke newcomb-luke changed the base branch from master to develop February 25, 2022 14:30
Comment thread src/lexer/mod.rs
// we had an error or not after lexing is complete
let mut had_error = false;

// This keeps track of if we are in a multi-line comment, which will have to be removed at this
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: long sentence

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.

2 participants