rusty-cheddar icon indicating copy to clipboard operation
rusty-cheddar copied to clipboard

Create interfaces to popular languages (python, ruby, etc.)

Open Sean1708 opened this issue 9 years ago • 2 comments

Probably require moving to a ParseSess based error handling.

Store the languages requested as a vector of trait-objects.

Hopefully be able to stop special casing C (so generating a header file would just be a case of requesting the C interface).

Sean1708 avatar Jan 12 '16 20:01 Sean1708

It would be great to have the entire compiling logic as a trait, then people could implement their own languages.

Sean1708 avatar Jan 12 '16 20:01 Sean1708

Maybe something along the lines of

struct Options {
    module: syntax::ast::Path,
    compiler: Vec<Box<Compiler>>,
}

struct Cheddar {
    input: Source,
    // So that all interfaces are put in the same place.
    output_dir: PathBuf
    options: Options,
    custom: String,
    session: syntax::parse::ParseSess,
}

trait Compiler {
    fn compile_type(new: Ident, old: Ty);
    fn compile_fn(name: Ident, params: ..., return: ...);
    ...
}

Sean1708 avatar Jan 12 '16 20:01 Sean1708