Package com.tonic.analysis.source.lower
Class ExpressionLowerer
- java.lang.Object
-
- com.tonic.analysis.source.lower.ExpressionLowerer
-
public class ExpressionLowerer extends Object
Lowers AST Expression nodes to IR instructions.
-
-
Constructor Summary
Constructors Constructor Description ExpressionLowerer(LoweringContext ctx)Creates a new expression lowerer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Valuelower(Expression expr)Lowers an expression and returns the SSAValue result.voidlowerCondition(Expression condition, IRBlock trueTarget, IRBlock falseTarget)Lowers a condition expression for control flow (if/while/for).
-
-
-
Constructor Detail
-
ExpressionLowerer
public ExpressionLowerer(LoweringContext ctx)
Creates a new expression lowerer.- Parameters:
ctx- the lowering context
-
-
Method Detail
-
lowerCondition
public void lowerCondition(Expression condition, IRBlock trueTarget, IRBlock falseTarget)
Lowers a condition expression for control flow (if/while/for).- Parameters:
condition- the condition expressiontrueTarget- block to branch to if condition is truefalseTarget- block to branch to if condition is false
-
lower
public Value lower(Expression expr)
Lowers an expression and returns the SSAValue result.- Parameters:
expr- the source expression to lower- Returns:
- the value the lowered instructions produce
- Throws:
LoweringException- if the expression form is unsupported or cannot be resolved
-
-