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

Make it easier to define high-level ASTs? #136

Open
oxalica opened this issue Jul 21, 2022 · 0 comments
Open

Make it easier to define high-level ASTs? #136

oxalica opened this issue Jul 21, 2022 · 0 comments

Comments

@oxalica
Copy link

oxalica commented Jul 21, 2022

Currently we provides traits and auxiliary functions in rowan::ast, but it's still difficult to use.

  • In the example, we define ASTs using a custom macro.
    ast_node!(Root, ROOT);
    ast_node!(Atom, ATOM);
    ast_node!(List, LIST);
  • In rust-analyzer, we even use code generation to produce a 4.8k lines file crates/syntax/src/ast/generated/nodes.rs.

Could we make it easier to define ASTs and child extractors?
Maybe using some DSL with proc-macros or build.rs for generation?

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

No branches or pull requests

1 participant