about summary refs log tree commit diff stats
path: root/archive/2025/summer/msc_choi/codegen/src/lib.rs
blob: a89b2f8dd377b1a1d3838739e11137978104c374 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::collections::BTreeSet;

pub mod asl;

pub trait CodeGenerator {
    type E;

    fn new(
        ast_file_path: &str,
        decode_module_dir_path: &str,
        lift_module_path: &str,
        common_module_path: &str,
        supported_instructions: BTreeSet<String>,
    ) -> Result<Self, Self::E>
    where
        Self: Sized;

    fn generate_shared_code(&mut self) -> Result<(), Self::E>;

    fn generate_decode_logic(&mut self) -> Result<(), Self::E>;

    fn generate_lift_logic(&mut self) -> Result<(), Self::E>;

    fn write_to_files(&self) -> Result<(), Self::E>;
}