-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flesh out new structure for interpreter (and eventual comp)
- Loading branch information
Showing
19 changed files
with
1,600 additions
and
1,083 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
(iter b (+ a b) (- count 1)))) | ||
(iter 0 1 n)) | ||
|
||
(fib 100) | ||
(fib 10000) |
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 was deleted.
Oops, something went wrong.
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,25 @@ | ||
//! todo | ||
use crate::continuation::*; | ||
use super::*; | ||
|
||
impl Body { | ||
pub async fn tail_eval( | ||
&self, | ||
env: &Env, | ||
cont: &Option<Arc<Continuation>>, | ||
) -> Result<ValuesOrPreparedCall, RuntimeError> { | ||
let Some(last) = self.forms.last() else { | ||
return Ok(ValuesOrPreparedCall::Values(vec![Gc::new(Value::Null)])); | ||
}; | ||
for (form, tail) in self.forms.skip_last() { | ||
let cont = Some(Arc::new(Continuation::new( | ||
Arc::new(ResumableBody::new(env, &tail)), | ||
cont, | ||
))); | ||
// Discard values that aren't returned | ||
form.eval(env, &cont).await?; | ||
} | ||
last.tail_eval(env, cont).await | ||
} | ||
} |
Oops, something went wrong.