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.MaybeBlockDeclaration
Maybe Block Declaration. I.e: CompoundStatement or SubBlock depends on
whether it contains declarations.
Simula Standard: 4.9 Compound statement Simula Standard: 4.9 Blocks MaybeBlockDeclaration = compound-statement | subblock compound-statement = BEGIN [ { statement ; } ] END subblock = BEGIN [ { declaration ; } ] [ { statement ; } ] ENDLink to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Nested Class Summary
Nested classes/interfaces inherited from class simula.compiler.syntaxClass.declaration.Declaration
Declaration.Kind
-
Field Summary
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
ConstructorDescriptionMaybeBlockDeclaration
(String identifier) Create a new MaybeBlockDeclaration. -
Method Summary
Modifier and TypeMethodDescriptionstatic MaybeBlockDeclaration
Create the main program block.void
Perform semantic checking.private void
Code utility: Code constructorprivate void
Code utility: Code statementsprivate void
Code utility: Code compound statementvoid
Output Java code.private void
Code utility: Code sub-blockFind visible attribute's Meaning(package private) static void
moveLabelsFrom
(DeclarationScope block) Utility: Moves labels from the givent block.parseMaybeBlock
(int line) Parse CompoundStatement or SubBlock.void
print
(int indent) Utility print method.void
printTree
(int indent) Utility print syntax tree method.toString()
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
-
Constructor Details
-
MaybeBlockDeclaration
Create a new MaybeBlockDeclaration.- Parameters:
identifier
- block identifier
-
-
Method Details
-
createMainProgramBlock
Create the main program block. Used by ProgramModule.- Returns:
- the main program block
-
parseMaybeBlock
Parse CompoundStatement or SubBlock.Syntax: Block = CompoundStatement | SubBlock CompoundStatement = BEGIN [ { Statement ; } ] END SubBlock = BEGIN [ { Declaration ; } ] [ { Statement ; } ] END
- Parameters:
line
- source line number- Returns:
- a BlockStatement
-
moveLabelsFrom
Utility: Moves labels from the givent block.Special case: Labels in a CompoundStatement or ConnectionBlock.
Move Label Declaration to nearest enclosing Block which is not a CompoundStatement or ConnectionBlock.
- Parameters:
block
- the block containing labels to be moved
-
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
-
doCompoundStatementCoding
private void doCompoundStatementCoding()Code utility: Code compound statement -
doSubBlockCoding
private void doSubBlockCoding()Code utility: Code sub-block -
doCodeConstructor
private void doCodeConstructor()Code utility: Code constructor -
doCodeStatements
private void doCodeStatements()Code utility: Code statements -
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
-