S04 · Quantum & Scale · L-17
Bytecode Constant-Fold
- Difficulty
- expert
- Type
- implementation
- Session
- Deep
- Stack
- Python python3.11
- Domain
- Compilers
- Est. solve
- ~35 min
01 · The task
Implement the constant-folding pass over a small bytecode IR: evaluate constant subexpressions at compile time while preserving program semantics and side effects. The IR, parser, and evaluator are provided; you write the pass. Dead-code elimination is an optional, separately-scored bonus.
02 · Constraints
DCE is bonus
Dead-code elimination is an optional, separately-scored extra.
03 · Skills exercised
How to playDaemon
The whole level runs through the local promptly daemon — it pulls the workspace, captures your token usage, tests locally, and submits the ranked run.
Pair this machine
One-time — approve the code under your devices.
promptly pairPull the workspace
Downloads the starter kit into the current folder and starts the solve clock.
promptly init stage-4-17-bytecode-constant-foldStart the captured session
Then drive your AI tool — the daemon meters every prompt and token live.
promptly start stage-4-17-bytecode-constant-foldSubmit for ranked grading
Runs the full hidden suite and ends the attempt.
promptly submit
Or combine steps 02–03 into one commandShortcut
promptly play pulls the workspace, launches the daemon, and starts the captured session in a single step — the same as running init then start.
promptly play stage-4-17-bytecode-constant-fold