pulsar_backend/lib.rs
1//! The pulsar backend is currently under construction. The goal is for a
2//! modular but expressive (in e.g. output file location) interface. A
3//! [`calyx_backend::CalyxBackend`] is under construction.
4//!
5//! Copyright (C) 2024 Ethan Uppal. All rights reserved.
6
7use pulsar_ir::generator::GeneratedTopLevel;
8use std::path::PathBuf;
9
10pub mod calyx;
11
12// This interface hasn't been finalized yet, so it is quite sloppy as written
13
14pub enum Output {
15 Stdout,
16 Stderr,
17 File(PathBuf)
18}
19
20pub trait PulsarBackend {
21 type InitInput;
22 type Error;
23
24 /// Initializes the backend.
25 fn new(input: Self::InitInput) -> Self;
26
27 /// Consumes the backend and produces an output.
28 fn run(
29 self, code: Vec<GeneratedTopLevel>, output: Output
30 ) -> Result<(), Self::Error>;
31}