https://xinu.cs.mu.edu/index.php?title=Assignment:_Parser&feed=atom&action=historyAssignment: Parser - Revision history2024-03-29T10:38:28ZRevision history for this page on the wikiMediaWiki 1.34.2https://xinu.cs.mu.edu/index.php?title=Assignment:_Parser&diff=3684&oldid=prevAmallen: added link to grammar2010-08-27T19:30:22Z<p>added link to grammar</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 19:30, 27 August 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>= Overview =</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>= Overview =</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; 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;"><div>In this project students use [https://javacc.dev.java.net/ JavaCC] to implement the scanner and parser rules for our [<del class="diffchange diffchange-inline">[</del>Concurrent MiniJava <del class="diffchange diffchange-inline">Grammar|modified MiniJava]</del>] language.</div></td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div>In this project students use [https://javacc.dev.java.net/ JavaCC] to implement the scanner and parser rules for our [<ins class="diffchange diffchange-inline">http://www.mscs.mu.edu/~brylow/cosc4400/Spring2011/ConcurrentMiniJava.html </ins>Concurrent MiniJava] language.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>== Notes ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>== Notes ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; 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;"><div><del class="diffchange diffchange-inline">Our [</del>[Concurrent MiniJava <del class="diffchange diffchange-inline">Grammar|modifications to MiniJava]</del>] <del class="diffchange diffchange-inline">require </del>that ''Xinu'', ''Thread'', ''run'', and ''synchronized'' be added as reserved words for the Scanner and Parser. The external call productions must keep track of the name of the ''Xinu'' method being called. </div></td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div>[<ins class="diffchange diffchange-inline">http://www.mscs.mu.edu/~brylow/cosc4400/Spring2011/ConcurrentMiniJava.html </ins>Concurrent MiniJava] <ins class="diffchange diffchange-inline">requires </ins>that ''Xinu'', ''Thread'', ''run'', and ''synchronized'' be added as reserved words for the Scanner and Parser. The external call productions must keep track of the name of the ''Xinu'' method being called. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; 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;"><div>Also, since our modified language allows programmers to declare classes which extend the ''Thread'' class without ever actually declaring a ''Thread'' class, the compiler must be informed implicitly that there exists a ''Thread'' class. To avoid the complexity of making the compiler aware of the entire Java ''Thread'' class, the Parser can automatically generate an Abstract Syntax Tree (AST) node for a ''Thread'' class with an empty ''run'' method. This ensures there are no runtime errors when the external call ''Xinu.threadCreate'' calls the ''run'' method of a class which extends ''Thread'' but does not override the ''run'' method. To do this, class declarations which extend ''Thread'' are handled by the additional ''ThreadClassDeclaration'' production in our [<del class="diffchange diffchange-inline">[Concurrent MiniJava Grammar|</del>modified grammar<del class="diffchange diffchange-inline">]</del>].</div></td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div>Also, since our modified language allows programmers to declare classes which extend the ''Thread'' class without ever actually declaring a ''Thread'' class, the compiler must be informed implicitly that there exists a ''Thread'' class. To avoid the complexity of making the compiler aware of the entire Java ''Thread'' class, the Parser can automatically generate an Abstract Syntax Tree (AST) node for a ''Thread'' class with an empty ''run'' method. This ensures there are no runtime errors when the external call ''Xinu.threadCreate'' calls the ''run'' method of a class which extends ''Thread'' but does not override the ''run'' method. To do this, class declarations which extend ''Thread'' are handled by the additional ''ThreadClassDeclaration'' production in our [<ins class="diffchange diffchange-inline">http://www.mscs.mu.edu/~brylow/cosc4400/Spring2011/ConcurrentMiniJava.html </ins>modified grammar].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; 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;"><div>Further changes must be made to account for the declaration of the ''run'' method since ''void'' return types are not allowed in [http://www.cambridge.org/resources/052182060X/ MiniJava], except in the special case of the main method declaration. To handle this, we add a ''RunMethodDeclaration'' production to our [<del class="diffchange diffchange-inline">[Concurrent MiniJava Grammar|</del>modified grammar<del class="diffchange diffchange-inline">]</del>].</div></td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div>Further changes must be made to account for the declaration of the ''run'' method since ''void'' return types are not allowed in [http://www.cambridge.org/resources/052182060X/ MiniJava], except in the special case of the main method declaration. To handle this, we add a ''RunMethodDeclaration'' production to our [<ins class="diffchange diffchange-inline">http://www.mscs.mu.edu/~brylow/cosc4400/Spring2011/ConcurrentMiniJava.html </ins>modified grammar].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>To support the ''synchronized'' keyword the AST node for method declarations needs a new field to keep track of whether a method is synchronized or not.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>To support the ''synchronized'' keyword the AST node for method declarations needs a new field to keep track of whether a method is synchronized or not.</div></td></tr>
</table>Amallenhttps://xinu.cs.mu.edu/index.php?title=Assignment:_Parser&diff=3653&oldid=prevAmallen: /* Notes */ added a note on implementing the "synchronized" keyword2010-07-31T23:02:51Z<p><span dir="auto"><span class="autocomment">Notes: </span> added a note on implementing the "synchronized" keyword</span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 23:02, 31 July 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l3" >Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>== Notes ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>== Notes ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; 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;"><div>Our [[Concurrent MiniJava Grammar|modifications to MiniJava]] require that ''Xinu'', ''Thread'', and ''<del class="diffchange diffchange-inline">run</del>'' be added as reserved words for the Scanner and Parser. The external call productions must keep track of the name of the ''Xinu'' method being called. </div></td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div>Our [[Concurrent MiniJava Grammar|modifications to MiniJava]] require that ''Xinu'', ''Thread<ins class="diffchange diffchange-inline">'', ''run</ins>'', and ''<ins class="diffchange diffchange-inline">synchronized</ins>'' be added as reserved words for the Scanner and Parser. The external call productions must keep track of the name of the ''Xinu'' method being called. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; 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;"><div>Also, since our modified language allows programmers to declare classes which extend the ''Thread'' class without ever actually declaring a ''Thread'' class, the compiler must be informed implicitly that there exists a ''Thread'' class. To avoid the complexity of making the compiler aware of the entire Java ''Thread'' class, the Parser can automatically generate an Abstract Syntax Tree node for a ''Thread'' class with an empty ''run'' method. This ensures there are no runtime errors when the external call ''Xinu.threadCreate'' calls the ''run'' method of a class which extends ''Thread'' but does not override the ''run'' method. To do this, class declarations which extend ''Thread'' are handled by the additional ''ThreadClassDeclaration'' production in our [[Concurrent MiniJava Grammar|modified grammar]].</div></td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div>Also, since our modified language allows programmers to declare classes which extend the ''Thread'' class without ever actually declaring a ''Thread'' class, the compiler must be informed implicitly that there exists a ''Thread'' class. To avoid the complexity of making the compiler aware of the entire Java ''Thread'' class, the Parser can automatically generate an Abstract Syntax Tree <ins class="diffchange diffchange-inline">(AST) </ins>node for a ''Thread'' class with an empty ''run'' method. This ensures there are no runtime errors when the external call ''Xinu.threadCreate'' calls the ''run'' method of a class which extends ''Thread'' but does not override the ''run'' method. To do this, class declarations which extend ''Thread'' are handled by the additional ''ThreadClassDeclaration'' production in our [[Concurrent MiniJava Grammar|modified grammar]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>Further changes must be made to account for the declaration of the ''run'' method since ''void'' return types are not allowed in [http://www.cambridge.org/resources/052182060X/ MiniJava], except in the special case of the main method declaration. To handle this, we add a ''RunMethodDeclaration'' production to our [[Concurrent MiniJava Grammar|modified grammar]].</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>Further changes must be made to account for the declaration of the ''run'' method since ''void'' return types are not allowed in [http://www.cambridge.org/resources/052182060X/ MiniJava], except in the special case of the main method declaration. To handle this, we add a ''RunMethodDeclaration'' production to our [[Concurrent MiniJava Grammar|modified grammar]].</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div><ins style="font-weight: bold; text-decoration: none;">To support the ''synchronized'' keyword the AST node for method declarations needs a new field to keep track of whether a method is synchronized or not.</ins></div></td></tr>
</table>Amallenhttps://xinu.cs.mu.edu/index.php?title=Assignment:_Parser&diff=3642&oldid=prevAmallen at 22:40, 28 July 20102010-07-28T22:40:06Z<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 22:40, 28 July 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l3" >Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>== Notes ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>== Notes ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; 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;"><div>Our [[Concurrent MiniJava Grammar|modifications]] <del class="diffchange diffchange-inline">to MiniJava </del>require that ''Xinu'', ''Thread'', and ''run'' be added as reserved words for the Scanner and Parser. The external call productions must keep track of the name of the ''Xinu'' method being called. </div></td><td class='diff-marker'>+</td><td style="color: #222; 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;"><div>Our [[Concurrent MiniJava Grammar|modifications <ins class="diffchange diffchange-inline">to MiniJava</ins>]] require that ''Xinu'', ''Thread'', and ''run'' be added as reserved words for the Scanner and Parser. The external call productions must keep track of the name of the ''Xinu'' method being called. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>Also, since our modified language allows programmers to declare classes which extend the ''Thread'' class without ever actually declaring a ''Thread'' class, the compiler must be informed implicitly that there exists a ''Thread'' class. To avoid the complexity of making the compiler aware of the entire Java ''Thread'' class, the Parser can automatically generate an Abstract Syntax Tree node for a ''Thread'' class with an empty ''run'' method. This ensures there are no runtime errors when the external call ''Xinu.threadCreate'' calls the ''run'' method of a class which extends ''Thread'' but does not override the ''run'' method. To do this, class declarations which extend ''Thread'' are handled by the additional ''ThreadClassDeclaration'' production in our [[Concurrent MiniJava Grammar|modified grammar]].</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>Also, since our modified language allows programmers to declare classes which extend the ''Thread'' class without ever actually declaring a ''Thread'' class, the compiler must be informed implicitly that there exists a ''Thread'' class. To avoid the complexity of making the compiler aware of the entire Java ''Thread'' class, the Parser can automatically generate an Abstract Syntax Tree node for a ''Thread'' class with an empty ''run'' method. This ensures there are no runtime errors when the external call ''Xinu.threadCreate'' calls the ''run'' method of a class which extends ''Thread'' but does not override the ''run'' method. To do this, class declarations which extend ''Thread'' are handled by the additional ''ThreadClassDeclaration'' production in our [[Concurrent MiniJava Grammar|modified grammar]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>Further changes must be made to account for the declaration of the ''run'' method since ''void'' return types are not allowed in [http://www.cambridge.org/resources/052182060X/ MiniJava], except in the special case of the main method declaration. To handle this, we add a ''RunMethodDeclaration'' production to our [[Concurrent MiniJava Grammar|modified grammar]].</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; 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;"><div>Further changes must be made to account for the declaration of the ''run'' method since ''void'' return types are not allowed in [http://www.cambridge.org/resources/052182060X/ MiniJava], except in the special case of the main method declaration. To handle this, we add a ''RunMethodDeclaration'' production to our [[Concurrent MiniJava Grammar|modified grammar]].</div></td></tr>
</table>Amallenhttps://xinu.cs.mu.edu/index.php?title=Assignment:_Parser&diff=3640&oldid=prevAmallen: created page for Parser project2010-07-28T22:23:59Z<p>created page for Parser project</p>
<p><b>New page</b></p><div>= Overview =<br />
In this project students use [https://javacc.dev.java.net/ JavaCC] to implement the scanner and parser rules for our [[Concurrent MiniJava Grammar|modified MiniJava]] language.<br />
<br />
== Notes ==<br />
Our [[Concurrent MiniJava Grammar|modifications]] to MiniJava require that ''Xinu'', ''Thread'', and ''run'' be added as reserved words for the Scanner and Parser. The external call productions must keep track of the name of the ''Xinu'' method being called. <br />
<br />
Also, since our modified language allows programmers to declare classes which extend the ''Thread'' class without ever actually declaring a ''Thread'' class, the compiler must be informed implicitly that there exists a ''Thread'' class. To avoid the complexity of making the compiler aware of the entire Java ''Thread'' class, the Parser can automatically generate an Abstract Syntax Tree node for a ''Thread'' class with an empty ''run'' method. This ensures there are no runtime errors when the external call ''Xinu.threadCreate'' calls the ''run'' method of a class which extends ''Thread'' but does not override the ''run'' method. To do this, class declarations which extend ''Thread'' are handled by the additional ''ThreadClassDeclaration'' production in our [[Concurrent MiniJava Grammar|modified grammar]].<br />
<br />
Further changes must be made to account for the declaration of the ''run'' method since ''void'' return types are not allowed in [http://www.cambridge.org/resources/052182060X/ MiniJava], except in the special case of the main method declaration. To handle this, we add a ''RunMethodDeclaration'' production to our [[Concurrent MiniJava Grammar|modified grammar]].</div>Amallen