1
0
dust/dust-lang/src/lib.rs

42 lines
894 B
Rust
Raw Normal View History

2024-08-05 04:54:12 +00:00
//! The Dust programming language.
//!
2024-08-13 22:27:03 +00:00
//! To get started, you can use the `run` function to run a Dust program.
//!
//! ```rust
//! use dust_lang::{run, Value};
//!
//! let program = "
2024-08-23 21:27:11 +00:00
//! let foo = 21
//! let bar = 2
2024-08-13 22:27:03 +00:00
//! foo * bar
//! ";
//!
//! let the_answer = run(program).unwrap();
//!
//! assert_eq!(the_answer, Some(Value::integer(42)));
//! ```
2024-09-06 23:27:16 +00:00
pub mod bytecode;
2024-08-20 06:25:22 +00:00
pub mod constructor;
2024-03-25 04:16:55 +00:00
pub mod identifier;
pub mod r#type;
2024-02-26 21:27:01 +00:00
pub mod value;
2024-02-23 12:40:01 +00:00
2024-09-06 23:27:16 +00:00
pub use bytecode::*;
pub use constructor::*;
pub use identifier::*;
2024-08-17 08:06:13 +00:00
pub use r#type::*;
pub use value::*;
2024-09-06 23:27:16 +00:00
use std::fmt::{self, Display, Formatter};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize)]
pub struct Span(usize, usize);
impl Display for Span {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "({}, {})", self.0, self.1)
}
}