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

lex: advancement in lexer development #9

Merged
merged 2 commits into from
Aug 14, 2024
Merged

Conversation

FedericoBruzzone
Copy link
Contributor

@FedericoBruzzone FedericoBruzzone commented Aug 14, 2024

  • Split the literal token kind multiple parts
  • Handle the str var init

@FedericoBruzzone FedericoBruzzone changed the title lex: split literal token kind lex: advancement in lexer development Aug 14, 2024
Bool(bool),
Char(char),
}
const DOUBLE_TICK: &str = "\"";
Copy link
Collaborator

Choose a reason for hiding this comment

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

In english is called quotation mark or similar :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, I can call it DOUBLE_QUOTE but for consistency we should rename the TICK to SINGLE_QUOTE.
What do you think about it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok make sense

{ "kind": "TokenIdentifier", "lexeme": "x", "location": { "file_path": "", "line": 1, "column_start": 0, "column_end": 1 } },
{ "kind": "TokenWord", "lexeme": "x", "location": { "file_path": "", "line": 1, "column_start": 0, "column_end": 1 } },
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is actually an identifier

Copy link
Contributor Author

@FedericoBruzzone FedericoBruzzone Aug 14, 2024

Choose a reason for hiding this comment

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

In the lexer we should find a name for all the words.
You know that this is an identifier because of its position.

For instance, a word (or multiple words) between " or ' is not an identifier, but and we have called this word so far Identifier.

Copy link
Collaborator

Choose a reason for hiding this comment

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

var x = 10 -> x identifier
var y = "x" -> x is a word/string and Y identifier

I mean, word is a bit useless

@FedericoBruzzone FedericoBruzzone deleted the lex-fix-lit branch August 14, 2024 10:00
@FedericoBruzzone FedericoBruzzone restored the lex-fix-lit branch August 14, 2024 10:00
@FedericoBruzzone FedericoBruzzone merged commit 4657cfa into main Aug 14, 2024
18 checks passed
@FedericoBruzzone FedericoBruzzone deleted the lex-fix-lit branch August 23, 2024 13:35
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