1. A method of generating a slice from a plan-based representation of a program, the method comprising: constructing, by a processor, a plan representation of a program, wherein the program comprises at least one function, and wherein the plan representation comprises a plurality of entry nodes, exit nodes, edges, and ports; wherein at least one entry node within the plurality of entry nodes represents a plurality of parameters, constants, or global variables used by the at least one function; wherein at least one exit node within the plurality of exit nodes represents a plurality of return values or a plurality of global variables modified by the function: receiving one or more slicing criteria from a user, wherein the one or more slicing criteria comprise one or more variable occurrences or statements from the program; translating the one or more slicing criteria to the plurality of entry nodes, exit nodes, edges or ports in the plan representation; mapping the one or more translated slicing criteria to the plurality of entry nodes, exit nodes, edges or ports in the plan representation; and generating a slice from the plan representation according to the mapped slicing criteria by using backward traversal and forward traversal.