<?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-9%3Ajsmi233</id>
	<title>SE250:lab-9:jsmi233 - 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-9%3Ajsmi233"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-9:jsmi233&amp;action=history"/>
	<updated>2026-05-07T18:23:11Z</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-9:jsmi233&amp;diff=8590&amp;oldid=prev</id>
		<title>Mark: 1 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-9:jsmi233&amp;diff=8590&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:35Z</updated>

		<summary type="html">&lt;p&gt;1 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;I had a go at Option I. I got the equality comparison function down:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bool eqToken( Token a, Token b ) {&lt;br /&gt;
	if (a.type != b.type)&lt;br /&gt;
		return false;&lt;br /&gt;
	switch (a.type) {&lt;br /&gt;
		case T_SYMBOL:&lt;br /&gt;
		case T_IDENT:&lt;br /&gt;
			return a.val.symval == b.val.symval;&lt;br /&gt;
		case T_STRING:&lt;br /&gt;
			return a.val.strval == b.val.strval;&lt;br /&gt;
		case T_INTEGER:&lt;br /&gt;
			return a.val.intval == b.val.intval;&lt;br /&gt;
		case T_FLOAT:&lt;br /&gt;
			return a.val.fltval == b.val.fltval;&lt;br /&gt;
	}&lt;br /&gt;
	//For all other types, value comparison is not applicable&lt;br /&gt;
	return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The initialize function i guess is supposed to turn a string into a sequence of tokens. I got half way through this, so I&amp;#039;m not sure if I&amp;#039;m on the right track. This is my code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void init_TokenStream( TokenStream* tokens, char* input ) {&lt;br /&gt;
	int pos = 0;&lt;br /&gt;
	int start;&lt;br /&gt;
	char cur;&lt;br /&gt;
	bool dotSeen;&lt;br /&gt;
&lt;br /&gt;
	while (pos &amp;lt; (int)strlen(input)) { &lt;br /&gt;
&lt;br /&gt;
		if (isalpha(input[pos])) {&lt;br /&gt;
			start = pos;&lt;br /&gt;
			while (isalpha(input[pos]) || isdigit(input[pos]))&lt;br /&gt;
				pos++;&lt;br /&gt;
			//We have a string  =D&lt;br /&gt;
			&lt;br /&gt;
		} else if (isdigit(input[pos])) {&lt;br /&gt;
			dotSeen = false;&lt;br /&gt;
			start = pos;&lt;br /&gt;
			while (true) {&lt;br /&gt;
				if (input[pos] == &amp;#039;.&amp;#039;) {&lt;br /&gt;
					if (dotSeen)&lt;br /&gt;
						errorAndDie(&amp;quot;Too many dots in numeric expression.&amp;quot;);&lt;br /&gt;
					else&lt;br /&gt;
						dotSeen = true;&lt;br /&gt;
				} else if (!isdigit(input[pos]))&lt;br /&gt;
					break;&lt;br /&gt;
			}&lt;br /&gt;
			//We have a number   =D&lt;br /&gt;
&lt;br /&gt;
		} else if (issymbol(input[pos])) {&lt;br /&gt;
			//We have a symbol   =D&lt;br /&gt;
&lt;br /&gt;
		} else if (iswhite(input[pos])) {&lt;br /&gt;
			//We have whitespace!&lt;br /&gt;
&lt;br /&gt;
		} else if (input[pos]==&amp;#039;&amp;quot;&amp;#039;) {&lt;br /&gt;
			start = pos;&lt;br /&gt;
			pos++;&lt;br /&gt;
			while (input[pos] != &amp;#039;&amp;quot;&amp;#039; || (input[pos] == &amp;#039;&amp;quot;&amp;#039; &amp;amp;&amp;amp; input[pos - 1] != &amp;#039;\\&amp;#039;)&lt;br /&gt;
				pos++;&lt;br /&gt;
			//We have a string&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>