Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alisp

A tiny Lisp interpreter for AI agents.

Built for one purpose: give AI a simple, powerful language to execute shell commands, manage files, call APIs, parse HTML, query databases, and automate tasks.

Quick Start

cargo build --release

# Run code directly
./target/release/alisp -e '(println "Hello, " (exec "whoami") "!")'

# Run a script
./target/release/alisp script.lisp

# REPL
./target/release/alisp

Use as a Rust Library

Add to your Cargo.toml:

alisp = { git = "https://github.com/jihoo12/alisp" }
use alisp::Evaluator;

fn main() {
    let mut eval = Evaluator::new();

    // Evaluate expressions
    let result = eval.eval_str("(+ 1 2)").unwrap().unwrap();
    println!("{}", alisp::expr_to_string(&result)); // "3"

    // Run a full script
    eval.eval_str(r#"
        (def name (exec "whoami"))
        (println "Hello from" name)
    "#).unwrap();

    // Execute a file
    eval.eval_file("script.lisp").unwrap();
}

See the full API docs for all available functions.

Example

; Gather system info
(def info (exec "uname -a"))
(println "System:" info)

; Read a file and process it
(def content (read "Cargo.toml"))
(def lines (split content "\n"))
(println "Lines:" (len lines))

; Call an API
(def response (http-get "https://httpbin.org/get"))
(def data (json-parse response))
(println "Origin:" (json-get data "origin"))

; Write results
(write "report.txt" (format "Generated by alisp on {}", (exec "date")))

Features

Category What
Shell Run any command, capture output, get exit codes
Files Read, write, list, glob, mkdir, cp, mv, rm
HTTP GET, POST, PUT, DELETE via curl
JSON Parse, stringify, get/set values
SQL SQLite queries, execute, schema introspection (rusqlite bundled)
HTML CSS selector queries, text/attr extraction, links, tables, images, forms
Strings Split, join, replace, trim, format, case conversion
Regex Match, find, find-all, replace, split, scan with full regex support
Lists Map, filter, reduce, sort, reverse, zip
Error handling try/catch with error messages
REPL Interactive with multiline input support

Documentation

  • docs.md - Full language reference and API docs

License

Apache License 2.0

About

A tiny Lisp interpreter for AI agents.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages