From 406bfb8882b3f0093fbf7ca90b2b858a8475ec9f Mon Sep 17 00:00:00 2001 From: John Date: Sun, 19 May 2024 15:16:22 -0500 Subject: [PATCH] cl-interpret: Stop kidding myself, I'll be replacing the interpreter before I get rid of this. --- compiler/cl-interpret/src/builtin.rs | 2 +- compiler/cl-interpret/src/lib.rs | 15 ++++++--------- compiler/cl-interpret/src/tests.rs | 2 +- compiler/cl-repl/src/cli.rs | 2 +- compiler/cl-repl/src/ctx.rs | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/compiler/cl-interpret/src/builtin.rs b/compiler/cl-interpret/src/builtin.rs index 525107c..2b8fded 100644 --- a/compiler/cl-interpret/src/builtin.rs +++ b/compiler/cl-interpret/src/builtin.rs @@ -3,7 +3,7 @@ use super::{ env::Environment, error::{Error, IResult}, - temp_type_impl::ConValue, + convalue::ConValue, BuiltIn, Callable, }; use cl_ast::Sym; diff --git a/compiler/cl-interpret/src/lib.rs b/compiler/cl-interpret/src/lib.rs index 284d8b1..2e254e4 100644 --- a/compiler/cl-interpret/src/lib.rs +++ b/compiler/cl-interpret/src/lib.rs @@ -3,10 +3,10 @@ #![feature(decl_macro)] use cl_ast::Sym; +use convalue::ConValue; use env::Environment; use error::{Error, IResult}; use interpret::Interpret; -use temp_type_impl::ConValue; /// Callable types can be called from within a Conlang program pub trait Callable: std::fmt::Debug { @@ -22,8 +22,8 @@ pub trait BuiltIn: std::fmt::Debug + Callable { fn description(&self) -> &str; } -pub mod temp_type_impl { - //! Temporary implementations of Conlang values +pub mod convalue { + //! Values in the dynamically typed AST interpreter. //! //! The most permanent fix is a temporary one. use cl_ast::Sym; @@ -37,10 +37,7 @@ pub mod temp_type_impl { type Integer = isize; - /// A Conlang value - /// - /// This is a hack to work around the fact that Conlang doesn't - /// have a functioning type system yet :( + /// A Conlang value stores data in the interpreter #[derive(Clone, Debug, Default)] pub enum ConValue { /// The empty/unit `()` type @@ -365,9 +362,9 @@ pub mod env { //! Lexical and non-lexical scoping for variables use super::{ builtin::{BINARY, MISC, RANGE, UNARY}, + convalue::ConValue, error::{Error, IResult}, function::Function, - temp_type_impl::ConValue, BuiltIn, Callable, Interpret, }; use cl_ast::{Function as FnDecl, Sym}; @@ -534,7 +531,7 @@ pub mod error { use cl_ast::Sym; - use super::temp_type_impl::ConValue; + use super::convalue::ConValue; pub type IResult = Result; diff --git a/compiler/cl-interpret/src/tests.rs b/compiler/cl-interpret/src/tests.rs index fd0d007..b6d0726 100644 --- a/compiler/cl-interpret/src/tests.rs +++ b/compiler/cl-interpret/src/tests.rs @@ -1,5 +1,5 @@ #![allow(unused_imports)] -use crate::{env::Environment, temp_type_impl::ConValue, Interpret}; +use crate::{env::Environment, convalue::ConValue, Interpret}; use cl_ast::*; use cl_lexer::Lexer; use cl_parser::Parser; diff --git a/compiler/cl-repl/src/cli.rs b/compiler/cl-repl/src/cli.rs index 73a400d..809547e 100644 --- a/compiler/cl-repl/src/cli.rs +++ b/compiler/cl-repl/src/cli.rs @@ -5,7 +5,7 @@ use crate::{ menu, tools::print_token, }; -use cl_interpret::{env::Environment, interpret::Interpret, temp_type_impl::ConValue}; +use cl_interpret::{convalue::ConValue, env::Environment, interpret::Interpret}; use cl_lexer::Lexer; use cl_parser::Parser; use std::{error::Error, path::Path}; diff --git a/compiler/cl-repl/src/ctx.rs b/compiler/cl-repl/src/ctx.rs index 11686a8..613eb55 100644 --- a/compiler/cl-repl/src/ctx.rs +++ b/compiler/cl-repl/src/ctx.rs @@ -1,5 +1,5 @@ use cl_interpret::{ - env::Environment, error::IResult, interpret::Interpret, temp_type_impl::ConValue, + env::Environment, error::IResult, interpret::Interpret, convalue::ConValue, }; #[derive(Clone, Debug)]