java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.statement.Statement
simula.compiler.syntaxClass.statement.StandaloneExpression
Standalone Expression Statement.
Syntax: standalone-expression = expression | assignment-statement assignment-statement = expression { assignment-operator expression }Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
ConstructorDescriptionStandaloneExpression
(int line, Expression expression) Create a new StandaloneExpression. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform semantic checking.void
Output Java code.private static Expression
Parse a standalone expression.void
print
(int indent) Utility print method.void
printTree
(int indent) Utility print syntax tree method.Generate Java code for this Syntax Class.toString()
Methods inherited from class simula.compiler.syntaxClass.statement.Statement
expectStatement
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, SET_SEMANTICS_CHECKED
-
Field Details
-
expression
The expression.
-
-
Constructor Details
-
StandaloneExpression
StandaloneExpression(int line, Expression expression) Create a new StandaloneExpression.- Parameters:
line
- the source line numberexpression
- the expression
-
-
Method Details
-
expectStandaloneExpression
Parse a standalone expression.Syntax: standalone-expression = expression { assignment-operator expression }
Pre-Condition: First expression is already read.- Returns:
- the resulting StandaloneExpression
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
doJavaCoding
public void doJavaCoding()Description copied from class:SyntaxClass
Output Java code.- Overrides:
doJavaCoding
in classStatement
-
toJavaCode
Description copied from class:SyntaxClass
Generate Java code for this Syntax Class.- Overrides:
toJavaCode
in classSyntaxClass
- Returns:
- Java code
-
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
-