Trait Backend

Source
pub trait Backend {
    // Required methods
    fn name(&self) -> &'static str;
    fn validate(prog: &Context) -> CalyxResult<()>;
    fn emit(prog: &Context, write: &mut OutputFile) -> CalyxResult<()>;
    fn link_externs(prog: &Context, write: &mut OutputFile) -> CalyxResult<()>;

    // Provided method
    fn run(&self, prog: Context, file: OutputFile) -> CalyxResult<()> { ... }
}
Expand description

A backend for Calyx.

Required Methods§

Source

fn name(&self) -> &'static str

The name of this backend.

Source

fn validate(prog: &Context) -> CalyxResult<()>

Validate this program for emitting using this backend. Returns an Err(..) if the program has unexpected constructs.

Source

fn emit(prog: &Context, write: &mut OutputFile) -> CalyxResult<()>

Transforms the program into a formatted string representing a valid and write it to write.

Link the extern collected while parsing the program.

Provided Methods§

Source

fn run(&self, prog: Context, file: OutputFile) -> CalyxResult<()>

Convience function to validate and emit the program.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§