Class SyntaxClass

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

public abstract class SyntaxClass extends Object

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 
                 UndefinedDeclaration 
                 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

      protected boolean CHECKED

      Controls semantic checking.

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

    • OBJECT_SEQU

      public int OBJECT_SEQU

      Object sequence number used by Attribute File I/O to fixup object references.

      During Attribute File Input it is index to the Object Reference Table. See: Global.Object_SEQU

    • lineNumber

      public int lineNumber
      The source line number
  • Constructor Details

    • SyntaxClass

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

    • setLineNumber

      protected void setLineNumber()
      Set source line number.
    • 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

      public 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 Java code.
    • doJavaCoding

      public void doJavaCoding()
      Output Java code.
    • toJavaCode

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

      public void buildByteCode(CodeBuilder codeBuilder)
      Build Java ClassFile ByteCode.
      Parameters:
      codeBuilder - the codeBuilder to use.
    • print

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

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

      public 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.
    • writeObject

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

      public static SyntaxClass readObject(AttributeInputStream inpt) throws IOException
      Read and return a SyntaxClass object.
      Parameters:
      inpt - the AttributeInputStream to read from
      Returns:
      the object read from the stream.
      Throws:
      IOException - if something went wrong.