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

Language Extensions #120

Open
jamiebuilds opened this issue Sep 12, 2017 · 0 comments
Open

Language Extensions #120

jamiebuilds opened this issue Sep 12, 2017 · 0 comments

Comments

@jamiebuilds
Copy link

Much of the tooling in the ecosystem needs to work with language extensions like JSX and Flow, and forks like TypeScript.

Shift is really nice to work with, but is limited to things that have been accepted into ECMAScript. It would be nice if it could make room for extensions to exist much like ESTree does and document them.

Even further than that I was hoping Shift could make some relatively simple changes to make room for a better ASTs for Flow and TypeScript...


<aside>

For example, adding a ClassExtends node would help a lot:

// before
ClassDeclaration {
  super: Expression
  superTypeArguments: TypeArguments // extension
}
// after
ClassDeclaration {
  super: ClassExtends {
    expression: Expression
    typeArguments: TypeArguments // extension
  }
}

This would really useful because ClassExtends could have the same implemented interface "ExpressionWithTypeArguments" as stuff like ClassImplements and InterfaceExtends and GenericType which would otherwise be totally separate cases to handle.

In terms of the changes to Shift, it would just be adding an "extra" node type with a single property expression, but would make for a much nicer AST when working with types.

</aside>


I'm writing a spec for an AST right now that unifies Flow and TypeScript into something really nice to work with. It builds upon a lot of the work in Shift and trying to keep up some of the design decisions.

If people would be up for it, I would love to make specific requests for extension points in the Shift AST which can be discussed individually.

Thoughts?

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

No branches or pull requests

1 participant