Skip to content

Provide a basic OO interface for reading MIR from Dusk #92

@zachwolfe

Description

@zachwolfe

To start off with, we could have the compiler call some entry point after the MIR for the main function gets generated, like so:

mir :: import("std.dusk").mir

@mir.read_main
fn read_main(func: mir.Func) {
    print("Printing the name of main (you'll never guess what it is!): ")
    print(func.name)
    print("\n")

    for instr in func.entry_block.instructions {
        print(instr.kind)
        print("\n")
    }
}

The point of this is to allow for the x64 backend to be self-hosted via the interpreter. More support will be required to actually make this user-friendly. That work is out of scope for this issue. It will be sufficient for now to simply be able to access the code for the program after generating it, at compile-time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    high-priorityNeeds to get done right away

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions