Skip to content

14 — Level 3, stage 4: the PDG & the backward-slice gate #23

Description

@rahlk

Part of #9. Phase 3 — native dataflow. Short issue, giant gate.

Learning goals

Composition and verification: nothing new is computed — this is where you find out whether
stages 1–3 were RIGHT. The discipline of writing the expected answer down by hand before
running the code.

Task

  • PDG per callable = CDG edges (stage 2) + DDG edges (stage 3) over the same (signature, node_id) node space.
  • Backward intraprocedural slice = reverse reachability over CDG ∪ DDG from a (variable, line)
    criterion.

Gate (PDG slice gate — the single highest-value test in all of level 3)

  • For a named variable at a named line in the fixture, the backward slice equals the
    HAND-COMPUTED node set, exactly. Compute it on paper first; commit the expected set with a
    comment explaining each member. This one test catches missing control dependences AND missing
    def-use edges — if it's green and honest, the intraprocedural half is done.
  • Slice through a ?-early-return and through a match-with-guard both asserted.

Metadata

Metadata

Assignees

Labels

learning-ladderThe escalating-complexity curriculum issueslevel-3Native dataflow: CFG/PDG/SDG

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions