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

Change lexing #191

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft

Change lexing #191

wants to merge 27 commits into from

Conversation

kaleidawave
Copy link
Owner

This will be a long WIP PR to change how lexing works and experiment with some different ideas.

Currently the default mode from the lexer is a lexer in one thread that pushes tokens to a mspc::channel and another thread that reads

A few reasons

Things to change

  • Move away in the lexer emitting tokens. Instead a lexer that the parser requests tokens from
  • Allow the parser to request a different lexer mode based on the state of the parser
  • Avoid intermediate tokens like ) ] } and other things via requested from expect_next.
  • Avoid the peek() buffering system

Others (that might be other prs)

  • Not using owned strings, instead references into a store (that may or may not be the FileSystem map from source-map)
  • Using Vec/&[u8] instead of String/&str, that might reduce overhead in utf8 checker (or whatever)
  • Changing token and AST definitions to be more performant (?)

Opening this as a PR at this early stage to track updates and not lose any progress.

Could use something like grit to automate large API changes?

Again there are better parsers out there now. Not all feature complete and as small. This isn't something that is needed but interesting to experiment with and helps with patterns in the checker

@kaleidawave kaleidawave added bug Something isn't working parser Related to Ezno's syntax parser, AST definitions and output v2 Big updates labels Aug 16, 2024
@Aetherall

This comment was marked as resolved.

@kaleidawave

This comment was marked as resolved.

- Merge in Expression which keeps existing
probably some other improvements as well
- Rearrange `impl ASTNode` block items
- Implementation for tricky handling of arrow functions with return types in ternary conditional expressions
- More fixes and "hole" filling to get more complex files parsing
@kaleidawave
Copy link
Owner Author

Making some more progress on this:

To add back

  • Partial syntax
  • Better errors (some are todos)
  • The constant compilation stuff

To fix

  • Some issues with type annotations being default
  • Renaming some methods
  • Some AST node positions are broken
  • Fuzzing (I think because there are panic!s in place of actual errors)
  • Tests (again maybe positions)

- Comments in switch statements
- `allow_definite_assignment_assertions`
- More errors in places
- A few (still more todo) but better handling in edge cases
- More errors (still non-final)
- Change variant name of `default` TS function for `.d.ts` file
- Refactor some lexer APIs (add `parse_comment_literal`)
- Get parser tests passing
- Remove EMPTY from `bracketed_items_from_reader`
@kaleidawave kaleidawave marked this pull request as ready for review November 19, 2024 11:57
@kaleidawave kaleidawave marked this pull request as draft November 19, 2024 12:05
@kaleidawave kaleidawave added the fuzz-me Runs fuzzing on the current PR label Nov 19, 2024
- Remove a few more `todo!`s
- More clippy fixes
- Clippy
- AST generator
@kaleidawave kaleidawave added the compiler-performance Making parsing / type checking / transformations faster label Nov 22, 2024
- Adjust some identifier checks
- Move import export parts to subdirectory
@kaleidawave kaleidawave removed the compiler-performance Making parsing / type checking / transformations faster label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fuzz-me Runs fuzzing on the current PR parser Related to Ezno's syntax parser, AST definitions and output v2 Big updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants