From 7abd49772643ee4e131ef47de66db22ba7c1e037 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 15 Dec 2019 19:47:20 +0000 Subject: Move contents of dhall under a semantics submodule --- dhall/src/core/context.rs | 145 ------ dhall/src/core/mod.rs | 4 - dhall/src/core/value.rs | 338 -------------- dhall/src/core/valuef.rs | 323 ------------- dhall/src/core/var.rs | 295 ------------ dhall/src/error/mod.rs | 179 -------- dhall/src/lib.rs | 5 +- dhall/src/phase/binary.rs | 748 ------------------------------ dhall/src/phase/mod.rs | 254 ---------- dhall/src/phase/normalize.rs | 794 -------------------------------- dhall/src/phase/parse.rs | 37 -- dhall/src/phase/resolve.rs | 180 -------- dhall/src/phase/typecheck.rs | 815 --------------------------------- dhall/src/semantics/core/context.rs | 145 ++++++ dhall/src/semantics/core/mod.rs | 4 + dhall/src/semantics/core/value.rs | 338 ++++++++++++++ dhall/src/semantics/core/valuef.rs | 323 +++++++++++++ dhall/src/semantics/core/var.rs | 295 ++++++++++++ dhall/src/semantics/error/mod.rs | 179 ++++++++ dhall/src/semantics/mod.rs | 3 + dhall/src/semantics/phase/binary.rs | 748 ++++++++++++++++++++++++++++++ dhall/src/semantics/phase/mod.rs | 254 ++++++++++ dhall/src/semantics/phase/normalize.rs | 794 ++++++++++++++++++++++++++++++++ dhall/src/semantics/phase/parse.rs | 37 ++ dhall/src/semantics/phase/resolve.rs | 180 ++++++++ dhall/src/semantics/phase/typecheck.rs | 815 +++++++++++++++++++++++++++++++++ 26 files changed, 4117 insertions(+), 4115 deletions(-) delete mode 100644 dhall/src/core/context.rs delete mode 100644 dhall/src/core/mod.rs delete mode 100644 dhall/src/core/value.rs delete mode 100644 dhall/src/core/valuef.rs delete mode 100644 dhall/src/core/var.rs delete mode 100644 dhall/src/error/mod.rs delete mode 100644 dhall/src/phase/binary.rs delete mode 100644 dhall/src/phase/mod.rs delete mode 100644 dhall/src/phase/normalize.rs delete mode 100644 dhall/src/phase/parse.rs delete mode 100644 dhall/src/phase/resolve.rs delete mode 100644 dhall/src/phase/typecheck.rs create mode 100644 dhall/src/semantics/core/context.rs create mode 100644 dhall/src/semantics/core/mod.rs create mode 100644 dhall/src/semantics/core/value.rs create mode 100644 dhall/src/semantics/core/valuef.rs create mode 100644 dhall/src/semantics/core/var.rs create mode 100644 dhall/src/semantics/error/mod.rs create mode 100644 dhall/src/semantics/mod.rs create mode 100644 dhall/src/semantics/phase/binary.rs create mode 100644 dhall/src/semantics/phase/mod.rs create mode 100644 dhall/src/semantics/phase/normalize.rs create mode 100644 dhall/src/semantics/phase/parse.rs create mode 100644 dhall/src/semantics/phase/resolve.rs create mode 100644 dhall/src/semantics/phase/typecheck.rs (limited to 'dhall') diff --git a/dhall/src/core/context.rs b/dhall/src/core/context.rs deleted file mode 100644 index 00e1493..0000000 --- a/dhall/src/core/context.rs +++ /dev/null @@ -1,145 +0,0 @@ -use std::collections::HashMap; -use std::rc::Rc; - -use crate::syntax::{Label, V}; - -use crate::core::value::Value; -use crate::core::valuef::ValueF; -use crate::core::var::{AlphaVar, Shift, Subst}; -use crate::error::TypeError; - -#[derive(Debug, Clone)] -enum CtxItem { - Kept(AlphaVar, Value), - Replaced(Value), -} - -#[derive(Debug, Clone)] -pub(crate) struct TypecheckContext(Rc>); - -impl TypecheckContext { - pub fn new() -> Self { - TypecheckContext(Rc::new(Vec::new())) - } - pub fn insert_type(&self, x: &Label, t: Value) -> Self { - let mut vec = self.0.as_ref().clone(); - vec.push((x.clone(), CtxItem::Kept(x.into(), t.under_binder(x)))); - TypecheckContext(Rc::new(vec)) - } - pub fn insert_value(&self, x: &Label, e: Value) -> Result { - let mut vec = self.0.as_ref().clone(); - vec.push((x.clone(), CtxItem::Replaced(e))); - Ok(TypecheckContext(Rc::new(vec))) - } - pub fn lookup(&self, var: &V