Documentation

Strata.Languages.Cortex.ToCore

Cortex to Core #

programToCore turns an ordered Cortex program into a Core program. Each procedure body becomes a Core CFG body (.cfg), block for block: labels, commands and transfers are kept, so no control flow is rebuilt. Core can type-check and print the result. The verifier (Core.verify) and the evaluator behind Core.Program.interpretEntries accept only structured bodies, so they do not run it.

Core's CFG type checker puts two requirements on the Cortex CFG:

Instances For
    Equations
    Instances For
      Equations
      Instances For

        The Core header of a procedure: its name and its parameters with monomorphic types. A body may assign only its outputs and its locals, so an assigned input that is not an output is an error: the CopyAssignedInputs pass replaces such an assignment by one to a local copy.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          A procedure's preconditions as Core's, labelled requires_<i>.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            A Cortex procedure as a Core procedure with a CFG body. A procedure without a body gets a structured body that assumes true.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              An ordered Cortex program as a Core program whose procedure bodies are CFGs.

              Equations
              Instances For