Skip to content

feat: expression syntax pass - #52

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
feat/syntax-expressions
Sep 4, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
feat/syntax-expressions

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Summary

First syntax pass after the roadmap, driven by the repositories under tests-project/: most of their files were rejected by the frontend for everyday constructs. This pass covers the ones that add no control flow; conditional expressions, lambdas, comprehensions, nested function definitions and global assignments are the next pass.

  • Acceptance tests first (test: define f-strings, slices, unpacking, raise from and tuple loop targets), implementation follows.
  • PyHIR: FormattedString (constant and formatted parts, conversions and format specs dropped, nested spec expressions kept as parts), Slice, Starred, Dict items with a None key for **mapping, Raise.cause. A for k, v in items loop binds a hidden local and destructures it with a tuple assignment at the top of its body, so scopes, CFG, lowering and SSA are unchanged.
  • PyIR: BuildString, BuildSlice, Call.starred, unpacked on BuildList, BuildTuple and BuildDict, Raise.cause; printed as build_string, build_slice, *%n, **%n and raise %e from %c.
  • Analyses: starred arguments join the keyword bucket of taint and dependence, whose positions are unknown, so a known callee reached through run(*args) still reports; unpacked collections carry the contents of what they unpack in taint, dependence and the heap; everything else flows through the generic operand rules, so refutation through an f-string works unchanged.
  • Discovery: a .py file that cannot be decoded becomes a syntax-error note instead of aborting the whole run, and dependency files honour their byte order mark, since pip freeze on Windows writes UTF-16 requirements.txt files; two repositories had them and crashed the run.

Measured on the twelve repositories under tests-project/: f-strings, slices, raise from, tuple loop targets and starred arguments no longer block any file; the remaining notes are conditional expressions, lambdas, comprehensions, nested functions and global assignments.

@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 4, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit dfe7418 into main Sep 4, 2026
6 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/syntax-expressions branch September 4, 2026 03:53
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