-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nulluser
committed
Jun 1, 2024
1 parent
72a473a
commit dbffc36
Showing
6 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod environment; | ||
pub mod eval; | ||
pub mod interpreter; | ||
pub mod native_fn; | ||
pub mod values; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use std::time::SystemTime; | ||
|
||
use crate::{mk_integer, mk_null}; | ||
|
||
use super::{environment::Environment, values::Val}; | ||
use crate::backend::values::{IntegerVal, NullVal}; | ||
|
||
pub fn native_println(args: Vec<Val>, _env: &mut Environment) -> Val { | ||
for arg in args { | ||
println!("{:?}", arg); // for now, just use debug print. | ||
// TODO: Add actual std::fmt::Display impl for Val enums. | ||
} | ||
mk_null!() | ||
} | ||
|
||
pub fn native_time(_args: Vec<Val>, _env: &mut Environment) -> Val { | ||
let time = match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { | ||
Ok(n) => n.as_secs() as i64, | ||
Err(e) => panic!("SystemTime before UNIX EPOCH! {}", e), | ||
}; | ||
mk_integer!(time) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters