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

R support #382

Open
jimhester opened this issue Nov 14, 2019 · 7 comments
Open

R support #382

jimhester opened this issue Nov 14, 2019 · 7 comments
Labels
enhancement New feature or request help wanted Up for grabs language-support Language support in general (e.g. new languages, etc.)

Comments

@jimhester
Copy link

R is a widely used, growing language often used in Data Science and Statistics.

While it does not have a published formal specification, there is a draft specification that describes lexing and parsing the language.

In the most widely used implementation the parsing is done with a bison parser defined in gram.y.

The lexing rules for R are somewhat complex, but the parsing is relatively straightforward, as generally everything is an expression.

It would very beneficial to the R community to have support for R in semantic!

@XVilka
Copy link

XVilka commented Nov 15, 2019

A first step would be creating a tree sitter grammar for R. See more in their documentation on creating new parsers.
After that, the hardest part begins - implementing the semantic part: https://github.com/github/semantic/blob/master/docs/adding-new-languages.md

@tclem
Copy link
Member

tclem commented Nov 18, 2019

Definitely start with a tree-sitter parser.

After that, the hardest part begins - implementing the semantic part

This is about to get much, much easier as we are almost entirely automating the semantic part. My advise would be to get the tree-sitter grammar in good shape and then check in again with the team so see if we can use the new path for supporting languages in semantic.

@2yz
Copy link

2yz commented Dec 3, 2019

Definitely start with a tree-sitter parser.

After that, the hardest part begins - implementing the semantic part

This is about to get much, much easier as we are almost entirely automating the semantic part. My advise would be to get the tree-sitter grammar in good shape and then check in again with the team so see if we can use the new path for supporting languages in semantic.

Is the new path for supporting languages available soon?

@tclem
Copy link
Member

tclem commented Dec 4, 2019

Is the new path for supporting languages available soon?

I don't have a specific timeline to give you, but you can see an example for java and python of what's required to generate code from the new node-types.json. Obviously part of the work here is to better surface our documentation.

@patrickt patrickt added the language-support Language support in general (e.g. new languages, etc.) label Dec 4, 2019
@robrix robrix added enhancement New feature or request help wanted Up for grabs labels Dec 6, 2019
@XVilka
Copy link

XVilka commented May 9, 2020

Link to the documentation has moved to https://github.com/github/semantic/blob/master/docs/codegen.md

@jimhester
Copy link
Author

Just a small update, I have begun work on a tree sitter parser for R (https://github.com/jimhester/tree-sitter-r)

Only spent a few days on it, but it is already fairly functional, so I could start looking into semnatic support in the near future.

@jimhester
Copy link
Author

The tree sitter parser is now in pretty good shape. I have moved it to https://github.com/r-lib/tree-sitter-r and sent a PR to tree-sitter/haskell-tree-sitter#295. Once that is merged I guess it needs to be pushed to hackage so it can be used in semantic.

Now that #577 has been merged I am a little unclear what the next steps within semantic neend to be. If someone could clarify that for me I would be happy to work on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Up for grabs language-support Language support in general (e.g. new languages, etc.)
Projects
None yet
Development

No branches or pull requests

6 participants