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

Implement Lexer using PLY. #2

Closed
aalhour opened this issue May 23, 2016 · 5 comments
Closed

Implement Lexer using PLY. #2

aalhour opened this issue May 23, 2016 · 5 comments

Comments

@aalhour
Copy link
Owner

aalhour commented May 23, 2016

Lexer Implementation Notes:

  • Design the Lexer as an isolated component.
  • Implement Lexical analysis using PLY to tokenize COOL programs source code.
  • Return list of tokens for every input program source code.
@aalhour aalhour added the todo label May 23, 2016
@aalhour aalhour changed the title Implement Lexer via PLY. Implement Lexer using PLY. May 23, 2016
@aalhour aalhour added this to the Complete Compiler Frontend milestone May 23, 2016
@aalhour
Copy link
Owner Author

aalhour commented May 24, 2016

Lexer (/PyCOOLC/lexer.py) was implemented. Some of the missing tokens are:

  • (* and *): for matching multi-lines comments.
  • --: for matching single lines comments.

@aalhour
Copy link
Owner Author

aalhour commented May 24, 2016

More missing tokens: loop, pool, Int, String, Object, SELF_TYPE, let, in, ~, <-.

@aalhour
Copy link
Owner Author

aalhour commented May 25, 2016

Implemented all the missing tokens reported in previous comments. The Lexer is ready.

@aalhour aalhour closed this as completed May 25, 2016
@aalhour aalhour reopened this May 26, 2016
@aalhour
Copy link
Owner Author

aalhour commented May 26, 2016

Parser fails at parsing TYPEs in the source code. A Type is any user defined Class or builtin Class in COOL.

The regular expression for ID Token Rule should be modified to consider only Identifiers with a leading lowercase alphabetical letter or an underscore (_) to be an ID Token and all other identifiers that start with a leading uppercase alphabetical character to be a Type. The checks for IDs and TYPEs should also be secondary to checks against the reserved keywords map.

@aalhour
Copy link
Owner Author

aalhour commented May 26, 2016

TYPE Rule was added to the Lexer as a complex lexing token rule and as a Token Type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant