Basic read and print are working perfectly

This commit is contained in:
Chris Cochrun 2024-11-05 17:29:34 -06:00
parent 25a451e23e
commit f7f90cd78f
4 changed files with 238 additions and 52 deletions

View file

@ -23,6 +23,7 @@ pub enum Value {
#[default]
Nil,
Function,
True,
Symbol(Symbol),
Keyword(Keyword),
}
@ -49,8 +50,14 @@ impl From<&str> for Value {
Value::Number(parse_result)
} else if let Some(s) = s.strip_prefix(":") {
Value::Keyword(Keyword(s.to_string()))
} else if s == "t".to_owned() {
Value::True
} else if s.starts_with(r#"""#) {
Value::String(s)
Value::String(s.replace('"', ""))
} else if s == "fn".to_owned() {
Value::Function
} else if s == "defun".to_owned() {
Value::Function
} else if s == "nil".to_owned() {
Value::Nil
} else {