Class StmtInstrGenerator
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.StmtInstrGenerator
- All Implemented Interfaces:
Function<EK9Parser.StatementContext, List<IRInstr>>
public final class StmtInstrGenerator
extends AbstractGenerator
implements Function<EK9Parser.StatementContext, List<IRInstr>>
Creates IR instructions for statements.
Generates new BasicBlock IR (IRInstructions).
From the ANTLR grammar this has to support the following:
statement
: ifStatement
| assertStatement
| assignmentStatement
| identifierReference op=(INC | DEC)
| call
| throwStatement
| objectAccessExpression
| switchStatementExpression
| tryStatementExpression
| whileStatementExpression
| forStatementExpression
| streamStatement
;
MIGRATING TO STACK: Now uses stack context for scope management instead of parameter threading. Still maintains Function interface for incremental migration approach.
-
Field Summary
Fields inherited from class AbstractGenerator
debugInfoCreator, instructionBuilder, stackContext -
Constructor Summary
ConstructorsConstructorDescriptionStmtInstrGenerator(IRGenerationContext stackContext, GeneratorSet generators) Constructor accepting GeneratorSet for unified access to all generators. -
Method Summary
Modifier and TypeMethodDescriptionGenerate IR instructions for a statement using proper stack-based scope management.Methods inherited from class AbstractGenerator
createTempVariable, createTempVariableFromContext, extractReturnType, getRecordedSymbolOrException
-
Constructor Details
-
StmtInstrGenerator
StmtInstrGenerator(IRGenerationContext stackContext, GeneratorSet generators) Constructor accepting GeneratorSet for unified access to all generators.
-
-
Method Details
-
apply
Generate IR instructions for a statement using proper stack-based scope management. STACK-BASED: Gets scope ID from stack context instead of parameter threading.- Specified by:
applyin interfaceFunction<EK9Parser.StatementContext, List<IRInstr>>
-