Skip to content

Commit

Permalink
Dynamic-wind (#52)
Browse files Browse the repository at this point in the history
* Implement dynamic wind, fix bug with environment cloning

* Adjust readme

* I think this is correct now
  • Loading branch information
maplant authored Dec 31, 2024
1 parent 6426349 commit 518d1e2
Show file tree
Hide file tree
Showing 11 changed files with 504 additions and 81 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ That is obviously a long way away.
## Features currently unsupported by scheme-rs:

- Exceptions and error handling
- Dynamic winding
- Ports and IO operations
- Most API functions are not implemented
- A large portion of lexical structures are missing; there's no way to specify recursive data structures
Expand All @@ -39,17 +38,17 @@ in the repo's root directory (examples taken from wikipedia):
~/scheme-rs> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/scheme-rs`
>>> (let loop ((n 1))
... (if (> n 10)
... '()
... (cons n
... (loop (+ n 1)))))
> (let loop ((n 1))
(if (> n 10)
'()
(cons n
(loop (+ n 1)))))
$1 = (1 2 3 4 5 6 7 8 9 10)
>>> (let* ((yin
... ((lambda (cc) (display "@") cc) (call-with-current-continuation (lambda (c) c))))
... (yang
... ((lambda (cc) (display "*") cc) (call-with-current-continuation (lambda (c) c)))))
... (yin yang))
((lambda (cc) (display "@") cc) (call-with-current-continuation (lambda (c) c))))
(yang
((lambda (cc) (display "*") cc) (call-with-current-continuation (lambda (c) c)))))
(yin yang))
@*@**@***@****@*****@******@*******@********@*********@**********@***********@**********...^C
```

Expand Down
4 changes: 2 additions & 2 deletions proc-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ fn derive_trace_enum(name: Ident, data_enum: DataEnum) -> proc_macro2::TokenStre
unsafe impl ::scheme_rs::gc::Trace for #name {
unsafe fn visit_children(&self, visitor: unsafe fn(::scheme_rs::gc::OpaqueGcPtr)) {
match self {
#( #visit_match_clauses )*,
#( #visit_match_clauses, )*
_ => (),
}
}

unsafe fn finalize(&mut self) {
match self {
#( #finalize_match_clauses )*,
#( #finalize_match_clauses, )*
_ => (),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ast/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::{
sync::Arc,
};

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Trace)]
pub enum ParseAstError {
BadForm(Span),
UnexpectedEmptyList(Span),
Expand Down
Loading

0 comments on commit 518d1e2

Please sign in to comment.