Class GotoStatement
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.statement.Statement
simula.compiler.syntaxClass.statement.GotoStatement
Goto Statement.
Simula Standard: 4.5 Goto-statement goto-statement = GOTO designational-expression | GO TO designational-expression
Java does not support labels like Simula. The Java Virtual Machine (JVM), however, has labels. A JVM-label is simply a relative byte-address within the byte-code of a method. We will use Java's exception handling together with byte code engineering to re-introduce goto in the Java Language. This is done by generating Java-code which is prepared for Byte Code Engineering.
See Mapping Simula to Java (runtime design) Sect. 6.1 Goto Statement
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Field Summary
FieldsFields inherited from class simula.compiler.syntaxClass.SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor used by Attribute File I/OGotoStatement
(int line) Create a new GotoStatement. -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildByteCode
(CodeBuilder codeBuilder) Build Java ByteCode.void
Perform semantic checking.void
Output Java code.private boolean
Check if label is a parameter procedure.void
Utility print syntax tree method.static GotoStatement
Read and return a GotoStatement 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
-
label
The target label.
-
-
Constructor Details
-
GotoStatement
GotoStatement(int line) Create a new GotoStatement.- Parameters:
line
- source line
-
GotoStatement
public GotoStatement()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
-
buildByteCode
Description copied from class:Statement
Build Java ByteCode.- Overrides:
buildByteCode
in classStatement
- Parameters:
codeBuilder
- the codeBuilder to use.
-
labelIsParameterProcedure
private boolean labelIsParameterProcedure()Check if label is a parameter procedure.- Returns:
- true: if label is a parameter procedure.
-
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 GotoStatement object.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the GotoStatement object read from the stream.
- Throws:
IOException
- if something went wrong.
-