<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-8%3Asgha014</id>
	<title>SE250:lab-8:sgha014 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-8%3Asgha014"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-8:sgha014&amp;action=history"/>
	<updated>2026-04-29T01:16:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-8:sgha014&amp;diff=8363&amp;oldid=prev</id>
		<title>Mark: 10 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-8:sgha014&amp;diff=8363&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:31Z</updated>

		<summary type="html">&lt;p&gt;10 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==TASK 2==&lt;br /&gt;
i first tried it out using the example they gave in the pdf. i just copied from their and it wasnt working. Then i got told that the &amp;#039; is differnt in the pdf so i had to go through and change the &amp;#039; and then it worked. So then i did the actual task&lt;br /&gt;
 int main(void){&lt;br /&gt;
 	ParseTree* t = mkNode( &amp;#039;-&amp;#039;, mkNode( &amp;#039;-&amp;#039;, 0 ), mkNode( &amp;#039;a&amp;#039;, 0 ), mkNode(&amp;#039;b&amp;#039;, 0), 0 );&lt;br /&gt;
 	 prefix_tree(t);&lt;br /&gt;
 	 return 0;&lt;br /&gt;
 }&lt;br /&gt;
i used the cygwin to compile and run coz visual studio seems to never work anymore.&lt;br /&gt;
 $ gcc parsetree.c -o parsetree &amp;amp;&amp;amp; ./parsetree.exe&lt;br /&gt;
 -(- a b)&lt;br /&gt;
for some reason tree-to-graph doesnt work.&lt;br /&gt;
&lt;br /&gt;
someone posted some help on the wiki of how to make tree-to-graph work so i managed to get a picture of my tree :D&lt;br /&gt;
&lt;br /&gt;
==TASK 4==&lt;br /&gt;
i did task 4 before task 3. i drew what i expected the tree to look like, then did task three.&lt;br /&gt;
&lt;br /&gt;
==TASK 3==&lt;br /&gt;
it took a while to figure out how to do it in subtrees and then combine them, but i got there in the end.&lt;br /&gt;
i drew one subtree and checkd it and then did the other and so on. Then combined them into 1 big tree.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main(void){&lt;br /&gt;
	ParseTree* t = mkNode(&amp;#039;&amp;gt;&amp;#039;, mkNode(&amp;#039;+&amp;#039;, mkNode(&amp;#039;a&amp;#039;, 0), mkNode(&amp;#039;b&amp;#039;, 0),0), mkNode(&amp;#039;c&amp;#039;, 0), 0);&lt;br /&gt;
	ParseTree* t2 = mkNode(&amp;#039;*&amp;#039;,mkNode(&amp;#039;z&amp;#039;,0), mkNode(&amp;#039;+&amp;#039;,mkNode(&amp;#039;y&amp;#039;, 0),mkNode(&amp;#039;b&amp;#039;,0),0) ,0);&lt;br /&gt;
	ParseTree* t3 = mkNode(&amp;#039;?&amp;#039;,mkNode(&amp;#039;=&amp;#039;, mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;2&amp;#039;,0),0), mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;x&amp;#039;,0), mkNode(&amp;#039;y&amp;#039;,0),0), mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;y&amp;#039;,0),mkNode(&amp;#039;x&amp;#039;,0), 0), 0);&lt;br /&gt;
	ParseTree* tree = mkNode(&amp;#039;?&amp;#039;, t, t2, t3, 0);&lt;br /&gt;
	prefix_tree(tree);&lt;br /&gt;
	tree_to_graph( tree, &amp;quot;mygraph.jpg&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	 return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
heres the tree i got:&lt;br /&gt;
[http://img139.imageshack.us/img139/4436/mygraphjp2.jpg tree]&lt;br /&gt;
&lt;br /&gt;
==TASK 5==&lt;br /&gt;
 cond ? e1 : e2.&lt;br /&gt;
this means that if the condiition is true, do e1, else do e2.&lt;br /&gt;
so i dont relly understand why the tree doesnt have the : in it.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>