Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bnzis/bulb
My little programming language.
https://github.com/bnzis/bulb
bulb c cpp interpreter interpreters language lisp scripting scripting-language
Last synced: about 2 months ago
JSON representation
My little programming language.
- Host: GitHub
- URL: https://github.com/bnzis/bulb
- Owner: bnzis
- License: mit
- Created: 2018-01-07T16:27:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-14T11:25:08.000Z (over 4 years ago)
- Last Synced: 2024-08-03T18:15:44.508Z (5 months ago)
- Topics: bulb, c, cpp, interpreter, interpreters, language, lisp, scripting, scripting-language
- Language: C
- Homepage:
- Size: 208 KB
- Stars: 11
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- AwesomeInterpreter - bulb
README
## Bulb
Bulb is a simple **Lisp** dialect very similar to **Scheme** on which
I work in my free time. The ultimate goal of the project is to create
a lightweight interpreter, easy to integrate on other projects.
Here are some examples of the syntax:
## Basics
```scheme
; this is a comment
(def integer 1)
(def floating 3.1415926535)
(def flag #f) ; #f stands for false, #t for true
(def str "potatoes") ; this a string; functions can be defined like this
(def (abs x) (if (> x 0) x (* x -1))); or like this
(def abs (lambda (x) (if (> x 0) x (* x -1)))); more complex example of code
(def (print-list l)
(if (and (list? l) (not (null? l)))
(begin
(print (car l) " ")
(print-list (cdr l)))))(print-list (list 1 2 3 4 5)) ;=> 1 2 3 4 5
(print "\n")
```## How to install
First of all, you need the source code.
Download the tarball or clone the repository:
```
git clone https://github.com/bnzis/bulb
```
You need **make** and a **C compiler**. If you're a
**Linux** or **BSD** user, you probably already have both;
if not, consult the manual of your distribution to install
them. If you use Windows instead, I recommend installing **MinGW**.
Compile and install:
```
cd /path/of/bulb
make all # please check config.mk before building
sudo make install # works only on Linux and BSD.
```## How to use it
```
bulb # open the repl
bulb /path/to/file # execute the code in the file
```