summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Grasp/Interpreter.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Grasp/Interpreter.hs b/src/Grasp/Interpreter.hs
index fe8b42a..e556414 100644
--- a/src/Grasp/Interpreter.hs
+++ b/src/Grasp/Interpreter.hs
@@ -5,6 +5,7 @@ module Grasp.Interpreter (
import Data.Graph.Inductive.Graph( Node, LNode, LEdge, (&) )
import qualified Data.Graph.Inductive.Graph as Graph
+import qualified Data.Set as Set
import Grasp.Types
import Grasp.Parser
@@ -22,14 +23,14 @@ grasp g =
-reachable :: GraspProgram -> [Node]
-reachable g = []
+reachable :: GraspProgram -> [IP] -> [Node]
+reachable g ips = Graph.nodes g
-garbageCollect :: GraspProgram -> GraspProgram
-garbageCollect g =
- let unreachable = (Graph.nodes g) \\ (reachable g)
+garbageCollect :: GraspProgram -> [IP] -> GraspProgram
+garbageCollect g ips =
+ let unreachable = (Graph.nodes g) \\ (reachable g ips)
in Graph.delNodes unreachable g