Sha256: beaf5bb5ba6b8ee14e5ded9be3f5374d1f46b4d211d9bbe04b504c19d8664aaf

Contents?: true

Size: 877 Bytes

Versions: 28

Compression:

Stored size: 877 Bytes

Contents

//! Compilation process, from AST to Sema to Sequences of Insts.

use std::path::Path;

use crate::error::Errors;
use crate::{ast, codegen, sema};

/// Compile the given AST definitions into Rust source code.
pub fn compile(defs: &ast::Defs, options: &codegen::CodegenOptions) -> Result<String, Errors> {
    let mut typeenv = sema::TypeEnv::from_ast(defs)?;
    let termenv = sema::TermEnv::from_ast(&mut typeenv, defs)?;
    let terms = crate::overlap::check(&typeenv, &termenv)?;
    Ok(codegen::codegen(&typeenv, &termenv, &terms, options))
}

/// Compile the given files into Rust source code.
pub fn from_files<P: AsRef<Path>>(
    inputs: impl IntoIterator<Item = P>,
    options: &codegen::CodegenOptions,
) -> Result<String, Errors> {
    let lexer = crate::lexer::Lexer::from_files(inputs)?;
    let defs = crate::parser::parse(lexer)?;
    compile(&defs, options)
}

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
wasmtime-24.0.0 ./ext/cargo-vendor/cranelift-isle-0.111.0/src/compile.rs
wasmtime-23.0.2 ./ext/cargo-vendor/cranelift-isle-0.110.2/src/compile.rs
wasmtime-22.0.0 ./ext/cargo-vendor/cranelift-isle-0.109.0/src/compile.rs
wasmtime-21.0.1 ./ext/cargo-vendor/cranelift-isle-0.108.1/src/compile.rs
wasmtime-20.0.2 ./ext/cargo-vendor/cranelift-isle-0.107.2/src/compile.rs
wasmtime-20.0.0 ./ext/cargo-vendor/cranelift-isle-0.107.2/src/compile.rs
wasmtime-18.0.3 ./ext/cargo-vendor/cranelift-isle-0.105.3/src/compile.rs
wasmtime-17.0.1 ./ext/cargo-vendor/cranelift-isle-0.104.1/src/compile.rs
wasmtime-17.0.0 ./ext/cargo-vendor/cranelift-isle-0.104.0/src/compile.rs
wasmtime-16.0.0 ./ext/cargo-vendor/cranelift-isle-0.103.0/src/compile.rs
wasmtime-15.0.1 ./ext/cargo-vendor/cranelift-isle-0.102.1/src/compile.rs
wasmtime-15.0.0 ./ext/cargo-vendor/cranelift-isle-0.102.1/src/compile.rs
wasmtime-14.0.4 ./ext/cargo-vendor/cranelift-isle-0.101.4/src/compile.rs
wasmtime-14.0.3 ./ext/cargo-vendor/cranelift-isle-0.101.4/src/compile.rs
wasmtime-14.0.1 ./ext/cargo-vendor/cranelift-isle-0.101.1/src/compile.rs
wasmtime-14.0.0 ./ext/cargo-vendor/cranelift-isle-0.101.1/src/compile.rs
wasmtime-13.0.0 ./ext/cargo-vendor/cranelift-isle-0.100.0/src/compile.rs
wasmtime-12.0.1 ./ext/cargo-vendor/cranelift-isle-0.99.1/src/compile.rs
wasmtime-12.0.0 ./ext/cargo-vendor/cranelift-isle-0.99.1/src/compile.rs
wasmtime-11.0.0 ./ext/cargo-vendor/cranelift-isle-0.98.1/src/compile.rs