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

Document the process for increasing language support #126

Closed
robrix opened this issue Jun 12, 2019 · 9 comments
Closed

Document the process for increasing language support #126

robrix opened this issue Jun 12, 2019 · 9 comments
Labels
documentation communicate to other humans language-support Language support in general (e.g. new languages, etc.)

Comments

@robrix
Copy link
Contributor

robrix commented Jun 12, 2019

We’re getting interest in adding support for languages, so we should document the overall process.

Given that we’re migrating away from using assignment &c., I think we should explicitly leave that out (tho prolly we should note that we don’t support diffing for the new-style grammar-derived ASTs just yet).

I think that makes the steps something like:

  1. Make a tree-sitter parser (link to tree-sitter docs)
  2. Add the parser to haskell-tree-sitter (link to an example PR?)
  3. Add the parser to semantic
  4. (Potentially) implement compilation to Core & build/generate a prelude

We should also be careful to document what you get with each step. Like, the first one gives you Atom support, the second & third give you semantic support (modulo any generic functionality we haven’t implemented yet), and the fourth gives you full analysis support.

@robrix robrix added the documentation communicate to other humans label Jun 12, 2019
@robrix
Copy link
Contributor Author

robrix commented Jun 12, 2019

cc @shaziyabandukia

@robrix robrix mentioned this issue Jun 12, 2019
@robrix robrix added the language-support Language support in general (e.g. new languages, etc.) label Jun 12, 2019
@patrickt
Copy link
Contributor

I think that we should mention assignment, at least for now, since we’re still several months away from the new-style grammar-derived ASTs – if only to impress on people that adding new languages is, for now, a lot of work.

patrickt added a commit that referenced this issue Jun 12, 2019
Took a first stab at this. I described the addition process in terms
of how it is now, rather than how it will be when we compile
tree-sitter ASTs directly into Core. I anticipate that this will
impress upon the public the amount of work required to add a new
language, and hopefully encourage people to wait until the new
generation of AST parsing lands before they invest a ton of time into
what will be a deprecated code path.
@robrix
Copy link
Contributor Author

robrix commented Jun 12, 2019

I think that we should mention assignment, at least for now, since we’re still several months away from the new-style grammar-derived ASTs – if only to impress on people that adding new languages is, for now, a lot of work.

Fair point. Can we at least say “please don’t do this to yourself”? 😊

@damieng
Copy link

damieng commented Jun 12, 2019

Are these new style AST's not based on tree-sitter? I got about 50% through a C# grammar when I worked on the Atom team I'd be keen on picking back up if it'll be used on GitHub for this but obviously don't want to waste effort if something new is in the pipeline.

@patrickt
Copy link
Contributor

@damieng The new-style ASTs will be based on tree-sitter, so we’ll still need a tree-sitter-c# grammar/package: indeed, we'll generate Haskell type definitions generated directly from the tree-sitter grammar. What will change is that the internal sum-of-products AST representation (see Data.Term and Language.Syntax.*) will be obviated, as we’ll instead translate the new-style ASTs directly into Data.Core expressions (from semantic-core).

@robrix
Copy link
Contributor Author

robrix commented Jun 12, 2019

The TH code to generate the datatypes is already on haskell-tree-sitter’s master, and cf tree-sitter/haskell-tree-sitter#144 for @aymannadeem’s work on building said ASTs from tree-sitter parses.

@robrix
Copy link
Contributor Author

robrix commented Jun 12, 2019

What will change is that the internal sum-of-products AST representation (see Data.Term and Language.Syntax.*) will be obviated, as we’ll instead translate the new-style ASTs directly into Data.Core expressions (from semantic-core).

Note that non-analytical (i.e. syntactic rather than truly semantic) computations won’t need this last step, as we should be able to e.g. diff generically over the new ASTs too (once we get that far).

@patrickt
Copy link
Contributor

Tracking in #131

patrickt added a commit that referenced this issue Jun 14, 2019
Document the process of adding new languages. (#126)
@patrickt
Copy link
Contributor

Fixed with #131.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation communicate to other humans language-support Language support in general (e.g. new languages, etc.)
Projects
Status: Done
Development

No branches or pull requests

3 participants