<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?action=history&amp;feed=atom&amp;title=Attribute_Grammars%2FExercise_10%3A_Expressions_and_bases</id>
	<title>Attribute Grammars/Exercise 10: Expressions and bases - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?action=history&amp;feed=atom&amp;title=Attribute_Grammars%2FExercise_10%3A_Expressions_and_bases"/>
	<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;action=history"/>
	<updated>2026-05-24T05:08:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=16353&amp;oldid=prev</id>
		<title>Root: /* Solution */</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=16353&amp;oldid=prev"/>
		<updated>2024-05-02T10:06:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Solution&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:06, 2 May 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The grammar uses only one set of rules for all bases (the default is 10, as shown in the second production for N). The inherited attribute &amp;#039;&amp;#039;&amp;#039;b&amp;#039;&amp;#039;&amp;#039; contains the base value, while the synthesized attribute &amp;#039;&amp;#039;&amp;#039;val&amp;#039;&amp;#039;&amp;#039; contains the actual number value.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The grammar uses only one set of rules for all bases (the default is 10, as shown in the second production for N). The inherited attribute &amp;#039;&amp;#039;&amp;#039;b&amp;#039;&amp;#039;&amp;#039; contains the base value, while the synthesized attribute &amp;#039;&amp;#039;&amp;#039;val&amp;#039;&amp;#039;&amp;#039; contains the actual number value.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;+&#039;&#039;&#039; M   { &amp;lt;font color=&quot;blue&quot;&amp;gt;S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val + M.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;+&#039;&#039;&#039; M   { &amp;lt;font color=&quot;blue&quot;&amp;gt;S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val + M.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  S &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;M         { &amp;lt;font color=&quot;blue&quot;&amp;gt;S.val = M.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  S &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;M         { &amp;lt;font color=&quot;blue&quot;&amp;gt;S.val = M.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;*&#039;&#039;&#039; N   { &amp;lt;font color=&quot;blue&quot;&amp;gt;M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;*&#039;&#039;&#039; N   { &amp;lt;font color=&quot;blue&quot;&amp;gt;M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;N         { &amp;lt;font color=&quot;blue&quot;&amp;gt;M.val = N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;N         { &amp;lt;font color=&quot;blue&quot;&amp;gt;M.val = N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;B @ N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;   { &amp;lt;font color=&quot;brown&quot;&amp;gt;B.b = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val;&amp;lt;/font&amp;gt; &amp;lt;font color=&quot;blue&quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;B @ N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;   { &amp;lt;font color=&quot;brown&quot;&amp;gt;B.b = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val;&amp;lt;/font&amp;gt; &amp;lt;font color=&quot;blue&quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * 10 + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * 10 + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;&#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;N.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;&#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;N.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;brown&quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; = &amp;lt;font color=&quot;brown&quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt;; &amp;lt;font color=&quot;blue&quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * &amp;lt;font color=&quot;brown&quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;brown&quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; = &amp;lt;font color=&quot;brown&quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt;; &amp;lt;font color=&quot;blue&quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * &amp;lt;font color=&quot;brown&quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  B &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; &lt;/del&gt;&#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;B.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  B &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;→ &lt;/ins&gt;&#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;B.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following is the annotated tree for the string&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following is the annotated tree for the string&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Root</name></author>
	</entry>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=6098&amp;oldid=prev</id>
		<title>Root at 14:25, 6 April 2015</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=6098&amp;oldid=prev"/>
		<updated>2015-04-06T14:25:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:25, 6 April 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l37&quot;&gt;Line 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 37:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Image:AttrGramEx10Bases1.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Image:AttrGramEx10Bases1.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Compilers&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Compiladores&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Teaching&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Ensino&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Root</name></author>
	</entry>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=6096&amp;oldid=prev</id>
		<title>Root: /* Solution */</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=6096&amp;oldid=prev"/>
		<updated>2015-03-30T16:52:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Solution&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:52, 30 March 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; B @ N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;   { &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B.b = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val;&amp;lt;/font&amp;gt; &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; B @ N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;   { &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B.b = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val;&amp;lt;/font&amp;gt; &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * 10 + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * 10 + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N -&amp;gt; &#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;R&lt;/del&gt;.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  N -&amp;gt; &#039;&#039;&#039;DIG&#039;&#039;&#039;       { &amp;lt;font color=&quot;blue&quot;&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;N&lt;/ins&gt;.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; = &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt;; &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; = &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt;; &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; + DIG.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Root</name></author>
	</entry>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=6095&amp;oldid=prev</id>
		<title>Root: /* Solution */</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=6095&amp;oldid=prev"/>
		<updated>2015-03-30T16:51:37Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Solution&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:51, 30 March 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l16&quot;&gt;Line 16:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  S -&amp;gt; M         { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;S.val = M.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  S -&amp;gt; M         { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;S.val = M.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;*&#039;&#039;&#039; N   { &amp;lt;font color=&quot;blue&quot;&amp;gt;M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;+ &lt;/del&gt;N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &#039;&#039;&#039;*&#039;&#039;&#039; N   { &amp;lt;font color=&quot;blue&quot;&amp;gt;M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &lt;/ins&gt;N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M -&amp;gt; N         { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;M.val = N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  M -&amp;gt; N         { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;M.val = N.val;&amp;lt;/font&amp;gt; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Root</name></author>
	</entry>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5128&amp;oldid=prev</id>
		<title>Root: /* Problem (in Portuguese) */</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5128&amp;oldid=prev"/>
		<updated>2014-04-03T14:00:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Problem (in Portuguese)&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:00, 3 April 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pretende-se criar uma gramática atributiva que some uma sequência de inteiros separados por &amp;#039;&amp;#039;&amp;#039;+&amp;#039;&amp;#039;&amp;#039;. Os inteiros podem estar codificados sob o formato decimal (sequência de dígitos entre 0 e 9, representados pelo elemento lexical &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;), ou em qualquer base entre 2 e 36 (sequências de dígitos de 0 a 9 e, acima de 10, também contendo as letras de A a Z que forem necessárias para representar todos os valores da base). Quando a base não é decimal, a representação do inteiro é seguida pelo símbolo &amp;#039;&amp;#039;&amp;#039;@&amp;#039;&amp;#039;&amp;#039; e pelo valor decimal da base.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pretende-se criar uma gramática atributiva que some uma sequência de inteiros separados por &amp;#039;&amp;#039;&amp;#039;+&amp;#039;&amp;#039;&amp;#039;. Os inteiros podem estar codificados sob o formato decimal (sequência de dígitos entre 0 e 9, representados pelo elemento lexical &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;), ou em qualquer base entre 2 e 36 (sequências de dígitos de 0 a 9 e, acima de 10, também contendo as letras de A a Z que forem necessárias para representar todos os valores da base). Quando a base não é decimal, a representação do inteiro é seguida pelo símbolo &amp;#039;&amp;#039;&amp;#039;@&amp;#039;&amp;#039;&amp;#039; e pelo valor decimal da base.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;O exemplo seguinte tem como resultado 123 + 456 * 789 + B L A H @ 24 = .&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;O exemplo seguinte tem como resultado 123 + 456 * 789 + B L A H @ 24 = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;123 + 359784 + 164417 = 524324&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  1 2 3 + 4 5 6 * 7 8 9 + B L A H @ 2 4&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  1 2 3 + 4 5 6 * 7 8 9 + B L A H @ 2 4&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Root</name></author>
	</entry>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5127&amp;oldid=prev</id>
		<title>Root: /* Problem (in Portuguese) */</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5127&amp;oldid=prev"/>
		<updated>2014-04-03T13:48:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Problem (in Portuguese)&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:48, 3 April 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Problem (in Portuguese) ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Problem (in Portuguese) ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pretende-se criar uma gramática atributiva que some uma sequência de inteiros separados por &#039;&#039;&#039;+&#039;&#039;&#039;. Os inteiros podem estar codificados sob o formato decimal (sequência de dígitos entre 0 e 9, representados pelo elemento lexical &#039;&#039;&#039;DIG&#039;&#039;&#039;), ou em qualquer base entre 2 e 36 (sequências de dígitos de 0 a 9 e, acima de 10, também contendo as letras de A a Z que forem necessárias para representar todos os valores da base). Quando a base não é decimal, a representação do inteiro é &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;precedida pelo valor decimal da base e &lt;/del&gt;pelo símbolo &#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#&lt;/del&gt;&#039;&#039;&#039;.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pretende-se criar uma gramática atributiva que some uma sequência de inteiros separados por &#039;&#039;&#039;+&#039;&#039;&#039;. Os inteiros podem estar codificados sob o formato decimal (sequência de dígitos entre 0 e 9, representados pelo elemento lexical &#039;&#039;&#039;DIG&#039;&#039;&#039;), ou em qualquer base entre 2 e 36 (sequências de dígitos de 0 a 9 e, acima de 10, também contendo as letras de A a Z que forem necessárias para representar todos os valores da base). Quando a base não é decimal, a representação do inteiro é &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;seguida &lt;/ins&gt;pelo símbolo &#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;@&lt;/ins&gt;&#039;&#039;&#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;e pelo valor decimal da base&lt;/ins&gt;.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;O exemplo seguinte tem como resultado 123 + 456 * 789 + B L A H @ 24 = .&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;O exemplo seguinte tem como resultado 123 + 456 * 789 + B L A H @ 24 = .&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Root</name></author>
	</entry>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5126&amp;oldid=prev</id>
		<title>Root: /* Solution */</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5126&amp;oldid=prev"/>
		<updated>2014-04-03T13:45:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Solution&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:45, 3 April 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l36&quot;&gt;Line 36:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Image:AttrGramEx10Bases1.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Image:AttrGramEx10Bases1.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(there is a small bug in the image: 23 should be 17+16=33, as stated in the text)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:Compilers]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:Compilers]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:Teaching]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:Teaching]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Root</name></author>
	</entry>
	<entry>
		<id>https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5125&amp;oldid=prev</id>
		<title>Root: Created page with &quot;== Problem (in Portuguese) ==  Pretende-se criar uma gramática atributiva que some uma sequência de inteiros separados por &#039;&#039;&#039;+&#039;&#039;&#039;. Os inteiros podem estar codificados sob o fo...&quot;</title>
		<link rel="alternate" type="text/html" href="https://robots.hlt.inesc-id.pt/w/pt/index.php?title=Attribute_Grammars/Exercise_10:_Expressions_and_bases&amp;diff=5125&amp;oldid=prev"/>
		<updated>2014-04-03T13:45:21Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Problem (in Portuguese) ==  Pretende-se criar uma gramática atributiva que some uma sequência de inteiros separados por &amp;#039;&amp;#039;&amp;#039;+&amp;#039;&amp;#039;&amp;#039;. Os inteiros podem estar codificados sob o fo...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Problem (in Portuguese) ==&lt;br /&gt;
