Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "3"
members = ["ndc_macros", "ndc_bin", "ndc_lib", "ndc_lsp", "ndc_lexer", "ndc_parser", "ndc_stdlib", "benches", "tests"]
members = ["ndc_macros", "ndc_bin", "ndc_interpreter", "ndc_lsp", "ndc_lexer", "ndc_parser", "ndc_stdlib", "benches", "tests"]

[workspace.package]
edition = "2024"
Expand All @@ -18,7 +18,7 @@ derive_more = { version = "2.1.1", features = ["deref", "deref_mut", "from", "di
factorial = "0.4.0"
itertools = "0.14.0"
ndc_lexer = { path = "ndc_lexer" }
ndc_lib = { path = "ndc_lib" }
ndc_interpreter = { path = "ndc_interpreter" }
ndc_parser = { path = "ndc_parser" }
ndc_lsp = { path = "ndc_lsp" }
ndc_macros = { path = "ndc_macros" }
Expand Down
2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition.workspace = true
license.workspace = true

[dependencies]
ndc_lib.workspace = true
ndc_interpreter.workspace = true
ndc_stdlib.workspace = true
rand.workspace = true
criterion.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions benches/src/benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use criterion::{Criterion, criterion_group, criterion_main};
use ndc_lib::interpreter::Interpreter;
use ndc_lib::interpreter::InterpreterError;
use ndc_interpreter::Interpreter;
use ndc_interpreter::InterpreterError;
use ndc_stdlib::WithStdlib;
use rand::{RngExt, SeedableRng};
use rand_chacha::ChaCha8Rng;
Expand Down
2 changes: 1 addition & 1 deletion ndc_bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ itertools.workspace = true
strsim.workspace = true
miette = { version = "7.6.0", features = ["fancy"] }
ndc_lexer.workspace = true
ndc_lib.workspace = true
ndc_interpreter.workspace = true
ndc_stdlib.workspace = true
ndc_lsp.workspace = true
owo-colors.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion ndc_bin/src/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use miette::{Diagnostic, LabeledSpan, SourceSpan};
use ndc_lexer::Span;
use ndc_lib::interpreter::InterpreterError;
use ndc_interpreter::InterpreterError;
use std::fmt;

fn span_to_source_span(span: Span) -> SourceSpan {
Expand Down
4 changes: 2 additions & 2 deletions ndc_bin/src/docs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ndc_lib::interpreter::Interpreter;
use ndc_lib::interpreter::function::{Parameter, TypeSignature};
use ndc_interpreter::Interpreter;
use ndc_interpreter::function::{Parameter, TypeSignature};
use ndc_stdlib::WithStdlib;
use std::cmp::Ordering;
use std::fmt::Write;
Expand Down
2 changes: 1 addition & 1 deletion ndc_bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::{Context, anyhow};
use clap::{Parser, Subcommand};
use highlighter::{AndycppHighlighter, AndycppHighlighterState};
use miette::{NamedSource, highlighters::HighlighterState};
use ndc_lib::interpreter::{Interpreter, InterpreterError};
use ndc_interpreter::{Interpreter, InterpreterError};
use ndc_stdlib::WithStdlib;
use std::path::PathBuf;
use std::process;
Expand Down
2 changes: 1 addition & 1 deletion ndc_bin/src/repl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::print_stdout, clippy::print_stderr)]
use itertools::Itertools;
use miette::highlighters::HighlighterState;
use ndc_lib::interpreter::Interpreter;
use ndc_interpreter::Interpreter;
use ndc_stdlib::WithStdlib;
use rustyline::Helper;
use rustyline::config::Configurer;
Expand Down
2 changes: 1 addition & 1 deletion ndc_lib/Cargo.toml → ndc_interpreter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[package]
name = "ndc_lib"
name = "ndc_interpreter"
edition.workspace = true
version.workspace = true

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::interpreter::function::{Function, StaticType};
use crate::function::{Function, StaticType};

use crate::interpreter::value::Value;
use crate::value::Value;
use ndc_parser::ResolvedVar;
use std::cell::RefCell;
use std::fmt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
//! +----------------+-----+----+----+----+----+----+----+----+----+----+

use super::{EvaluationError, EvaluationResult, IntoEvaluationResult, evaluate_expression};
use crate::interpreter::environment::Environment;
use crate::interpreter::{function::FunctionCarrier, sequence::Sequence, value::Value};
use crate::environment::Environment;
use crate::{function::FunctionCarrier, sequence::Sequence, value::Value};
use itertools::Itertools;
use ndc_lexer::Span;
use ndc_parser::{Expression, ExpressionLocation};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::hash_map::HashMap;
use crate::interpreter::environment::Environment;
use crate::interpreter::function::{Function, FunctionBody, FunctionCarrier, StaticType};
use crate::interpreter::int::Int;
use crate::interpreter::iterator::mut_value_to_iterator;
use crate::interpreter::num::Number;
use crate::interpreter::sequence::Sequence;
use crate::interpreter::value::Value;
use crate::environment::Environment;
use crate::function::{Function, FunctionBody, FunctionCarrier, StaticType};
use crate::int::Int;
use crate::iterator::mut_value_to_iterator;
use crate::num::Number;
use crate::sequence::Sequence;
use crate::value::Value;
use index::{Offset, evaluate_as_index, get_at_index, set_at_index};
use itertools::Itertools;
use ndc_lexer::Span;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::hash_map::{DefaultHasher, HashMap};
use crate::interpreter::environment::Environment;
use crate::interpreter::evaluate::{
use crate::environment::Environment;
use crate::evaluate::{
ErrorConverter, EvaluationError, EvaluationResult, evaluate_expression,
};
use crate::interpreter::num::{BinaryOperatorError, Number};
use crate::interpreter::sequence::Sequence;
use crate::interpreter::value::Value;
use crate::num::{BinaryOperatorError, Number};
use crate::sequence::Sequence;
use crate::value::Value;
use derive_builder::Builder;
use ndc_lexer::Span;
use ndc_parser::{ExpressionLocation, ResolvedVar};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::interpreter::value::Value;
use crate::value::Value;
use derive_more::{Deref, DerefMut};
use std::cmp::{Ordering, Reverse};
use std::collections::BinaryHeap;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use super::function::{FunctionCarrier, StaticType};
use super::int::Int::Int64;
use super::num::Number;
use crate::hash_map::HashMap;
use crate::interpreter::heap::{MaxHeap, MinHeap};
use crate::interpreter::sequence::Sequence;
use crate::interpreter::value::Value;
use crate::heap::{MaxHeap, MinHeap};
use crate::sequence::Sequence;
use crate::value::Value;
use self_cell::self_cell;
use std::cell::{Ref, RefCell};
use std::collections::VecDeque;
Expand Down
23 changes: 13 additions & 10 deletions ndc_lib/src/interpreter/mod.rs → ndc_interpreter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
use std::cell::RefCell;
use std::rc::Rc;

use crate::interpreter::environment::{Environment, InterpreterOutput};
use crate::interpreter::evaluate::{EvaluationError, evaluate_expression};
use crate::interpreter::function::FunctionCarrier;
use crate::interpreter::semantic::analyser::{Analyser, ScopeTree};
use crate::interpreter::value::Value;
use ndc_lexer::{Lexer, TokenLocation};
use ndc_parser::ExpressionLocation;
pub mod compare;
pub mod hash_map;
pub mod environment;
pub mod evaluate;
pub mod function;
Expand All @@ -19,6 +11,17 @@ pub mod semantic;
pub mod sequence;
pub mod value;

use std::cell::RefCell;
use std::rc::Rc;

use crate::environment::{Environment, InterpreterOutput};
use crate::evaluate::{EvaluationError, evaluate_expression};
use crate::function::FunctionCarrier;
use crate::semantic::analyser::{Analyser, ScopeTree};
use crate::value::Value;
use ndc_lexer::{Lexer, TokenLocation};
use ndc_parser::ExpressionLocation;

pub struct Interpreter {
environment: Rc<RefCell<Environment>>,
analyser: Analyser,
Expand Down
6 changes: 3 additions & 3 deletions ndc_lib/src/interpreter/num.rs → ndc_interpreter/src/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::hash::{Hash, Hasher};
use std::num::TryFromIntError;
use std::ops::{Add, Div, Mul, Neg, Not, Rem, Sub};

use crate::interpreter::evaluate::EvaluationError;
use crate::interpreter::function::StaticType;
use crate::interpreter::int::Int;
use crate::evaluate::EvaluationError;
use crate::function::StaticType;
use crate::int::Int;
use ndc_lexer::Span;
use ndc_parser::BinaryOperator;
use num::bigint::TryFromBigIntError;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::interpreter::function::StaticType;
use crate::function::StaticType;
use itertools::Itertools;
use ndc_lexer::Span;
use ndc_parser::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::hash_map::HashMap;
use crate::interpreter::function::StaticType;
use crate::interpreter::heap::{MaxHeap, MinHeap};
use crate::interpreter::iterator::ValueIterator;
use crate::interpreter::value::Value;
use crate::function::StaticType;
use crate::heap::{MaxHeap, MinHeap};
use crate::iterator::ValueIterator;
use crate::value::Value;
use std::cell::RefCell;
use std::cmp::Ordering;
use std::collections::VecDeque;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use num::BigInt;

use crate::compare::FallibleOrd;
use crate::hash_map::DefaultHasher;
use crate::interpreter::function::{Function, StaticType};
use crate::interpreter::int::Int;
use crate::interpreter::num::{Number, NumberToFloatError, NumberToUsizeError};
use crate::interpreter::sequence::Sequence;
use crate::function::{Function, StaticType};
use crate::int::Int;
use crate::num::{Number, NumberToFloatError, NumberToUsizeError};
use crate::sequence::Sequence;

use super::iterator::{ValueIterator, ValueRange, ValueRangeFrom, ValueRangeInclusive};

Expand Down
3 changes: 0 additions & 3 deletions ndc_lib/src/lib.rs

This file was deleted.

2 changes: 1 addition & 1 deletion ndc_lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version.workspace = true
[dependencies]
tokio = { version = "1.49.0", features = ["full"] }
ndc_lexer.workspace = true
ndc_lib.workspace = true
ndc_interpreter.workspace = true
ndc_stdlib.workspace = true
tower-lsp.workspace = true
ndc_parser.workspace = true
2 changes: 1 addition & 1 deletion ndc_lsp/src/backend.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use ndc_lexer::{Lexer, Span, TokenLocation};
use ndc_lib::interpreter::Interpreter;
use ndc_interpreter::Interpreter;
use ndc_parser::{Expression, ExpressionLocation, ForBody, ForIteration, Lvalue};
use ndc_stdlib::WithStdlib;
use tokio::sync::Mutex;
Expand Down
Loading