Skip to content

MainShayne233/risp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Risp

A LISP implemented as a Rust procedural macro!

What?

I got inspired by the neat stuff people are doing with procedural macros in Rust, like yew's html! macro, and thought, could you write a programming language that's just a procedural macro?

As a proof of concept, I decided to implement an interperter for a basic LISP. The limitations of this LISP are:

  • The entire program must be a single S-Expression
  • The only functions available are +, -, *, and /
  • Each expression is either an integer or a function apply

Use

You must have rust installed.

# clone the repo
git clone https://github.com/MainShayne233/risp

# enter directory
cd risp

# call the executable
./bin/risp '(* 2 (- 5 2))'
6

Crates

Risp leans on the proc-macro-hack crate to allow the risp! macro to be invoked in statement or expression position.

proc-macro-hack crate requires seperate crates for implementation, declaration, and use. You can read more about this here.

Due to this requirement, this project consists of the following crates:

  • risp: Main crate that exports everything
  • risp_ast: Defines the AST for the the parsed risp
  • risp_macro: The implementation crate for the risp! macro
  • risp_test: The crate for testing all of this code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published