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

Grammar Improvements #175

Closed
NeuralCoder3 opened this issue Jan 17, 2023 · 1 comment
Closed

Grammar Improvements #175

NeuralCoder3 opened this issue Jan 17, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@NeuralCoder3
Copy link
Collaborator

https://anydsl.github.io/thorin2/langref.html

The grammar seems to contain mistakes:

  • The rule I for index literal is never used
  • pack and array expressions contain i but this does not mean import here
  • v is used but never declared
  • The precedence rules seem to be not complete
  • s+ in g is confusing as s is optional X?+ = X*
  • The precedence rules list Π Sym : e does this refer to .Pi Sym ( : etype )? , edom n? (can be confused with Π b → ecodom) => unicodes should be used consistently
  • I think more rules are unused that I did not catch
@NeuralCoder3 NeuralCoder3 added the documentation Improvements or additions to documentation label Jan 17, 2023
@NeuralCoder3
Copy link
Collaborator Author

NeuralCoder3 commented Jan 23, 2023

Maybe a good solution would be to write the grammar as tree-sitter (https://github.com/NeuralCoder3/tree-sitter-thorin)
and generate the document from it.

The tree-sitter grammar can be automatically tested (e.g. to parse the lit tests) and allows additional uses such as

  • syntax highlighting in IDEs
  • intelligent auto-completion
  • linting
  • code folding
  • auto-formatting
  • find variable declaration/usages (structure navigation)

@leissa leissa mentioned this issue Jan 31, 2023
leissa added a commit that referenced this issue Apr 25, 2023
addresses some of the issues from #175
@leissa leissa closed this as completed in 84766eb May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant