Class SyntaxClass
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
- Direct Known Subclasses:
ConnectionDoPart
,Declaration
,Expression
,ForListElement
,HiddenSpecification
,ProcedureSpecification
,ProtectedSpecification
,Statement
,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 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 Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Controls semantic checking.int
The source line numberint
Object sequence number used by Attribute File I/O to fixup object references. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Assert that semantic checking done.void
buildByteCode
(CodeBuilder codeBuilder) Build Java ClassFile ByteCode.void
Perform semantic checking.void
Output possible declaration Java code.void
Output Java code.static String
edIndent
(int indent) Utility: Returns a number of blanks.edTreeIndent
(int indent) Utility: Returns a number of blanks followed by qualification of thisboolean
Returns true if semantic checking is done.void
print
(int indent) Utility print method.void
Utility print syntax tree method.static SyntaxClass
Read and return a SyntaxClass object.protected void
Set semantic checked.protected void
Set source line number.Generate Java code for this Syntax Class.void
Write a SyntaxClass object to a AttributeOutputStream.
-
Field Details
-
CHECKED
protected boolean CHECKEDControls semantic checking.
Set true when the method doChecking() has been completed.
-
OBJECT_SEQU
public int OBJECT_SEQUObject 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 lineNumberThe 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
-
buildByteCode
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
Utility print syntax tree method.- Parameters:
indent
- number of spaces leading the lineshead
- the head of the tree.
-
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.
-
writeObject
Write a SyntaxClass object to a AttributeOutputStream.- Parameters:
oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readObject
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.
-