Class WhileStatement
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.statement.Statement
simula.compiler.syntaxClass.statement.WhileStatement
While Statement.
Simula Standard: 4.3 While-statement while-statement = WHILE Boolean-expression DO Statement
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Expression
The WHILE conditionprivate Statement
The statement after DOFields inherited from class simula.compiler.syntaxClass.SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Default constructor used by Attribute File I/O(package private)
WhileStatement
(int line) Create a new WhileStatement. -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildByteCode
(CodeBuilder codeBuilder) Build Java ByteCode.void
Perform semantic checking.void
Output Java code.private boolean
Check if this while statement is a 'while true do'.void
Utility print syntax tree method.static WhileStatement
Read and return a WhileStatement object.toString()
void
Write a SyntaxClass object to a AttributeOutputStream.Methods inherited from class simula.compiler.syntaxClass.statement.Statement
expectStatement
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED, setLineNumber, toJavaCode
-
Field Details
-
condition
The WHILE condition -
doStatement
The statement after DO
-
-
Constructor Details
-
WhileStatement
WhileStatement(int line) Create a new WhileStatement.- Parameters:
line
- the source line number
-
WhileStatement
private WhileStatement()Default constructor used by Attribute File I/O
-
-
Method Details
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.
This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
doJavaCoding
public void doJavaCoding()Description copied from class:SyntaxClass
Output Java code.- Overrides:
doJavaCoding
in classStatement
-
isWhileTrueDo
private boolean isWhileTrueDo()Check if this while statement is a 'while true do'.- Returns:
- true if this while statement is a 'while true do'
-
buildByteCode
Description copied from class:Statement
Build Java ByteCode.- Overrides:
buildByteCode
in classStatement
- Parameters:
codeBuilder
- the codeBuilder to use.
-
printTree
Description copied from class:SyntaxClass
Utility print syntax tree method.- Overrides:
printTree
in classSyntaxClass
- Parameters:
indent
- number of spaces leading the lineshead
- the head of the tree.
-
toString
-
writeObject
Description copied from class:SyntaxClass
Write a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObject
in classSyntaxClass
- Parameters:
oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readObject
Read and return a WhileStatement object.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the WhileStatement object read from the stream.
- Throws:
IOException
- if something went wrong.
-