Represents a stateful object which is responsible for constructing the IR of a Tact project.

It creates a one-statement-per-basic-block CFG.

Methods

  • Recursively processes an array of AST statements to generate nodes and edges for a Cfg.

    Parameters

    • statements: readonly AstStatement[]

      The array of AstStatement objects.

    • bbs: BasicBlock[] = []

      An optional array of basic blocks to which new nodes will be added.

    • edges: Edge[] = []

      An optional array of Edge objects to which new edges will be added.

    • lastBBIdxes: BasicBlockIdx[] = []

      An optional indices representing from which control flow enters the current sequence of statements.

    Returns [BasicBlock[], Edge[]]

    A tuple containing the arrays of BasicBlock and Edge objects representing the Cfg derived from the statements.