Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (19 sloc) 420 Bytes
DATA Tree
| Node left: Tree right: Tree
| Tip value: Int
ATTR Tree [
|
| sum: Int
]
SEM Tree
| Node lhs.sum = @left.sum + @right.sum
| Tip lhs.sum = @value
{
main :: IO ()
main = print (show test)
testTree :: Tree
testTree = Tree_Node (Tree_Tip 1) (Tree_Node (Tree_Tip 2) (Tree_Tip 3))
test :: Int
test = sem_Tree testTree
}
-- output of the program will be "6"
Jump to Line
Something went wrong with that request. Please try again.