SE250:lab-8:jhor053
Jump to navigation
Jump to search
Lab 8
Task1
Got the errors ironed out as well as the graph printing
Task2
<html><img src="http://www.gotmilk.co.nz/~gm_modnar/250labs/lab8/task2b.jpg" border="0" /></html> Well it worked good with:
ParseTree* t = mkNode( '-', mkNode('-', mkNode('a', 0), mkNode('b', 0), 0 ), 0); prefix_tree(t); tree_to_graph(t, "task2b.jpg");
Hint: remember the 0 as a supressor
Task3
<html><img src="http://www.gotmilk.co.nz/~gm_modnar/250labs/lab8/task3a.jpg" border="0" /></html>
From:
ParseTree* t = mkNode('?', mkNode('>', mkNode('+',mkNode('a', 0),mkNode('b', 0), 0), mkNode('c', 0) , 0 ), mkNode('*', mkNode('z', 0), mkNode('+', mkNode('y', 0), mkNode('b', 0), 0), 0), mkNode('?', mkNode('=', mkNode('a', 0), mkNode('2', 0), 0), mkNode('-', mkNode('x', 0), mkNode('y', 0), 0), mkNode('-', mkNode('y', 0), mkNode('x', 0), 0), 0) , 0 ); prefix_tree(t); tree_to_graph(t, "task3a.jpg");
Gives:
?(>(+(a b) c) *(z +(y b)) ?(=(a 2) -(x y) -(y x)))
Task4
Task5
Task6
Conclusion
Well a good lab overall and quite interesting to get graphviz going again :D
Anyway will draw task 4 on my tablet soon. I AM A GOOGLEPLEX.