-
Notifications
You must be signed in to change notification settings - Fork 199
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 a parser for profile syntax in wit-bindgen #265
Comments
Would love to help with this if needed! |
Hey @alexcrichton ! I've sketched out a rudimentary BNF grammar for profile syntax:
Where the operators of the grammar are defined as:
So a profile is a collection of zero-or-more Prototype ImplementationAssuming we want to add support for this in the Introduce new tokens to lexer (i.e. Introduce new ASTs for pub struct ProfileAst<'a> {
pub items: Vec<ProfileItem<'a>>,
}
pub enum ProfileItem<'a> {
Import(Import<'a>),
Export(Export<'a>),
Extend(Extend<'a>),
}
pub struct Import<'a> {
docs: Docs<'a>,
name: Id<'a>,
kind: ImportKind,
path: &'a str,
}
enum ImportKind {
ZeroOrMore,
OneOrMore,
}
pub struct Export<'a> {
docs: Docs<'a>,
name: Id<'a>,
kind: ExportKind,
path: &'a str,
}
enum ExportKind {
ZeroOrMore,
OneOrMore,
}
pub struct Extend<'a> {
docs: Docs<'a>,
path: &'a str,
} Omitting the implementations of Also, I'll update the function TestsI was thinking it makes sense to segment the tests into two directories for If this overview/approach makes sense, I'm happy to start prototyping and PR incrementally to the |
Also, I recognize this is the very first step to adding support. Next steps would include a |
I think what you've sketched out seems reasonable but I'm not really the best person to lead and/or review such an implementation. I don't have a broader vision for how Personally I'm wary of tacking on something after-the-fact with the intention that it will eventually be better integrated, I'd ideally prefer to have a vision for how this will all fit together eventually. I don't have such a vision yet, myself. |
Would a good next step be to write up a more-complete |
While that would probably help a little I'm thinking of the broader picture of how everything integrates into the tooling/bindings for each language. To me it's pretty clear how to design the parser and tweaking the syntax isn't really all that hard, the more difficult aspect is plumbing this through to each generator, updating the UX for existing generators, etc. I don't know how all that's going to work out myself. |
Note that the syntax design is underway in the component model repo now. |
Current discussion and design: WebAssembly/component-model#83 |
This is now largely done with the |
No description provided.
The text was updated successfully, but these errors were encountered: