Class ExpressionLowerer


  • public class ExpressionLowerer
    extends Object
    Lowers AST Expression nodes to IR instructions.
    • 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 expression
        trueTarget - block to branch to if condition is true
        falseTarget - 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