Class AssignmentOperation


public final class AssignmentOperation extends Expression

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 Details

    • lhs

      private Expression lhs
      The left hand side
    • opr

      private int opr
      The arithmetic operation
    • rhs

      private Expression rhs
      The right hand side
    • textValueAssignment

      private boolean textValueAssignment
      Indicates that this assignment is a text value assignment.
  • Constructor Details

    • AssignmentOperation

      public AssignmentOperation(Expression lhs, int opr, Expression rhs)
      AssignmentOperation.
      Parameters:
      lhs - the left hand side
      opr - the operation
      rhs - 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 class SyntaxClass
    • maybeStatement

      public boolean maybeStatement()
      Description copied from class: Expression
      Returns true if this expression may be used as a statement.
      Specified by:
      maybeStatement in class Expression
      Returns:
      true if this expression may be used as a statement
    • toJavaCode

      public String toJavaCode()
      Description copied from class: SyntaxClass
      Generate Java code for this Syntax Class.
      Overrides:
      toJavaCode in class SyntaxClass
      Returns:
      Java code
    • doCodeTextValueAssignment

      private String doCodeTextValueAssignment()
      Java Coding Utility: Code text value assignment.
      Returns:
      the resulting Java source code
    • doCodeAssignment

      private String 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 dot
      array - the array variable
      rightPart - right part of assignment
      Returns:
      the resulting Java source code
    • buildEvaluation

      public void buildEvaluation(Expression rightPart, CodeBuilder codeBuilder)
      Build Java ByteCode.
      Specified by:
      buildEvaluation in class Expression
      Parameters:
      rightPart - expression
      codeBuilder - the codeBuilder used.
    • buildTextValueAssignment

      private void buildTextValueAssignment(CodeBuilder codeBuilder)
      ClassFile coding utility: Build Text Value Assignment.
      Parameters:
      codeBuilder - the codeBuilder to use.
    • buildAssignment

      private void buildAssignment(CodeBuilder codeBuilder)
      ClassFile coding utility: Build Assigment.
      Parameters:
      codeBuilder - the codeBuilder to use.
    • tryRemoteArray

      private boolean tryRemoteArray(RemoteVariable remvar, CodeBuilder codeBuilder)
      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 parameter
      var - the variable
      assignRef - 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 parameter
      var - the variable
      assignRef - true: assign by reference.
      codeBuilder - the codeBuilder to use.
    • toString

      public String toString()
      Overrides:
      toString in class Expression
    • writeObject

      public void writeObject(AttributeOutputStream oupt) throws IOException
      Description copied from class: SyntaxClass
      Write a SyntaxClass object to a AttributeOutputStream.
      Overrides:
      writeObject in class SyntaxClass
      Parameters:
      oupt - the AttributeOutputStream to write to.
      Throws:
      IOException - if something went wrong.
    • readObject

      public static AssignmentOperation readObject(AttributeInputStream inpt) throws IOException
      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.