Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antonijn/cheax
A Lisp dialect with C API, REPL and standard library
https://github.com/antonijn/cheax
api c interpreter library lisp
Last synced: about 2 months ago
JSON representation
A Lisp dialect with C API, REPL and standard library
- Host: GitHub
- URL: https://github.com/antonijn/cheax
- Owner: antonijn
- Created: 2016-05-13T12:49:37.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-11-24T21:04:49.000Z (2 months ago)
- Last Synced: 2024-11-24T22:18:02.140Z (2 months ago)
- Topics: api, c, interpreter, library, lisp
- Language: C
- Homepage: https://www.adblom.net/cheax
- Size: 1.03 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
cheax
=====[![Build status](https://github.com/antonijn/cheax/actions/workflows/build-test.yml/badge.svg)](https://github.com/antonijn/cheax/actions)
A Lisp dialect that looks a bit like Haskell. Designed for easy
interoperability with C/C++.Installation
------------```sh
$ mkdir build && cd build && cmake .. && make
# make install
```Language demo
-------------
![Made with VHS](https://vhs.charm.sh/vhs-4S0HmQsFAYuSxQuZ6i1HJE.gif)C API example
-------------```C
#include
#includeint main(void)
{
int result;
CHEAX *c = cheax_init();/* Load some "unsafe" functions, e.g. file io and the program
* exit function */
cheax_load_feature(c, "all");/* Make sure cheax doesn't cause a stack overflow */
cheax_config_int(c, "stack-limit", 4096);/* Load the standard library */
if (cheax_load_prelude(c) < 0) {
/* Display error message on behalf of "example" program */
cheax_perror(c, "example");
return EXIT_FAILURE;
}/* Synchronize variable `result' with the eponymous symbol
* in cheax */
cheax_sync_int(c, "result", &result, 0);cheax_eval(c, cheax_readstr(c, "(set result (sum (.. 1 100)))"));
cheax_destroy(c);
printf("1 + 2 + ... + 100 = %d\n", result);
return 0;
}
```