Module Simula

Class StandaloneExpression


public final class StandaloneExpression extends Statement
Standalone Expression Statement.
 
 Syntax:
 
   standalone-expression = expression | assignment-statement

      assignment-statement
           = expression { assignment-operator expression }

 
Link to GitHub: Source File.
Author:
Øystein Myhre Andersen
  • Field Details

    • expression

      private Expression expression
      The expression.
  • Constructor Details

    • StandaloneExpression

      StandaloneExpression(int line, Expression expression)
      Create a new StandaloneExpression.
      Parameters:
      line - the source line number
      expression - the expression
  • Method Details

    • expectStandaloneExpression

      private static Expression expectStandaloneExpression()
      Parse a standalone expression.
       Syntax:
       
          standalone-expression  =  expression  { assignment-operator  expression }
       
      Pre-Condition: First expression is already read.
      Returns:
      the resulting StandaloneExpression
    • doChecking

      public void doChecking()
      Description copied from class: SyntaxClass
      Perform semantic checking.

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • doJavaCoding

      public void doJavaCoding()
      Description copied from class: SyntaxClass
      Output Java code.
      Overrides:
      doJavaCoding in class 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
    • print

      public void print(int indent)
      Description copied from class: SyntaxClass
      Utility print method.
      Overrides:
      print in class SyntaxClass
      Parameters:
      indent - number of spaces leading the line
    • printTree

      public void printTree(int indent)
      Description copied from class: SyntaxClass
      Utility print syntax tree method.
      Overrides:
      printTree in class SyntaxClass
      Parameters:
      indent - number of spaces leading the lines
    • toString

      public String toString()
      Overrides:
      toString in class Object