Class AssignmentOperation
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.expression.Expression
simula.compiler.syntaxClass.expression.AssignmentOperation
Assignment Operation.
The Simula assignment statement is for convenience implemented as an assignment operation.
Simula Standard: 4.1 Assignment statements assignment-operation = expression assignment-operator expression assignment-operator = := | :-
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Expression
The left hand sideprivate int
The arithmetic operationprivate Expression
The right hand sideprivate boolean
Indicates that this assignment is a text value assignment.Fields inherited from class simula.compiler.syntaxClass.expression.Expression
backLink, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Default constructor used by Attribute File I/OAssignmentOperation
(Expression lhs, int opr, Expression rhs) AssignmentOperation. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
buildArrayParameter
(Parameter par, VariableExpression var, boolean assignRef, CodeBuilder codeBuilder) ClassFile coding utility: Build Array Parameterprivate void
buildAssignment
(CodeBuilder codeBuilder) ClassFile coding utility: Build Assigment.void
buildEvaluation
(Expression rightPart, CodeBuilder codeBuilder) Build Java ByteCode.private void
buildSimpleParameter
(Parameter par, VariableExpression var, boolean assignRef, CodeBuilder codeBuilder) ClassFile coding utility: Build Simple Parameterprivate void
buildTextValueAssignment
(CodeBuilder codeBuilder) ClassFile coding utility: Build Text Value Assignment.private String
doAccessRemoteArray
(Expression beforeDot, VariableExpression array, String rightPart) Coding Utility: Code access remote array.void
Perform semantic checking.private String
Java Coding Utility: Code assignment.private String
Java Coding Utility: Code text value assignment.boolean
Returns true if this expression may be used as a statement.static AssignmentOperation
Read and return an AssignmentOperation.Generate Java code for this Syntax Class.toString()
private boolean
tryRemoteArray
(RemoteVariable remvar, CodeBuilder codeBuilder) ClassFile coding utility: Try to build remote array.void
Write a SyntaxClass object to a AttributeOutputStream.Methods inherited from class simula.compiler.syntaxClass.expression.Expression
acceptExpression, checkCompatibility, evaluate, expectExpression, get, getInt, getNumber, getQualification, getWriteableVariable, printTree, put
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, buildByteCode, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED, setLineNumber
-
Field Details
-
lhs
The left hand side -
opr
private int oprThe arithmetic operation -
rhs
The right hand side -
textValueAssignment
private boolean textValueAssignmentIndicates that this assignment is a text value assignment.
-
-
Constructor Details
-
AssignmentOperation
AssignmentOperation.- Parameters:
lhs
- the left hand sideopr
- the operationrhs
- the right hand side
-
AssignmentOperation
private AssignmentOperation()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
-
maybeStatement
public boolean maybeStatement()Description copied from class:Expression
Returns true if this expression may be used as a statement.- Specified by:
maybeStatement
in classExpression
- Returns:
- true if this expression may be used as a statement
-
toJavaCode
Description copied from class:SyntaxClass
Generate Java code for this Syntax Class.- Overrides:
toJavaCode
in classSyntaxClass
- Returns:
- Java code
-
doCodeTextValueAssignment
Java Coding Utility: Code text value assignment.- Returns:
- the resulting Java source code
-
doCodeAssignment
Java Coding Utility: Code assignment.- Returns:
- the resulting Java source code
-
doAccessRemoteArray
private String doAccessRemoteArray(Expression beforeDot, VariableExpression array, String rightPart) Coding Utility: Code access remote array.- Parameters:
beforeDot
- expression before dotarray
- the array variablerightPart
- right part of assignment- Returns:
- the resulting Java source code
-
buildEvaluation
Build Java ByteCode.- Specified by:
buildEvaluation
in classExpression
- Parameters:
rightPart
- expressioncodeBuilder
- the codeBuilder used.
-
buildTextValueAssignment
ClassFile coding utility: Build Text Value Assignment.- Parameters:
codeBuilder
- the codeBuilder to use.
-
buildAssignment
ClassFile coding utility: Build Assigment.- Parameters:
codeBuilder
- the codeBuilder to use.
-
tryRemoteArray
ClassFile coding utility: Try to build remote array.- Parameters:
remvar
- remote variable.codeBuilder
- the codeBuilder to use.- Returns:
- true: if success.
-
buildSimpleParameter
private void buildSimpleParameter(Parameter par, VariableExpression var, boolean assignRef, CodeBuilder codeBuilder) ClassFile coding utility: Build Simple Parameter- Parameters:
par
- the parametervar
- the variableassignRef
- true: assign by reference.codeBuilder
- the codeBuilder to use.
-
buildArrayParameter
private void buildArrayParameter(Parameter par, VariableExpression var, boolean assignRef, CodeBuilder codeBuilder) ClassFile coding utility: Build Array Parameter- Parameters:
par
- the parametervar
- the variableassignRef
- true: assign by reference.codeBuilder
- the codeBuilder to use.
-
toString
- Overrides:
toString
in classExpression
-
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 an AssignmentOperation.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the AssignmentOperation read from the stream.
- Throws:
IOException
- if something went wrong.
-