Skip to content

Conversation

@kddnewton
Copy link
Member

This is an experimental SyntaxTree::Translation.to_parser API that will translate the Syntax Tree syntax tree into the whitequark/parser gem syntax tree.

This is the beginning of this work and not fully complete, because the nodes need their correct location information in order to be useful, which we only have for a couple of nodes. (See the visit_vcall node for what it should look like for all nodes.)

This change also vendors the parser gem in the test suite in order to use its own test suite to test the translation. I'm not sure I'm going to keep it - it might be better to extract the test suite in a rake task. So for now this is going to stay unreleased until I decide the right way to move forward.

@kddnewton kddnewton force-pushed the parser-translation branch 7 times, most recently from 91d8257 to 1539246 Compare January 30, 2023 15:12
@kddnewton kddnewton merged commit 2966122 into main Jan 30, 2023
@kddnewton kddnewton deleted the parser-translation branch January 30, 2023 15:25
@faraazahmad
Copy link

I'm just trying to understand, when you say the nodes need their correct location in order to be useful, why is that so? do syntax_tree nodes need to add the node's location from the source? I was under the assumption they were already in there

@kddnewton
Copy link
Member Author

@faraazahmad I wrote up a bunch more information here: #276

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

Successfully merging this pull request may close these issues.

3 participants