<?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%3AMaintainers_report</id>
	<title>SE250:lab-8:Maintainers report - 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%3AMaintainers_report"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-8:Maintainers_report&amp;action=history"/>
	<updated>2026-04-28T09:30:29Z</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:Maintainers_report&amp;diff=8045&amp;oldid=prev</id>
		<title>Mark: 44 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-8:Maintainers_report&amp;diff=8045&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:25Z</updated>

		<summary type="html">&lt;p&gt;44 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[SE250:lab-8 | Lab page.]]&lt;br /&gt;
&lt;br /&gt;
== Introduction to lab ==&lt;br /&gt;
This week&amp;#039;s lab was on parse trees.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initial problems ==&lt;br /&gt;
The code had a few minor errors which needed to be fixed before it will compile&lt;br /&gt;
* The error function was called before it was defined and hence needed a prototype declaration (or moved above the expect function as some people did).&lt;br /&gt;
* &amp;quot;strcmpi&amp;quot; was misspelled as &amp;quot;strcimp&amp;quot;&lt;br /&gt;
*The dot converter part of the programme was still broken. However, Jhor053 put up a page on how to fix this problem, found [[250:lab-8:graphvizsoln | here]]&lt;br /&gt;
&lt;br /&gt;
Quite a few people mentioned running into these problems in their report - some spending a lot of time on fixing them. It would be nice to be given working code in the future.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task One ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Download parsetree.c from the SOFTENG 250 web site&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Most people had no difficulty here as it was linked right on the lab page. However there was also a link to lab-8.c, which was completely unnecessary and may have thrown a few people off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Two ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Construct an expression (calling mkNode) that, when passed to prefix tree, produces the output&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;-(-(a b))&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Graph the tree using tree_to_graph.&lt;br /&gt;
&lt;br /&gt;
 mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),0);&lt;br /&gt;
