Bud is yet another Scheme-like Lisp dialect implemented in Java. It is simple, lightweight and embeddable. Most of the special forms including quote
, lambda
, if
, cond
, and
, or
and built-in functions like car
, cdr
, eq?
, type predicates and arithmetic functions specified in R5RS are implemented.
- JDK 7+
- Apache Maven 3.0.4+
Like Scheme,
- Functions are first-class object.
- Functions and other data variables share a single namespace.
- Tail calls are properly optimized.
A list of data types that are currently supported are shown below.
- boolean
- character
- number (decimal)
- string
- symbol
- list
- function
Use the Maven wrapper to compile and execute,
./mvnw clean compile exec:java -Dexec.mainClass='me.predatorray.bud.lisp.BudRepl'
If the docker cli is available on your computer, you can just run the lastest zetaplusae/bud
image published on Docker Hub,
docker run -it --rm zetaplusae/bud:latest
Or, you can try the REPL online.
Finally, type your Lisp expressions.
bud> "Hello, Bud!"
"Hello, Bud!"
Install the artifact to your local repository.
mvn clean install
Add the dependency in you pom.xml.
<dependency>
<groupId>me.predatorray</groupId>
<artifactId>bud</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
And, here is an example of interpreting source code:
String sourceCode = "(+ 1 1)"
BudInterpreter interpreter = new BudInterpreter();
BudObject result = interpreter.execute(sourceCode);
assert new BudNumber(new BigDecimal(2)).equals(result);