&lt;br /&gt;
Pretende-se criar uma gramática atributiva que some uma sequência de inteiros separados por &amp;#039;&amp;#039;&amp;#039;+&amp;#039;&amp;#039;&amp;#039;. Os inteiros podem estar codificados sob o formato decimal (sequência de dígitos entre 0 e 9, representados pelo elemento lexical &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;), ou em qualquer base entre 2 e 36 (sequências de dígitos de 0 a 9 e, acima de 10, também contendo as letras de A a Z que forem necessárias para representar todos os valores da base). Quando a base não é decimal, a representação do inteiro é precedida pelo valor decimal da base e pelo símbolo &amp;#039;&amp;#039;&amp;#039;#&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
O exemplo seguinte tem como resultado 123 + 456 * 789 + B L A H @ 24 = .&lt;br /&gt;
&lt;br /&gt;
 1 2 3 + 4 5 6 * 7 8 9 + B L A H @ 2 4&lt;br /&gt;
&lt;br /&gt;
Crie a gramática para realizar a função descrita e construa a árvore semântica anotada para a entrada acima.&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
&lt;br /&gt;
The grammar uses only one set of rules for all bases (the default is 10, as shown in the second production for N). The inherited attribute &amp;#039;&amp;#039;&amp;#039;b&amp;#039;&amp;#039;&amp;#039; contains the base value, while the synthesized attribute &amp;#039;&amp;#039;&amp;#039;val&amp;#039;&amp;#039;&amp;#039; contains the actual number value.&lt;br /&gt;
&lt;br /&gt;
 S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;+&amp;#039;&amp;#039;&amp;#039; M   { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val + M.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 S -&amp;gt; M         { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;S.val = M.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 &lt;br /&gt;
 M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;*&amp;#039;&amp;#039;&amp;#039; N   { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;M&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = M&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val + N.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 M -&amp;gt; N         { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;M.val = N.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 &lt;br /&gt;
 N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; B @ N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;   { &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B.b = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val;&amp;lt;/font&amp;gt; &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;N&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = N&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * 10 + DIG.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 N -&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;R.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 &lt;br /&gt;
 B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; -&amp;gt; B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; = &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt;; &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;.val = B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.val * &amp;lt;font color=&amp;quot;brown&amp;quot;&amp;gt;B&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;.b&amp;lt;/font&amp;gt; + DIG.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
 B -&amp;gt; &amp;#039;&amp;#039;&amp;#039;DIG&amp;#039;&amp;#039;&amp;#039;       { &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;B.val = DIG.val;&amp;lt;/font&amp;gt; }&lt;br /&gt;
&lt;br /&gt;
The following is the annotated tree for the string&lt;br /&gt;
&lt;br /&gt;
 1 2 3 + 4 5 6 * 7 8 9 + B L A H @ 2 4&lt;br /&gt;
&lt;br /&gt;
Note that the order of evaluation for the attributes is, first inherited, then synthesized.&lt;br /&gt;
&lt;br /&gt;
Note that, in addition, although this grammar has inherited attibutes, it is not a L-attributed grammar, since there are dependencies from symbols to the right of the value being evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:AttrGramEx10Bases1.png]]&lt;br /&gt;
&lt;br /&gt;
(there is a small bug in the image: 23 should be 17+16=33, as stated in the text)&lt;br /&gt;
&lt;br /&gt;
[[category:Compilers]]&lt;br /&gt;
[[category:Teaching]]&lt;/div&gt;</summary>
		<author><name>Root</name></author>
	</entry>
</feed>