Skip to content

[Rust] Scaffold uast4rust CLI with minimal valid output#56

Draft
KinomotoMio wants to merge 41 commits into
antgroup:mainfrom
KinomotoMio:feat/rust-parser
Draft

[Rust] Scaffold uast4rust CLI with minimal valid output#56
KinomotoMio wants to merge 41 commits into
antgroup:mainfrom
KinomotoMio:feat/rust-parser

Conversation

@KinomotoMio

@KinomotoMio KinomotoMio commented Feb 26, 2026

Copy link
Copy Markdown

Summary

Track ongoing Rust parser implementation in YASA-UAST from branch feat/rust-parser.

Scope in this PR

  • Incremental parser-first changes for parser-Rust / uast4rust
  • Single-file parsing and project-mode parsing improvements
  • Cargo metadata output and package tree shaping
  • UAST lowering coverage expansion with test/golden updates
  • README updates for Rust parser usage

Out of scope

  • YASA-Engine integration
  • Rust analyzer implementation
  • Rust taint checker implementation

Related issues

Contributor note

This work is delivered incrementally with small, reviewable commits.
AI is used as an assistant in a reasonable way, and implementation aims to follow standard software engineering practices.

Status note

This PR tracks exploratory work and does not guarantee mergeability at this stage.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the foundational components for a Rust UAST parser. It sets up the basic project structure, defines the command-line interface for interacting with the parser, and outlines the initial data model for the UAST output. The changes enable basic UAST generation for individual Rust files and projects, ensuring that the output includes essential metadata while laying the groundwork for more complex AST lowering in future iterations.

Highlights

  • New Rust Parser Crate and CLI: Introduced the parser-Rust crate and the uast4rust command-line interface for generating Universal Abstract Syntax Trees (UASTs) from Rust code.
  • CLI Argument Support: Implemented support for essential CLI arguments: -rootDir to specify the input path, -output for the output file, and -single to enable single-file parsing mode.
  • Minimal UAST Output Structure: Defined and implemented the minimal required top-level fields in the UAST output JSON, including packageInfo, moduleName, cargoTomlPath, and numOfCargoToml.
  • Rust Language Identification: Ensured that the generated compile unit skeleton correctly identifies the source language as rust.
  • Smoke Tests and Fixtures: Added initial smoke tests with in-repository synthetic fixtures to validate the basic functionality of the CLI in both single-file and project modes.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • parser-Rust/Cargo.lock
    • Added a new Cargo.lock file, specifying exact dependencies for the uast4rust crate.
  • parser-Rust/Cargo.toml
    • Added a new Cargo.toml file, defining the uast4rust crate and its dependencies.
  • parser-Rust/README.md
    • Added a README file, detailing build and usage instructions for the CLI.
  • parser-Rust/src/lib.rs
    • Implemented CLI argument parsing, file/project processing, and UAST output writing.
  • parser-Rust/src/main.rs
    • Created the main entry point for the uast4rust CLI application.
  • parser-Rust/src/model.rs
    • Defined the data structures for the Universal Abstract Syntax Tree (UAST) output.
  • parser-Rust/testdata/project/basic/Cargo.toml
    • Added a sample Cargo.toml for project mode testing.
  • parser-Rust/testdata/project/basic/src/main.rs
    • Added a sample Rust source file for project mode testing.
  • parser-Rust/testdata/single/basic.rs
    • Added a sample Rust source file for single-file mode testing.
  • parser-Rust/tests/cli_smoke.rs
    • Added integration tests to verify CLI functionality and UAST output.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully scaffolds the uast4rust CLI, including argument parsing, basic single-file and project mode logic, and minimal JSON output. The code is a solid foundation. I've added a few suggestions to improve error handling, efficiency, and code structure, which are particularly valuable at this early stage of development.

Comment thread parser-Rust/src/lib.rs Outdated
Comment thread parser-Rust/src/lib.rs Outdated
Comment thread parser-Rust/src/lib.rs Outdated
Comment thread parser-Rust/src/main.rs
@KinomotoMio

Copy link
Copy Markdown
Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request sets up a solid foundation for the uast4rust CLI. The code is well-structured with clear separation of concerns for models, library logic, and the main binary. Error handling is robust, and the inclusion of smoke tests is great for ensuring correctness from the start. My only suggestion is to consider using a dedicated CLI parsing library like clap to improve long-term maintainability and adopt standard CLI conventions, as detailed in my comment.

Comment thread parser-Rust/src/lib.rs
@KinomotoMio KinomotoMio marked this pull request as ready for review February 27, 2026 00:03

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Free Tier Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread parser-Rust/src/lib.rs
Comment thread parser-Rust/src/lib.rs
@KinomotoMio KinomotoMio marked this pull request as draft February 27, 2026 07:13
@KinomotoMio

Copy link
Copy Markdown
Author

For incremental review, I’m currently managing this branch as a stacked PR in my fork (same head branch):
KinomotoMio#3

I will keep this upstream PR aligned as changes are validated.

KinomotoMio and others added 21 commits February 27, 2026 16:10
[Rust] Add regression golden fixtures and README docs
[Rust] Fix control-flow lowering edge cases and add regressions
[Rust] Add core single-file syntax lowering to UAST
[Rust] Implement project discovery and Cargo metadata output
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.

1 participant