Skip to content

[Pratt Parser] Optimize call stack depth via in-place AST mutation and lean dispatch - #2208

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_963785455
Aug 15, 2026
Merged

[Pratt Parser] Optimize call stack depth via in-place AST mutation and lean dispatch#2208
copybara-service[bot] merged 1 commit into
masterfrom
test_963785455

Conversation

@copybara-service

Copy link
Copy Markdown

[Pratt Parser] Optimize call stack depth via in-place AST mutation and lean dispatch

  • In-place AST mutation in binary/ternary operations:
    • Updated some Parse* functions to accept ExprNode& lhs and mutate lhs in place instead of returning ExprNode by value.
    • Eliminated some intermediate named temporary rhs stack variables.
  • Lean ParseUnary and ParsePrimary dispatch:
    • Extracted prefix operator parsing (!, -) into ParseUnaryOps(), making ParseUnary() a fast single branch for standard non-prefix expressions.

@copybara-service
copybara-service Bot force-pushed the test_963785455 branch 2 times, most recently from ea2debf to 10814cd Compare August 15, 2026 15:15
…d lean dispatch

- In-place AST mutation in binary/ternary operations:
  - Updated some Parse* functions to accept ExprNode& lhs and mutate lhs in place instead of returning ExprNode by value.
  - Eliminated some intermediate named temporary rhs stack variables.
- Lean ParseUnary and ParsePrimary dispatch:
  - Extracted prefix operator parsing (!, -) into ParseUnaryOps(), making ParseUnary() a fast single branch for standard non-prefix expressions.

PiperOrigin-RevId: 965211950
@copybara-service
copybara-service Bot merged commit 02ddc54 into master Aug 15, 2026
@copybara-service
copybara-service Bot deleted the test_963785455 branch August 15, 2026 15:37
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