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 VariableExpressionLink to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
Controls semantic checking.int
The source line number -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Assert that semantic checking done.void
Perform semantic checking.void
Output possible declaration code.void
Output Java code.static String
edIndent
(int indent) Utility: Returns a number of blanks.protected String
edTreeIndent
(int indent) Utility: Returns a number of blanks followed by qualification of thisprotected boolean
Returns true if semantic checking is done.void
print
(int indent) Utility print method.void
printTree
(int indent) Utility print syntax tree method.protected void
Set semantic checked.Generate Java code for this Syntax Class.
-
Field Details
-
CHECKED
private boolean CHECKEDControls semantic checking.Set true when the method doChecking() has been completed.
-
lineNumber
public int lineNumberThe 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
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
Utility: Returns a number of blanks followed by qualification of this- Parameters:
indent
- the number of blanks requested- Returns:
- the resulting string
-
edIndent
Utility: Returns a number of blanks.- Parameters:
indent
- the number of blanks requested- Returns:
- a number of blanks.
-