Get Started
1. Get the source
mino is two files: mino.h and mino.c. Copy them into your project, or clone the repository:
git clone https://github.com/leifericf/mino.git2. Compile
Build the standalone REPL:
cd mino
makeOr compile mino directly into your own program:
cc -std=c99 -o myapp myapp.c mino.cNo build system, package manager, or external dependencies required.
3. Embed in your C program
A minimal embedding creates a runtime, registers a host function, evaluates mino code, and extracts the result:
#include "mino.h"
#include <stdio.h>
/* A host function exposed to mino as (add-tax amount). */
static mino_val_t *host_add_tax(mino_val_t *args, mino_env_t *env)
{
long long amount;
(void)env;
if (!mino_is_cons(args) || !mino_to_int(args->as.cons.car, &amount))
return mino_nil();
return mino_float((double)amount * 1.08);
}
int main(void)
{
mino_env_t *env = mino_new(); /* env + core bindings */
mino_register_fn(env, "add-tax", host_add_tax);
mino_val_t *result = mino_eval_string(
"(def prices [100 200 300])\n"
"(reduce + (map add-tax prices))\n",
env);
if (result) {
double total;
if (mino_to_float(result, &total))
printf("total with tax: %.2f\n", total);
}
mino_env_free(env);
return 0;
}Key points:
mino_new()allocates an environment and installs core bindings in one call.mino_register_fn()exposes a C function to mino code under any name.mino_eval_string()reads and evaluates all forms, returning the last result.mino_to_float()safely extracts a C value from the result (returns 0 on type mismatch).mino_env_free()unregisters the environment; the garbage collector reclaims memory.
4. Try the REPL
The standalone REPL is useful for exploring the language interactively:
$ ./mino
mino> (def greet (fn (name) (str "hello, " name "!")))
#<fn>
mino> (greet "world")
"hello, world!"
mino> (map greet ["alice" "bob" "carol"])
("hello, alice!" "hello, bob!" "hello, carol!")
mino> (doc 'map)
"(map f coll) -- apply f to each element, return a list of results."5. Next steps
- C API Reference: every public function, type, and enum.
- Language Reference: every built-in function, special form, and macro.
- Embedding Cookbook: six worked examples for real-world patterns.