https://github.com/htogta/crotchet
A LISP dialect with less `Shift`.
https://github.com/htogta/crotchet
interpreter language lisp rust
Last synced: 5 months ago
JSON representation
A LISP dialect with less `Shift`.
- Host: GitHub
- URL: https://github.com/htogta/crotchet
- Owner: htogta
- License: other
- Created: 2024-10-29T05:24:55.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-17T05:18:31.000Z (about 1 year ago)
- Last Synced: 2025-08-09T03:25:51.518Z (7 months ago)
- Topics: interpreter, language, lisp, rust
- Language: Rust
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crotchet
A LISP dialect with less `Shift`.
I wanted to play around with LISP diaclects, but didn't like having to hold
`Shift` to type `(` and `)` all the time. So, this is a minimalist LISP subset
based on [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language))
that uses `[` and `]` instead.
The name *crotchet* comes from an old printing term for a square bracket.
This was originally written as my final project for a Rust programming course.
The more recent versions of the codebase are based somewhat on [lisp-rs](https://github.com/vishpat/lisp-rs),
with the earliest prototypes based on [Risp](https://stopa.io/post/222).
## Features
- 64-bit Floating Point Arithmetic (with help from `round`)
- Variables and Constants (`let` and `set`)
- Lambda Functions and Closures (`fn`)
- Lists and list methods (`list`, `first`, `rest`, and `len`)
- Input/Output (`print` and `input`)
- Random Number Generation (`rand`)
- Loops (`while`)
Feel free to check out `example.crl` or `guessing_game.crl` for more examples.
## Installation
To build crotchet, you'll need [Rust](https://www.rust-lang.org/) installed.
Clone the repository with `git clone` and then build the interpreter:
```
cd crotchet
cargo build --release
```
Within the repository directory the executable can be found at `/target/release/crotchet`.
From here you can add it to your `$PATH` however you prefer; personally I use a
symlink.
*Note:* If you use the [micro](https://github.com/zyedidia/micro) text editor like
I do, enjoy the syntax highlighting file in `crotchet.yaml`.
## Usage
To get the current version, use the `--version` flag.
To print the help/usage info, use the `--help` flag.
### REPL
To start an interactive session, run:
```
./target/release/crotchet
```
or simply `crotchet`.
### Scripts
To execute a crotchet script, provide the file as an argument:
```
./target/release/crotchet example.crl
```
or simply `crotchet example.crl`.
## Contributing
Contributions are welcome- feel free to fork and submit pull requests.
## License
This project is licensed under the MIT License. See the `LICENSE` file for details.