https://github.com/minervasrefuge/gzzg
A typed Zig wrapper for the Guile (scheme) C API.
https://github.com/minervasrefuge/gzzg
guile guile-scheme zig ziglang
Last synced: about 1 month ago
JSON representation
A typed Zig wrapper for the Guile (scheme) C API.
- Host: GitHub
- URL: https://github.com/minervasrefuge/gzzg
- Owner: MinervasRefuge
- License: bsd-3-clause
- Created: 2025-01-26T08:34:01.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-04-11T09:37:17.000Z (about 1 month ago)
- Last Synced: 2025-04-11T11:47:54.315Z (about 1 month ago)
- Topics: guile, guile-scheme, zig, ziglang
- Language: Zig
- Homepage:
- Size: 179 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- Changelog: CHANGELOG.org
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
#+OPTIONS: toc:nil
#+OPTIONS: ^:nil
* GZZG
[[https://ko-fi.com/Z8Z81D600C][https://ko-fi.com/img/githubbutton_sm.svg]]
----------
A typed Zig wrapper for the Guile (scheme) C API.Requires ~libguile-3.0~. Currently targeting [email protected]~
** Basic Example
#+begin_src scheme
(display "Sum of Numbers: ")
(display (+ (1+ 4) 2 3))
(newline)
#+end_src#+begin_src zig :results verbatim :exports both
const gzzg = @import("gzzg");
const Num = gzzg.Number;
const Str = gzzg.String;
const display = gzzg.display;
const newline = gzzg.newline;pub fn main() !void {
gzzg.initThreadForGuile();
const a = Num.from(4);
const b = Num.from(2);display(Str.fromUTF8("Sum of Numbers: "));
display(a.onePlus().sum(b).sum(.from(3)));
newline();
}
#+end_src#+RESULTS:
: Sum of Numbers: 10Checkout the other examples in the =Example= folder.
** Note regarding ~setjmp~ / ~longjmp~
Zig considers unsound and can't be used. [[https://github.com/ziglang/zig/issues/1656][Issue 1656]]. There are workarounds planned in the future. It's recommended for the moment to consider places of memory allocation (that don't use Guile's GC Alloc) and appropriately check or wrap with a ~gzzg.catchException~ "closure".----------
#+begin_quote
I'm not a fruitcake. Am I lad? -- Wallace
#+end_quoteBSD-3-Clause : Copyright © 2025 Abigale Raeck.