-
Notifications
You must be signed in to change notification settings - Fork 17
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
Get ideas from other projects #99
Comments
There is also https://github.com/dherman/esprit by @dhermann I'll try to set up some benchmarks across the Rust-based parsers to see how Ratel fares. If anything, we can at least be the testbed for performance. |
Thanks for reaching out! I am not sure I am willing to abandon my crates at this point but I think communicating is a key to success. One of the big reasons I started down the rust+js path was because I was looking for some modular crates to pick and choose what part of the process I was trying to work through. For example, if I wanted to transpile from rust to js it would be a lot easier if I could just transform a Modularity being the key here, by having a reader(parser) and a writer(codegen) built around a solid AST you empower the community to build things you might never think of. If someone wanted to write a codegen library that read in Another thing that I have been getting questions about/thinking about is the ability to use your parser to on supersets of js, primarily JSX and typescript. Looking over your crates here (not super thoroughly) I don't see any kind of comment handling mechanism. A number of js dev-tools utilize comments so including a way to communicate them might be valuable. Thanks again for reaching out! |
Aye, modularization is definitely somewhere Ratel has to improve. I've already tried some stuff in the In trait Module<'ast>: Parse<'ast> {
type Statement: Statement<'ast>;
}
trait Statement<'ast>: Parse<'ast> {
type LoopStatement: Statement<'ast>; // For specialization that involves `break` and `continue`
type Expression: Expression<'ast>;
}
trait Expression<'ast>: Parse<'ast> {
type AsyncExpression: Expression<'ast>; // For specialization within async function bodies that permits `await` expressions
} It might be a terrible idea and going the dynamic route might be easier (even if it means that the types permit constructing potentially invalid grammar), but I'm curious what other people think. |
Author of swc here. Can we join our efforts? I've implemented almost all transcompilers in swc, but it's quite slow. So I want to make it fast, or merge it into ratel. |
@kdy1 I'd be more than happy to join, I also don't particularly care about branding so the merge can be either way. I'd say have a look at the AST on |
Currently ratel's span does not contain hygiene information. swc use span hygiene to implement block scoping. hygiene based variable mangement makes implementing other passes simple. They can just declare a variable named Also note that swc uses rustc's libsyntax internally which is quite heavy, so I think right way to go is merging swc into ratel and droping the dependency. |
I'm hoping to look into adding hygiene to the AST today. My idea would be to create a new |
Does ratel targets stable rust? It's (currently) done by putting Also note that rustc is quite good at optimizing the visitor. |
I'm not sure specialization based visitor is a good idea. Specialization is a very hot topic currently, and whether and how it would be stabilized is uncertain. I'd prefer the traditional approach utilizing hardcoded trait methods. If you are concerned about optimization, would you mind benchmarking both specialization based method and the one without? |
I'll just go with traditional one. I thought there's no way to visit |
There are several other Rust projects (some launched recently) that deals with JavaScript sources. Let's see if we can get some ideas from their design.
https://github.com/nathan/pax by @nathan
https://github.com/swc-project/swc by @kdy1
https://github.com/FreeMasen/RESS by @FreeMasen
On this thread, let's focus on differences or ideas on:
Library authors: are you interested in joining force with Ratel? Are there anything on library design that we should change? (Pardon this friendly ping, sorry if you get annoyed by a notification. Feel free to unsubscribe in any case.)
The text was updated successfully, but these errors were encountered: