Skip to content

Implement Strict Syntax Mode for Translation#221

Closed
yaskhan wants to merge 1 commit intomainfrom
strict-syntax-mode-4321059608732374860
Closed

Implement Strict Syntax Mode for Translation#221
yaskhan wants to merge 1 commit intomainfrom
strict-syntax-mode-4321059608732374860

Conversation

@yaskhan
Copy link
Copy Markdown
Owner

@yaskhan yaskhan commented Mar 4, 2026

This change implements the requested Strict Syntax Mode. It introduces a new CLI flag --strict-syntax-mode that enforces modern Python 3.12+ typing standards and requires explicit annotations to eliminate implicit Any types in the transpiled V code.

Key changes:

  • TranspilerConfig now includes strict_syntax_mode.
  • main.py supports the new flag and re-raises SyntaxError for better error reporting.
  • TranslatorBase and its subclasses have access to the configuration.
  • ClassesMixin rejects Generic[T] inheritance in strict mode.
  • AssignmentsMixin and FunctionsMixin require explicit annotations for targets inferred as Any.
  • TypeInference now collects function return types.
  • ModuleMixin ensures top-level assignments are correctly processed and checked.
  • New test file py2v_transpiler/tests/test_strict_syntax.py verifies all strict mode requirements.

Fixes #204


PR created automatically by Jules for task 4321059608732374860 started by @yaskhan

Add --strict-syntax-mode CLI flag requiring Python 3.12+ syntax and explicit annotations.

- Refuse old Generic[T] syntax, require PEP 695 syntax.
- Require explicit annotations for variables, function arguments, and return types where Any is inferred.
- Improve type inference to support strict mode checks.
- Propagate TranspilerConfig through the translator.
- Add comprehensive tests for strict mode enforcement.

Co-authored-by: yaskhan <3676373+yaskhan@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@code-input
Copy link
Copy Markdown

code-input Bot commented Mar 4, 2026

Pull request #221 has conflicts that needs to be resolved.
You can resolve it at codeinput: 0d9f0977-1ea1-4692-9f1e-138f548caa04.

@yaskhan yaskhan added the jules label Mar 4, 2026
@code-input
Copy link
Copy Markdown

code-input Bot commented Mar 4, 2026

Pull request #221 has conflicts that needs to be resolved.
You can resolve it at codeinput: 7b19d3e1-49a3-4f05-825e-f20cf1c478ad.

@yaskhan yaskhan closed this Mar 16, 2026
@yaskhan yaskhan deleted the strict-syntax-mode-4321059608732374860 branch March 16, 2026 20:17
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 this pull request may close these issues.

Implement Strict Syntax Mode for Translation

1 participant