&lt;br /&gt;
And the output&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&amp;lt;img src=&amp;quot;http://studwww.cs.auckland.ac.nz/~hpan027/250-8-1.jpg&amp;quot; border=&amp;quot;0&amp;quot; /&amp;gt;&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Common practice here seems to be copying the code from the example and making minor modifications.&lt;br /&gt;
&lt;br /&gt;
*A few people also made the switch from Visual Studio as it was giving them problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Three ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Now, construct an expression that produces&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;?(&amp;gt;(+(a b) c) *(z +(y b)) ?(=(a 2) -(x y) -(y x)))&lt;br /&gt;
&lt;br /&gt;
Majority of the people went with one of these two approaches:&lt;br /&gt;
&lt;br /&gt;
 ParseTree* chunkX1 = mkNode(&amp;#039;&amp;gt;&amp;#039;,mkNode(&amp;#039;+&amp;#039;,mkNode(&amp;#039;a&amp;#039;),mkNode(&amp;#039;b&amp;#039;),0),mkNode(&amp;#039;c&amp;#039;,0),0);&lt;br /&gt;
 ParseTree* chunkX2 = 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));&lt;br /&gt;
 ParseTree* chunkX3 = 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* ourTree2 = mkNode(&amp;#039;?&amp;#039;,chunkX1,chunkX2,chunkX3,0);&lt;br /&gt;
&lt;br /&gt;
*From [[SE250:lab-8:npit006 | npit006&amp;#039;s report]] - doing each subtree separately and then combining them together&lt;br /&gt;
&lt;br /&gt;
     ParseTree* t2 = mkNode(&amp;#039;?&amp;#039;,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),mkNode(&amp;#039;*&amp;#039;,mkNode(&amp;#039;z&amp;#039;,0),&lt;br /&gt;
     mkNode( &amp;#039;+&amp;#039;,mkNode(&amp;#039;y&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),0),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),&lt;br /&gt;
     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),0);&lt;br /&gt;
&lt;br /&gt;
*Others (above code taken from [[SE250:lab-8:rbha033 | rbha003]]) did it as a single tree with a range of formatting&lt;br /&gt;
*People who split the tree down generally found it easier&lt;br /&gt;
*As with the above task, trial and error works quite well here&lt;br /&gt;
*A few people drew the tree in advance and said it helped&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Four ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Draw a picture of what you expect the graph of this tree to look like, then graph the tree using tree to graph and compare the result with your prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&amp;lt;img src=&amp;quot;http://studwww.cs.auckland.ac.nz/~rwan064/lab8/task2.png&amp;quot; border=&amp;quot;0&amp;quot; /&amp;gt;&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Image sourced from [[SE250:lab-8:rwan064 | Rwan064&amp;#039;s report]]&lt;br /&gt;
*Most of the people who did attempt to draw the tree had it right (or mostly right)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Five ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;The ? corresponds to the C conditional expression, which has the form cond ? e1 : e2. Why does the parse tree not need to include the colon (:)?&lt;br /&gt;
&lt;br /&gt;
[[SE250:lab-8:aomr001 | Aomr001:]]&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;quot;&amp;#039;&amp;#039;&amp;#039;the colon &amp;quot;:&amp;quot; is used in C to distinguish and separate different conditions.. the parse tree doesn&amp;#039;t need to use that because the different conditions are in different branches of the parse tree.&amp;#039;&amp;#039;&amp;#039;&amp;quot;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[SE250:lab-8:llay008 | Llay008:]]&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;quot;&amp;#039;&amp;#039;&amp;#039;The parse tree does not need to include the : because it is redundant. When the parse tree &amp;#039;sees&amp;#039; the ? the : is implicitly implied - it separates what have become the different branches in the parse tree. &amp;#039;&amp;#039;&amp;#039;&amp;quot;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
*Not as many people had gotten up to this part&lt;br /&gt;
*The general consensus seems to be that &amp;quot;:&amp;quot; is only needed by the compiler to separate the statements &amp;#039;e1&amp;#039; and &amp;#039;e2&amp;#039;. However, in the parse tree this is done implicitly as &amp;#039;e1&amp;#039; and &amp;#039;e2&amp;#039; are in different branches&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Six ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Write a (recursive) function to evaluate a parse tree that consists of nodes that are either digits or the operators +, 􀀀, * and /.&lt;br /&gt;
&lt;br /&gt;
*Very few people got this far&lt;br /&gt;
*Below are the links to the report of people who have written some code at the time of writing this report:&lt;br /&gt;
;Task 6&lt;br /&gt;
:[[SE250:lab-8:npit006#Task_6]]&lt;br /&gt;
:[[SE250:lab-8:hpan027#Task_Six]]&lt;br /&gt;
:[[SE250:lab-8:rwan064#Task_6]]&lt;br /&gt;
:[[SE250:lab-8:bvic005#Task6]]&lt;br /&gt;
:[[SE250:lab-8:hlin079]]&lt;br /&gt;
:[[SE250:lab-8:dols008#Task_6]]&lt;br /&gt;
:[[SE250:lab-8:jsmi233]]&lt;br /&gt;
:[[SE250:lab-8:dcho040#task6]]&lt;br /&gt;
&lt;br /&gt;
*The basic structure of everyone&amp;#039;s code is very similar:&lt;br /&gt;
**Base case is a single digit leaf&lt;br /&gt;
**Using a switch or if statement to check for the symbols &amp;#039;+&amp;#039; &amp;#039;-&amp;#039; &amp;#039;*&amp;#039; &amp;#039;/&amp;#039;&lt;br /&gt;
**Calculate the subtrees with the appropriate operator&lt;br /&gt;
*Some people had addition error checking for things such as division by zero and unexpected number of children&lt;br /&gt;
*Of the people who dealt with an operator having more than two children, mostly everyone treated it as an error&lt;br /&gt;
**A few applied the operation to all the children, with left associativity. i.e. *(1 2 3) considered as 1 * 2 * 3&lt;br /&gt;
*Digits with arguments were ignored or treated as an error&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Seven ==&lt;br /&gt;
&lt;br /&gt;
*Practically no one got this far&lt;br /&gt;
&lt;br /&gt;
[[SE250:lab-8:dols008 | Dols008:]]&lt;br /&gt;
&lt;br /&gt;
 Just from a glance at the grammar, it looks like it won&amp;#039;t work because&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;E&amp;gt; ::= &amp;lt;E&amp;gt; &amp;lt;BinOp&amp;gt; &amp;lt;E&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 defines &amp;lt;E&amp;gt; recursively as itself (plus some other stuff). This will cause an infinite loop with &amp;lt;E&amp;gt; always &lt;br /&gt;
 attempting to match itself.&lt;br /&gt;
&lt;br /&gt;
[[SE250:lab-8:dcho040 | Dcho040:]]&lt;br /&gt;
 * his is not working because if &amp;#039;tokens&amp;#039; is operation, this code will repeat forever. &lt;br /&gt;
 &lt;br /&gt;
 ParseTree* lhs = recogniseE( tokens );&lt;br /&gt;
 &lt;br /&gt;
 * and if there is &amp;#039;(&amp;#039;, unless &amp;#039;)&amp;#039; is next character, program can&amp;#039;t find &amp;#039;)&amp;#039;, because code stop before find&amp;#039;)&amp;#039;&lt;br /&gt;
&lt;br /&gt;
*Nobody wrote the parser as of the time this report was written&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== After Lab Task ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;After the lab and before Thursday, read at the two reports immediately below yours in the wiki list1 and comment on .&lt;br /&gt;
&lt;br /&gt;
*Seems like nobody saw this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
*Generally, feedbacks for the lab were positive&lt;br /&gt;
*Four tasks were finished on average&lt;br /&gt;
*Most common problem mentioned was getting the code to compile&lt;br /&gt;
*Things to be improved&lt;br /&gt;
**Code which does not compile&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>