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

Python tree sitter: Loops #498

Closed
Tracked by #489
titomeister opened this issue Sep 20, 2023 · 0 comments · Fixed by #745
Closed
Tracked by #489

Python tree sitter: Loops #498

titomeister opened this issue Sep 20, 2023 · 0 comments · Fixed by #745
Assignees
Labels

Comments

@titomeister
Copy link
Contributor

As part of porting the PyAST2CAST generation to tree-sitter, we've decided to split the porting to smaller pieces.

This issue involves adding more functionality to the python tree sitter:

  • Getting end-to-end (Source to GroMEt) generation for loop structures (For and While loops)
  • Writing tests to make sure the generation is consistent
@titomeister titomeister self-assigned this Sep 20, 2023
@titomeister titomeister added this to the [DARPA] Milestone 10 milestone Sep 28, 2023
myedibleenso pushed a commit that referenced this issue Jan 12, 2024
This PR introduces support for generating CAST for Loops (for/while)
using tree-sitter, as part of the ongoing effort to port over the Python
AST to CAST generation to using tree-sitter.

### Python Tree Sitter
- Added support for generating CAST Loop nodes using Python tree sitter.
- Specifically, we added support for Python's For and While loop CAST
generation.
- Added some support for tree-sitter "patterns: "list_pattern",
"tuple_pattern", "list_pattern". These are used primarily in the For
loop syntax as the item we're iterating over.
- Also added support for generating Iterator function calls, as used by
the Python For Loops.
- Updated the CAST to AGraph visualizer to better visualize tuples.

### Testing 

- Added some small unit tests for loops (for/while) to determine
consistency.
- Added a small unit test for detecting missing identifiers in the first
line of a Python program.

### Other Fixes
- Fixes an issue with missing identifier names when they appeared on the
first line of the Python program. This was done by adding some
additional handling that is specific to the first line of the program.

Resolves #498 
Resolves #740
github-actions bot added a commit that referenced this issue Jan 12, 2024
This PR introduces support for generating CAST for Loops (for/while)
using tree-sitter, as part of the ongoing effort to port over the Python
AST to CAST generation to using tree-sitter.

### Python Tree Sitter
- Added support for generating CAST Loop nodes using Python tree sitter.
- Specifically, we added support for Python's For and While loop CAST
generation.
- Added some support for tree-sitter "patterns: "list_pattern",
"tuple_pattern", "list_pattern". These are used primarily in the For
loop syntax as the item we're iterating over.
- Also added support for generating Iterator function calls, as used by
the Python For Loops.
- Updated the CAST to AGraph visualizer to better visualize tuples.

### Testing

- Added some small unit tests for loops (for/while) to determine
consistency.
- Added a small unit test for detecting missing identifiers in the first
line of a Python program.

### Other Fixes
- Fixes an issue with missing identifier names when they appeared on the
first line of the Python program. This was done by adding some
additional handling that is specific to the first line of the program.

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

Successfully merging a pull request may close this issue.

1 participant