001         package com.croftsoft.apps.compiler.mini.node;
002    
003         import java.util.*;
004    
005         /*********************************************************************
006         * Parse tree node for the Mini programming language.
007         *
008         * @see
009         *   MiniNode
010         *
011         * @author
012         *   <A HREF="http://www.alumni.caltech.edu/~croft/">David W. Croft</A>
013         * @version
014         *   1999-04-25
015         *********************************************************************/
016    
017         public class  IndefiniteLoopStatementMiniNode extends AbstractMiniNode
018           implements StatementMiniNode
019         //////////////////////////////////////////////////////////////////////
020         //////////////////////////////////////////////////////////////////////
021         {
022    
023         protected ComparisonMiniNode         comparisonMiniNode;
024         protected StatementSequenceMiniNode  statementSequenceMiniNode;
025    
026         //////////////////////////////////////////////////////////////////////
027         // Constructor methods
028         //////////////////////////////////////////////////////////////////////
029    
030         public  IndefiniteLoopStatementMiniNode (
031           ComparisonMiniNode         comparisonMiniNode,
032           StatementSequenceMiniNode  statementSequenceMiniNode )
033         //////////////////////////////////////////////////////////////////////
034         {
035           this.comparisonMiniNode        = comparisonMiniNode;
036           this.statementSequenceMiniNode = statementSequenceMiniNode;
037         }
038    
039         //////////////////////////////////////////////////////////////////////
040         // Access methods
041         //////////////////////////////////////////////////////////////////////
042    
043         public ComparisonMiniNode  getComparisonMiniNode ( )
044         //////////////////////////////////////////////////////////////////////
045         {
046           return comparisonMiniNode;
047         }
048    
049         public StatementSequenceMiniNode  getStatementSequenceMiniNode ( )
050         //////////////////////////////////////////////////////////////////////
051         {
052           return statementSequenceMiniNode;
053         }
054    
055         //////////////////////////////////////////////////////////////////////
056         // MiniNode interface methods
057         //////////////////////////////////////////////////////////////////////
058    
059         public void  generate ( MiniNodeCodeVisitor  miniNodeCodeVisitor )
060         //////////////////////////////////////////////////////////////////////
061         {
062           miniNodeCodeVisitor.generateIndefiniteLoopStatement ( this );
063         }
064         
065         //////////////////////////////////////////////////////////////////////
066         //////////////////////////////////////////////////////////////////////
067    
068         public void  checkSemantics ( Stack  parentMiniNodeStack )
069           throws SemanticErrorException
070         //////////////////////////////////////////////////////////////////////
071         {
072           parentMiniNodeStack.push ( this );
073    
074           comparisonMiniNode.checkSemantics ( parentMiniNodeStack );
075           statementSequenceMiniNode.checkSemantics ( parentMiniNodeStack );
076    
077           parentMiniNodeStack.pop ( );
078         }
079    
080         //////////////////////////////////////////////////////////////////////
081         //////////////////////////////////////////////////////////////////////
082         }