Module Simula

Class SyntaxClass

java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
Direct Known Subclasses:
Declaration, Expression, HiddenSpecification, ProtectedSpecification, Statement, Type

public abstract sealed class SyntaxClass extends Object permits Declaration, Statement, Expression, HiddenSpecification, ProtectedSpecification, Type
The class SyntaxClass.

The Simula syntax is formally defined in the Simula Standard. Some non-terminal symbols give rise to a Java class with almost the same name. They are all subclasses of the class SyntaxClass. The subclass hierarchy of the Syntax class is described below

            SyntaxClass
               HiddenSpecification 
               ProtectedSpecification 
               Type 
                  OverLoad
               Declaration
                  ArrayDeclaration 
                  DeclarationScope
                     BlockDeclaration
                        ClassDeclaration 
                           PrefixedBlockDeclaration
                           StandardClass
                        MaybeBlockDeclaration
                        ProcedureDeclaration 
                           StandardProcedure
                           SwitchDeclaration
                     ConnectionBlock 
                  ExternalDeclaration
                  Parameter 
                  SimpleVariableDeclaration 
                     LabelDeclaration 
                  VirtualMatch 
                  VirtualSpecification 
               Statement
                  ActivationStatement
                  BlockStatement
                  ConditionalStatement
                  ConnectionStatement
                  DummyStatement
                  ForStatement
                  GotoStatement
                  InnerStatement
                  LabeledStatement
                  ProgramModule
                  StandaloneExpression
                  SwitchStatement
                  WhileStatement
               Expression
                  ArithmeticExpression
                  AssignmentOperation
                  BooleanExpression
                  ConditionalExpression
                  Constant 
                  LocalObject
                  ObjectGenerator
                  ObjectRelation
                  QualifiedObject
                  RelationalOperation
                  RemoteVariable
                  TextExpression
                  TypeConversion
                  UnaryOperation
                  VariableExpression          
 
Link to GitHub: Source File.
Author:
Øystein Myhre Andersen
  • Field Details

    • CHECKED

      private boolean CHECKED
      Controls semantic checking.

      Set true when the method doChecking() has been completed.

    • lineNumber

      public int lineNumber
      The source line number
  • Constructor Details

    • SyntaxClass

      protected SyntaxClass()
      Create a new SyntaxClass.
  • Method Details

    • doChecking

      public void doChecking()
      Perform semantic checking.

      This must be redefined in every subclass.

    • SET_SEMANTICS_CHECKED

      protected void SET_SEMANTICS_CHECKED()
      Set semantic checked.

      Should be called from all doChecking methods to signal that semantic checking is done.

    • IS_SEMANTICS_CHECKED

      protected boolean IS_SEMANTICS_CHECKED()
      Returns true if semantic checking is done.
      Returns:
      true if semantic checking is done
    • ASSERT_SEMANTICS_CHECKED

      protected void ASSERT_SEMANTICS_CHECKED()
      Assert that semantic checking done.
    • doDeclarationCoding

      public void doDeclarationCoding()
      Output possible declaration code.
    • doJavaCoding

      public void doJavaCoding()
      Output Java code.
    • toJavaCode

      public String toJavaCode()
      Generate Java code for this Syntax Class.
      Returns:
      Java code
    • print

      public void print(int indent)
      Utility print method.
      Parameters:
      indent - number of spaces leading the line
    • printTree

      public void printTree(int indent)
      Utility print syntax tree method.
      Parameters:
      indent - number of spaces leading the lines
    • edTreeIndent

      protected String edTreeIndent(int indent)
      Utility: Returns a number of blanks followed by qualification of this
      Parameters:
      indent - the number of blanks requested
      Returns:
      the resulting string
    • edIndent

      public static String edIndent(int indent)
      Utility: Returns a number of blanks.
      Parameters:
      indent - the number of blanks requested
      Returns:
      a number of blanks.