summaryrefslogtreecommitdiff
path: root/src/Grasp/Interpreter.hs
blob: fe8b42a3b75317092ee1017d0955164068739930 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Grasp.Interpreter (
    grasp
    ) where


import Data.Graph.Inductive.Graph( Node, LNode, LEdge, (&) )
import qualified Data.Graph.Inductive.Graph as Graph
import Grasp.Types
import Grasp.Parser



type IP = [LNode String]




grasp :: GraspProgram -> IO ()
grasp g =
	let ips = map (:[]) (nodesWithName g "grasp:main")
	in interpret g ips



reachable :: GraspProgram -> [Node]
reachable g = []



garbageCollect :: GraspProgram -> GraspProgram
garbageCollect g =
	let unreachable = (Graph.nodes g) \\ (reachable g)
	in Graph.delNodes unreachable g




interpret :: GraspProgram -> [IP] -> IO ()
interpret g ips = return ()