Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AST and interpreter, temporarily disable records #48

Merged
merged 7 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions benches/fib.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
use scheme_rs::{env::Env, lex::Token, syntax::ParsedSyntax};
use scheme_rs::env::Env;

use criterion::*;

async fn fib() {
let top = Env::top().await;

let r6rs_tok = Token::tokenize_file(include_str!("fib.scm"), "fib.scm").unwrap();
let r6rs_sexprs = ParsedSyntax::parse(&r6rs_tok).unwrap();
for sexpr in r6rs_sexprs {
sexpr
.compile(&top, &None)
.await
.unwrap()
.eval(&top, &None)
.await
.unwrap();
}
let _ = top.eval("fib.scm", include_str!("fib.scm")).await.unwrap();
}

fn fib_benchmark(c: &mut Criterion) {
c.bench_function("fib 100", |b| {
c.bench_function("fib 10000", |b| {
b.to_async(tokio::runtime::Runtime::new().unwrap())
.iter(fib)
});
Expand Down
2 changes: 1 addition & 1 deletion benches/fib.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
(iter b (+ a b) (- count 1))))
(iter 0 1 n))

(fib 100)
(fib 10000)
8 changes: 4 additions & 4 deletions proc-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ pub fn builtin(name: TokenStream, item: TokenStream) -> TokenStream {
fn #wrapper_name(
cont: Option<std::sync::Arc<::scheme_rs::continuation::Continuation>>,
args: Vec<::scheme_rs::gc::Gc<::scheme_rs::value::Value>>
) -> futures::future::BoxFuture<'static, Result<::scheme_rs::eval::ValuesOrPreparedCall, ::scheme_rs::error::RuntimeError>> {
) -> futures::future::BoxFuture<'static, Result<::scheme_rs::proc::ValuesOrPreparedCall, ::scheme_rs::error::RuntimeError>> {
Box::pin(
async move {
#impl_name(
&cont,
#( &args[#arg_indices], )*
).await.map(::scheme_rs::eval::ValuesOrPreparedCall::from)
).await.map(::scheme_rs::proc::ValuesOrPreparedCall::from)
}
)
}
Expand All @@ -50,15 +50,15 @@ pub fn builtin(name: TokenStream, item: TokenStream) -> TokenStream {
fn #wrapper_name(
cont: Option<std::sync::Arc<::scheme_rs::continuation::Continuation>>,
mut required_args: Vec<::scheme_rs::gc::Gc<::scheme_rs::value::Value>>
) -> futures::future::BoxFuture<'static, Result<::scheme_rs::eval::ValuesOrPreparedCall, ::scheme_rs::error::RuntimeError>> {
) -> futures::future::BoxFuture<'static, Result<::scheme_rs::proc::ValuesOrPreparedCall, ::scheme_rs::error::RuntimeError>> {
let var_args = required_args.split_off(#num_args);
Box::pin(
async move {
#impl_name(
&cont,
#( &required_args[#arg_indices], )*
var_args
).await.map(::scheme_rs::eval::ValuesOrPreparedCall::from)
).await.map(::scheme_rs::proc::ValuesOrPreparedCall::from)
}
)
}
Expand Down
211 changes: 0 additions & 211 deletions src/ast.rs

This file was deleted.

Loading
Loading