Class ProcedureSpecification

java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.ProcedureSpecification

public final class ProcedureSpecification extends SyntaxClass

Procedure Specification.

Simula Standard: 5.5.3 Virtual quantities
Simula Standard: 6.3 External procedure declaration

procedure-specification
    = [ type ] PROCEDURE procedure-identifier procedure-head empty-body
    
   procedure-head
       = [ formal-parameter-part ; [ mode-part ] specification-part  ] ;
        
   empty-body = dummy-statement

   procedure-identifier = identifier

      formal-parameter-part = "(" formal-parameter { , formal-parameter } ")"
      
         formal-parameter = identifier
         
      specification-part = specifier identifier-list ; { specifier identifier-list ; }
      
         specifier
            = type [ array | procedure ]
            | label
            | switch
            
      mode-part 
         = name-part [ value-part ]
         | value-part [ name-part ]
         
         name-part = name identifier-list ;
         value-part = value identifier-list ;
         
            identifier-list = identifier { , identifier }

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • identifier

      private String identifier
      The procedure identifier.
    • type

      public Type type
      The procedure's type.
    • parameterList

      public ObjectList<Parameter> parameterList
      The parameter list.
  • Constructor Details

    • ProcedureSpecification

      public ProcedureSpecification(String identifier, Type type, ObjectList<Parameter> pList)
      Create a new ProcedureSpecification
      Parameters:
      identifier - procedure-identifier
      type - procedure's type or null
      pList - the parameter lList
    • ProcedureSpecification

      public ProcedureSpecification()
      Default constructor used by Attribute File I/O
  • Method Details

    • expectProcedureSpecification

      public static ProcedureSpecification expectProcedureSpecification(Type type)

      Procedure Specification.

      Syntax:
      
      procedure-specification
          = [ type ] PROCEDURE procedure-identifier procedure-head empty-body
          
         procedure-head
             = [ formal-parameter-part ; [ mode-part ] procedure-specification-part  ] ;
              
         empty-body = dummy-statement
      
         procedure-identifier = identifier
      
      

      Precondition: type PROCEDURE is already read.

      Parameters:
      type - procedure's type
      Returns:
      a newly created ProcedureSpecification
    • doChecking

      public void doChecking(DeclarationScope scope)
      Perform semantic checking.
      Parameters:
      scope - the DeclarationScope
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeProcedureSpec

      public static void writeProcedureSpec(ProcedureSpecification spec, AttributeOutputStream oupt) throws IOException
      Write a ProcedureSpecification.
      Parameters:
      spec - the ProcedureSpecification.
      oupt - the AttributeOutputStream.
      Throws:
      IOException - if something went wrong.
    • readProcedureSpec

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