java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
simula.compiler.syntaxClass.declaration.DeclarationScope
simula.compiler.syntaxClass.declaration.BlockDeclaration
simula.compiler.syntaxClass.declaration.ProcedureDeclaration
- All Implemented Interfaces:
Externalizable
,Serializable
- Direct Known Subclasses:
StandardProcedure
,SwitchDeclaration
public sealed class ProcedureDeclaration
extends BlockDeclaration
implements Externalizable
permits StandardProcedure, SwitchDeclaration
Procedure Declaration.
Simula Standard: 5.4 Procedure declaration procedure-declaration = [ type ] PROCEDURE procedure-heading ; procedure-body procedure-heading = procedure-identifier [ formal-parameter-part ; [ mode-part ] specification-part ] 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 } procedure-body = statementThis class is prefix to StandardProcedure and SwitchDeclaration.
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class simula.compiler.syntaxClass.declaration.Declaration
Declaration.Kind
-
Field Summary
Modifier and TypeFieldDescriptionVirtual Match indicator.Parameter list.Fields inherited from class simula.compiler.syntaxClass.declaration.BlockDeclaration
isContextFree, isMainModule, isPreCompiled, labelcodeList, lastLineNumber, statements
Fields inherited from class simula.compiler.syntaxClass.declaration.DeclarationScope
ctBlockLevel, currentRTBlockLevel, declarationList, hasLocalClasses, labelList, rtBlockLevel, sourceBlockLevel
Fields inherited from class simula.compiler.syntaxClass.declaration.Declaration
declarationKind, declaredIn, externalIdent, identifier, isProtected, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
ModifierConstructorDescriptionDefault constructor used by Externalization.protected
ProcedureDeclaration
(String identifier, Declaration.Kind declarationKind) Create a new ProcedureDeclaration. -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
acceptModePart
(Vector<Parameter> pList) Parse Utility: Accept mode-part and set matching parameter's mode.protected void
Coding Utility: codeProcedureBody.void
Perform semantic checking.private void
Generate Java source code for the constructor.private void
Generate Java source code prepared for 'call formal procedure'.void
Output Java code.private void
doMethodJavaCoding
(String modifier, boolean addStaticLink) Generate Inline Method code for Procedure.private void
Generate java source code for this Procedure.private String
edFormalParameterList
(boolean isInlineMethod, boolean addStaticLink) Edit the formal parameter listprivate static void
Parse Utility: Expect procedure-body.static ProcedureDeclaration
Parse and build a ProcedureDeclaration.private static void
Parse Utility: Accept Procedure Parameter specification-part updating Parameter's type and kind.Find visible attribute's Meaningvoid
print
(int indent) Utility print method.void
printTree
(int indent) Utility print syntax tree method.void
readExternal
(ObjectInput inpt) toString()
void
writeExternal
(ObjectOutput oupt) Methods inherited from class simula.compiler.syntaxClass.declaration.BlockDeclaration
addLeadingLabel, codeStatements, codeSTMBody, doCheckLabelList, expectFormalParameterPart, hasLabel, isBlockWithLocalClasses, isQPSystemBlock, printStatementList
Methods inherited from class simula.compiler.syntaxClass.declaration.DeclarationScope
edCTX, edCTX, edJavaClassName, edScopeChain, findLabelMeaning, findMeaning, findProcedure, printDeclarationList, scopeID
Methods inherited from class simula.compiler.syntaxClass.declaration.Declaration
getJavaIdentifier, isCompatibleClasses, modifyIdentifier, parseDeclaration
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, SET_SEMANTICS_CHECKED, toJavaCode
-
Field Details
-
parameterList
Parameter list. -
myVirtual
Virtual Match indicator.If myVirtual != null, this Procedure is a Virtual Match.
Set during doChecking.
-
-
Constructor Details
-
ProcedureDeclaration
Create a new ProcedureDeclaration.- Parameters:
identifier
- procedure identifierdeclarationKind
- procedure or switch
-
ProcedureDeclaration
public ProcedureDeclaration()Default constructor used by Externalization.
-
-
Method Details
-
expectProcedureDeclaration
Parse and build a ProcedureDeclaration.Syntax: procedure-declaration = [ type ] PROCEDURE procedure-heading ; procedure-body procedure-heading = procedure-identifier [ formal-parameter-part ; [ mode-part ] specification-part ] procedure-identifier = identifier
Precondition: [ type ] PROCEDURE is already read.- Parameters:
type
- procedure's type- Returns:
- a newly created ProcedureDeclaration
-
acceptModePart
Parse Utility: Accept mode-part and set matching parameter's mode.mode-part = name-part [ value-part ] | value-part [ name-part ] name-part = NAME identifier-list ; value-part = VALUE identifier-list ; identifier-list = identifier { , identifier }
- Parameters:
pList
- the parameter list
-
expectSpecificationPart
Parse Utility: Accept Procedure Parameter specification-part updating Parameter's type and kind.Syntax: specification-part = specifier identifier-list { ; specifier identifier-list } specifier = Type | [Type] ARRAY | [Type] PROCEDURE ] | LABEL | SWITCH
- Parameters:
proc
- the procedure declaration
-
expectProcedureBody
Parse Utility: Expect procedure-body. In case of a compound-statement, updating the procedure's declaration and statement lists.Syntax: procedure-body = statement
- Parameters:
proc
- the procedure
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
findVisibleAttributeMeaning
Description copied from class:DeclarationScope
Find visible attribute's Meaning- Overrides:
findVisibleAttributeMeaning
in classDeclarationScope
- Parameters:
ident
- attribute identifier- Returns:
- the resulting Meaning
-
doJavaCoding
public void doJavaCoding()Description copied from class:SyntaxClass
Output Java code.- Overrides:
doJavaCoding
in classSyntaxClass
-
doMethodJavaCoding
Generate Inline Method code for Procedure.- Parameters:
modifier
- mthod modifier: "static " or ""addStaticLink
- add static link as 0'th parameter
-
edFormalParameterList
Edit the formal parameter list- Parameters:
isInlineMethod
- true if generating an inline method, otherwise falseaddStaticLink
- add static link as 0'th parameter- Returns:
- the resulting Java code
-
doProcedureCoding
private void doProcedureCoding()Generate java source code for this Procedure. -
doCodeConstructor
private void doCodeConstructor()Generate Java source code for the constructor. -
doCodePrepareFormal
private void doCodePrepareFormal()Generate Java source code prepared for 'call formal procedure'. -
codeProcedureBody
protected void codeProcedureBody()Coding Utility: codeProcedureBody. Redefined in SwitchDeclaration. -
print
public void print(int indent) Description copied from class:SyntaxClass
Utility print method.- Overrides:
print
in classSyntaxClass
- 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 classSyntaxClass
- Parameters:
indent
- number of spaces leading the lines
-
toString
- Overrides:
toString
in classBlockDeclaration
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-