cl-interpret: Stop kidding myself, I'll be replacing the interpreter before I get rid of this.

This commit is contained in:
John 2024-05-19 15:16:22 -05:00
parent e0f54aea97
commit 406bfb8882
5 changed files with 10 additions and 13 deletions

View File

@ -3,7 +3,7 @@
use super::{
env::Environment,
error::{Error, IResult},
temp_type_impl::ConValue,
convalue::ConValue,
BuiltIn, Callable,
};
use cl_ast::Sym;

View File

@ -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<T> = Result<T, Error>;

View File

@ -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;

View File

@ -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};

View File

@ -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)]