forked from sorbet/sorbet
-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Exploration] Translate Prism nodes directly into AST::Expression
nodes
#238
Draft
amomchilov
wants to merge
152
commits into
prism
Choose a base branch
from
Alex/translate-into-ast-expr
base: prism
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of listing all the `srcs` and `hdrs` for the Prism C library, use a glob to pull all `.c` and `.h` files, excluding the ones that are generated by the genrule so that we can specify that the library depends on that genrule without listing those files twice.
…et or prism If `--parser=prism`, diverge in the `pipeline.cc` file and run a separate method that parses the source with prism.
This involves setting up a `convertPrismToSorbet` method that checks against every possible node type. Program and Statements are basically skipped because Sorbet doesn't use them, and then Integer is converted from a prism node to a Sorbet node. Co-authored-by: Vinicius Stock <[email protected]>
1. Add a new test suite that only tests files in the `test/prism_regression` folder 2. Modify Sorbet's test code to allow the user to specify a parser 3. Add logic to the pipeline test runner to call `runPrismParser` when specified
Sorbet constructs slightly different ASTs depending on whether a program contains one statement or more than one statements. Correctly parsing programs with more than one statement will make it easier to benchmark this project.
In order to compare the performance of Prism with the Sorbet parser, we need to be able to stop AST generation after Prism has run and before we translate the Prism AST into the Sorbet AST.
These benchmarks will help us measure the progress of the prism in Sorbet project. While they can be run from any machine, for "official" results, they should be run on an AWS bare metal instance. Results should be added to the prism_benchmarks/data directory.
Relocate it to the `PM_STATEMENTS_NODE` case so it can be reused by multiple parent nodes.
Implement Prism -> Sorbet translation for index assign nodes
Implement missed translations for anonymous `*`, `**` and `&` params
And use the template on all nodes where we create an `Assign` Sorbet node.
Implement Prism -> Sorbet translation for `PM_CONSTANT_WRITE_NODE`
Implement translation for `PM_CONSTANT_PATH_WRITE_NODE`
It was still a copy of `def_kw_rest_params`, and were still testing method defs, not calls.
Implement Prism -> Sorbet translation for anonymous Array and Hash splats
Implement Prism -> Sorbet translation for `it` keyword
amomchilov
force-pushed
the
Alex/translate-into-ast-expr
branch
from
September 16, 2024 16:49
f451f7b
to
c833b4b
Compare
amomchilov
commented
Sep 16, 2024
// A Whitequark node which wraps a Prism node, for use during our migration to Prism. | ||
class WrappedPrismNode : public WhitequarkNode { | ||
public: | ||
WrappedPrismNode(Prism::Node node) : WhitequarkNode(node.getLoc()) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./parser/prism/WrappedPrismNode.h:23:22: error: use of undeclared identifier 'Prism'
WrappedPrismNode(Prism::Node node) : WhitequarkNode(node.getLoc()) {}
^
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Test plan
See included automated tests.