🤔 Add a type inference engine, along with typed literals. #4

Merged
acw merged 25 commits from acw/type-checker into develop 2023-09-19 20:40:05 -07:00
2 changed files with 11 additions and 11 deletions
Showing only changes of commit d0a7beb13d - Show all commits

View File

@@ -12,12 +12,12 @@ path = "src/lib.rs"
clap = { version = "^3.0.14", features = ["derive"] }
codespan = "0.11.1"
codespan-reporting = "0.11.1"
cranelift-codegen = "0.94.0"
cranelift-jit = "0.94.0"
cranelift-frontend = "0.94.0"
cranelift-module = "0.94.0"
cranelift-native = "0.94.0"
cranelift-object = "0.94.0"
cranelift-codegen = "0.99.1"
cranelift-jit = "0.99.1"
cranelift-frontend = "0.99.1"
cranelift-module = "0.99.1"
cranelift-native = "0.99.1"
cranelift-object = "0.99.1"
internment = { version = "0.7.0", default-features = false, features = ["arc"] }
lalrpop-util = "^0.20.0"
lazy_static = "^1.4.0"

View File

@@ -37,7 +37,7 @@ use crate::syntax::ConstantType;
use cranelift_codegen::settings::Configurable;
use cranelift_codegen::{isa, settings};
use cranelift_jit::{JITBuilder, JITModule};
use cranelift_module::{default_libcall_names, DataContext, DataId, FuncId, Linkage, Module};
use cranelift_module::{default_libcall_names, DataDescription, DataId, FuncId, Linkage, Module};
use cranelift_object::{ObjectBuilder, ObjectModule};
use std::collections::HashMap;
use target_lexicon::Triple;
@@ -55,7 +55,7 @@ const EMPTY_DATUM: [u8; 8] = [0; 8];
/// implementations.
pub struct Backend<M: Module> {
pub module: M,
data_ctx: DataContext,
data_ctx: DataDescription,
runtime_functions: RuntimeFunctions,
defined_strings: HashMap<String, DataId>,
defined_symbols: HashMap<String, (DataId, ConstantType)>,
@@ -85,7 +85,7 @@ impl Backend<JITModule> {
Ok(Backend {
module,
data_ctx: DataContext::new(),
data_ctx: DataDescription::new(),
runtime_functions,
defined_strings: HashMap::new(),
defined_symbols: HashMap::new(),
@@ -123,7 +123,7 @@ impl Backend<ObjectModule> {
Ok(Backend {
module,
data_ctx: DataContext::new(),
data_ctx: DataDescription::new(),
runtime_functions,
defined_strings: HashMap::new(),
defined_symbols: HashMap::new(),
@@ -154,7 +154,7 @@ impl<M: Module> Backend<M> {
let global_id = self
.module
.declare_data(&name, Linkage::Local, false, false)?;
let mut data_context = DataContext::new();
let mut data_context = DataDescription::new();
data_context.set_align(8);
data_context.define(s0.into_boxed_str().into_boxed_bytes());
self.module.define_data(global_id, &data_context)?;