Skip to content

Commit

Permalink
Update syntactic_environment to record compilation context
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Jul 29, 2024
1 parent df05da2 commit db98fc3
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 94 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.210_amd64.deb
sudo apt install build/meevax_0.5.211_amd64.deb
```

or
Expand Down Expand Up @@ -122,9 +122,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.210.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.211.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.210_amd64.deb`
| `package` | Generate debian package `meevax_0.5.211_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.210
0.5.211
13 changes: 9 additions & 4 deletions include/meevax/kernel/dynamic_environment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ inline namespace kernel
assert(last(c).template is<instruction>());
assert(last(c).template as<instruction>() == instruction::stop);

let const control = c;

try
{
fetch:
Expand All @@ -121,7 +123,7 @@ inline namespace kernel
}
else
{
s = cons(cdadr(c), s);
s = cons(x, s);
c = cddr(c);
goto fetch;
}
Expand Down Expand Up @@ -402,6 +404,7 @@ inline namespace kernel
* ----------------------------------------------------------------- */
assert(cdr(s).template is<null>());
assert(cdr(c).template is<null>());

s = cons(car(s), car(d));
e = cadr(d);
c = caddr(d);
Expand Down Expand Up @@ -523,35 +526,37 @@ inline namespace kernel
{
if (thrown.is_also<error>())
{
thrown.as<error>().detail(error::in::running, cons(s, e, c, d)).raise();
thrown.as<error>().raise();
return unspecified;
}
else
{
error::contexts.emplace_back(error::in::running, cons(control, c));
throw error(make<string>("uncaught exception"), thrown);
}
}
catch (error & thrown) // by any primitive procedure other than `throw`.
{
if (exception_handler)
{
error::contexts.emplace_back(error::in::running, cons(control, c));
return apply(exception_handler, thrown.make());
}
else // In most cases, this clause will never be called.
{
thrown.detail(error::in::running, cons(s, e, c, d)).raise();
thrown.raise();
return unspecified;
}
}
catch (std::exception const& exception) // by the system.
{
if (auto thrown = error(make<string>(exception.what())); exception_handler)
{
error::contexts.emplace_back(error::in::running, cons(control, c));
return apply(exception_handler, thrown.make());
}
else // In most cases, this clause will never be called.
{
thrown.detail(error::in::running, cons(s, e, c, d));
throw thrown;
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/kernel/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ inline namespace kernel
running,
};

std::vector<std::pair<in, object>> contexts {};
static thread_local inline std::vector<std::pair<in, object>> contexts;

mutable std::string cache {};

Expand Down
Loading

0 comments on commit db98fc3

Please sign in to comment.