https://github.com/tomlin7/lemon
The Lemon Programming Language. Minimalist, fast, dynamic.
https://github.com/tomlin7/lemon
cinnamon hacktoberfest interpter programming-language
Last synced: 18 days ago
JSON representation
The Lemon Programming Language. Minimalist, fast, dynamic.
- Host: GitHub
- URL: https://github.com/tomlin7/lemon
- Owner: tomlin7
- License: mit
- Created: 2022-02-03T05:28:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-23T12:32:43.000Z (3 months ago)
- Last Synced: 2025-03-28T13:21:21.643Z (about 1 month ago)
- Topics: cinnamon, hacktoberfest, interpter, programming-language
- Language: Go
- Homepage:
- Size: 212 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The Lemon Programming Language
Lemon is a tiny, fast, interpreted language. This repository contains the source code for the Lemon interpreter, written in Go. The language is still in development, and the interpreter is not yet feature-complete. A peek at the REPL atm:

## Hello, Lemon!
```js
let message = "Hello, Lemon!";
print(message);
```For more examples, check out the [examples](./examples) directory.
```js
let fibonacci = fn(x) {
if (x == 0) {
0
} else {
if (x == 1) {
return 1;
} else {
fibonacci(x - 1) + fibonacci(x - 2);
}
}
};
let map = fn(arr, f) {
let iter = fn(arr, accumulated) {
if (len(arr) == 0) {
accumulated
} else {
iter(rest(arr), push(accumulated, f(first(arr))));
}
};
iter(arr, []);
};
let numbers = [ 1, 1 + 1, 4 - 1, 2 * 2, 2 + 3, 12 / 2 ];
map(numbers, fibonacci);
// => returns: [1, 1, 2, 3, 5, 8]
```## Features
- [x] Data types: boolean, integer and string
- [x] Variables `let name = value;`
- [x] Arithmetic operations (`+`, `-`, `*`, `/`)
- [x] Logical operations (`!`, `&&`, `||`)
- [x] Functions `fn (args) { body }`
- [x] First-class functions (closures)
- [x] Comparison operations (`==`, `!=`, `>`, `>=`, `<`, `<=`)
- [ ] Control structures
- [x] if, else `if (condition) { body } else { body }`
- [ ] else if branch
- [ ] switch, case
- [ ] match, when
- [ ] while, for, loop
- [ ] break, continue
- [x] Garbage collection
- [x] Strings `let name = "value";`
- [x] String concatenation `"value" + "value";`
- [x] Arrays `[1, 2, 3]`
- [x] Hash maps `{ "key": "value" }`
- [ ] Comments
- [ ] Error handling
- [ ] Standard library
- [ ] Modules
- [ ] Classes
- [ ] Generics
- [ ] Multithreading## Usage
To run the REPL, use the following command:
```bash
go run main.go
```To build the interpreter, use the following command:
```bash
go build
```Running [lemon files](./example.mm) (after building):
```bash
lemon example.mm
```To run tests, use the following command:
```bash
go test
```