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 ExpressionThe left hand sideprivate intThe arithmetic operationprivate ExpressionThe right hand sideprivate booleanIndicates that this assignment is a text value assignment.Fields inherited from class Expression
backLink, typeFields inherited from class SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDefault constructor used by Attribute File I/OAssignmentOperation(Expression lhs, int opr, Expression rhs) AssignmentOperation. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbuildArrayParameter(Parameter par, VariableExpression var, boolean assignRef, CodeBuilder codeBuilder) ClassFile coding utility: Build Array Parameterprivate voidbuildAssignment(CodeBuilder codeBuilder) ClassFile coding utility: Build Assigment.voidbuildEvaluation(Expression rightPart, CodeBuilder codeBuilder) Build Java ByteCode.private voidbuildSimpleParameter(Parameter par, VariableExpression var, boolean assignRef, CodeBuilder codeBuilder) ClassFile coding utility: Build Simple Parameterprivate voidbuildTextValueAssignment(CodeBuilder codeBuilder) ClassFile coding utility: Build Text Value Assignment.private StringdoAccessRemoteArray(Expression beforeDot, VariableExpression array, String rightPart) Coding Utility: Code access remote array.voidPerform semantic checking.private StringJava Coding Utility: Code assignment.private StringJava Coding Utility: Code text value assignment.booleanReturns true if this expression may be used as a statement.static AssignmentOperationRead and return an AssignmentOperation.Generate Java code for this Syntax Class.toString()private booleantryRemoteArray(RemoteVariable remvar, CodeBuilder codeBuilder) ClassFile coding utility: Try to build remote array.voidWrite a SyntaxClass object to a AttributeOutputStream.Methods inherited from class Expression
acceptExpression, checkCompatibility, evaluate, expectExpression, get, getInt, getNumber, getQualification, getWriteableVariable, printTree, putMethods inherited from class 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:SyntaxClassPerform semantic checking.
This must be redefined in every subclass.
- Overrides:
doCheckingin classSyntaxClass
-
maybeStatement
public boolean maybeStatement()Description copied from class:ExpressionReturns true if this expression may be used as a statement.- Specified by:
maybeStatementin classExpression- Returns:
- true if this expression may be used as a statement
-
toJavaCode
Description copied from class:SyntaxClassGenerate Java code for this Syntax Class.- Overrides:
toJavaCodein 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:
buildEvaluationin 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:
toStringin classExpression
-
writeObject
Description copied from class:SyntaxClassWrite a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObjectin 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.
-