ombre: Rename language to `lang`

02ba6be806374b666ccfcede3a781f52b382acfd
It's not a lisp.
Alexis Sellier committed ago 1 parent ba982111
README +1 -1
19 19
       ├─ rng      ░  random number generation
20 20
       ├─ watcher  ░  file watcher, based on `inotify`
21 21
       ├─ bytes    ░  general byte manipulation
22 22
       ├─ ui       ░  user interface toolkit
23 23
       ├─ bench    ░  benchmarking library
24 -
       └─ lisp     ░  small shadowy lisp implementation
24 +
       └─ lang     ░  small shadowy programming language
25 25
       arbre       ░  living documents
26 26
       rêve        ░  2D/3D art tools
ombre/src/bin/repl.rs +1 -1
1 1
use std::io;
2 2
3 -
use ombre::lisp::*;
3 +
use ombre::lang::*;
4 4
use ombre::readline;
5 5
6 6
pub fn run() -> io::Result<()> {
7 7
    let mut env = Env::default();
8 8
    let mut rl = readline::Readline::new()?;
ombre/src/lisp.rs → ombre/src/lang.rs renamed +2 -2
1 1
#![warn(missing_docs)]
2 -
//! An interpreter for a lisp dialect.
2 +
//! An interpreter for a lightweight dynamic programming language.
3 3
//!
4 4
//! There are three phases through which code is transformed:
5 5
//!
6 6
//! 1. Scanner: transforms the input string into tokens
7 7
//! 2. Parser: transforms the tokens into an abstract syntax tree (AST) made of expressions
19 19
pub use evaluator::{Env, Error, Evaluator, Expr, Result, Symbol};
20 20
pub use parser::Parser;
21 21
pub use scanner::Scanner;
22 22
23 23
/// File extension for language files.
24 -
pub const FILE_EXTENSION: &str = "scm";
24 +
pub const FILE_EXTENSION: &str = "om";
25 25
26 26
/// Build a syntax tree from the input string.
27 27
pub fn parse(input: &str) -> impl Iterator<Item = parser::Result<Expr>> + '_ {
28 28
    Parser::new(Scanner::new(input))
29 29
}
ombre/src/lisp/dynamic.rs → ombre/src/lang/dynamic.rs renamed +0 -0
ombre/src/lisp/evaluator.rs → ombre/src/lang/evaluator.rs renamed +3 -3
7 7
use std::rc::Rc;
8 8
use std::{collections::HashMap, iter::Peekable};
9 9
use std::{fmt, fs, iter, result};
10 10
11 11
use crate::gfx::Rgba;
12 -
use crate::lisp::dynamic::{Dynamic, IsDynamic};
12 +
use crate::lang::dynamic::{Dynamic, IsDynamic};
13 13
use crate::math::{Vector2D, Vector3D, Vector4D};
14 14
15 15
use super::{Parser, Scanner, FILE_EXTENSION};
16 16
17 17
/// Result type for all functions.
2167 2167
#[allow(clippy::unwrap_used)]
2168 2168
mod tests {
2169 2169
    use crate::gfx::Rgba8;
2170 2170
2171 2171
    use super::*;
2172 -
    use crate::lisp::parser::Parser;
2173 -
    use crate::lisp::scanner::Scanner;
2172 +
    use crate::lang::parser::Parser;
2173 +
    use crate::lang::scanner::Scanner;
2174 2174
2175 2175
    #[track_caller]
2176 2176
    fn expect(input: &[&str], expected: Expr) {
2177 2177
        let input = input.join("\n");
2178 2178
        let tokens = Scanner::new(input.as_str());
ombre/src/lisp/parser.rs → ombre/src/lang/parser.rs renamed +4 -4
5 5
use std::iter::Peekable;
6 6
use std::ops::Deref;
7 7
use std::rc::Rc;
8 8
use std::result;
9 9
10 -
use crate::lisp::evaluator::{Expr, Key, Symbol, Tuple};
11 -
use crate::lisp::scanner;
12 -
use crate::lisp::scanner::Token;
10 +
use crate::lang::evaluator::{Expr, Key, Symbol, Tuple};
11 +
use crate::lang::scanner;
12 +
use crate::lang::scanner::Token;
13 13
14 14
/// Result type for all functions.
15 15
pub type Result<T> = result::Result<T, Error>;
16 16
17 17
/// Parse error.
224 224
#[cfg(test)]
225 225
#[allow(clippy::unwrap_used)]
226 226
mod tests {
227 227
    use super::*;
228 228
229 -
    use crate::lisp::scanner::Scanner;
229 +
    use crate::lang::scanner::Scanner;
230 230
231 231
    #[track_caller]
232 232
    fn ok(input: &str, expected: &[Expr]) {
233 233
        let exprs = Parser::new(Scanner::new(input)).parse().unwrap();
234 234
        assert_eq!(exprs, expected);
ombre/src/lisp/scanner.rs → ombre/src/lang/scanner.rs renamed +0 -0
ombre/src/lib.rs +1 -1
12 12
pub mod bench;
13 13
pub mod bytes;
14 14
pub mod collections;
15 15
pub mod fs;
16 16
pub mod gfx;
17 +
pub mod lang;
17 18
pub mod lenses;
18 -
pub mod lisp;
19 19
pub mod logger;
20 20
pub mod math;
21 21
pub mod platform;
22 22
#[cfg(feature = "readline")]
23 23
pub mod readline;
ombre/src/paint/shape.rs +2 -2
178 178
    fn from(rect: Rect<f32, U>) -> Self {
179 179
        Shape::Rectangle(Rectangle::from(rect))
180 180
    }
181 181
}
182 182
183 -
impl<U: fmt::Debug + 'static> crate::lisp::dynamic::IsDynamic for Shape<U> {
184 -
    fn eq(&self, other: &dyn crate::lisp::dynamic::IsDynamic) -> bool {
183 +
impl<U: fmt::Debug + 'static> crate::lang::dynamic::IsDynamic for Shape<U> {
184 +
    fn eq(&self, other: &dyn crate::lang::dynamic::IsDynamic) -> bool {
185 185
        other
186 186
            .as_any()
187 187
            .downcast_ref::<Self>()
188 188
            .is_some_and(|other| self.eq(other))
189 189
    }