https://github.com/cococry/lantern
Stack based programming language in C
https://github.com/cococry/lantern
programming-language
Last synced: 7 months ago
JSON representation
Stack based programming language in C
- Host: GitHub
- URL: https://github.com/cococry/lantern
- Owner: cococry
- License: gpl-3.0
- Created: 2023-03-12T14:43:47.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-12T17:52:18.000Z (almost 3 years ago)
- Last Synced: 2025-03-23T18:05:28.260Z (10 months ago)
- Topics: programming-language
- Language: C
- Homepage:
- Size: 232 KB
- Stars: 14
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lantern

**Lantern** is a [stack based](https://en.wikipedia.org/wiki/Stack-oriented_programming), [interpreted](https://en.wikipedia.org/wiki/Interpreter_(computing)) programming language written in **C**.
The goal of the project is creating a fast, bloatless and powerful programming tool
that can be used for multiple purposes.
The language has **access to the underlying memory structure** and in general
is desinged to be easily used as a [low level programming language](https://en.wikipedia.org/wiki/Low-level_programming_language) too.
Lantern is, due to the stackbased paradigm of the language it is written in
[reverse polish notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation).
wich sets it apart from a lot languages that work with AST or other structures.
## Feature list
- [x] Conditions & loops
- [x] Heap Memory System
- [x] Stackframe System
- [x] Variables & Type checking
- [x] Stack Mechanics
- [x] Raw Memory Access
- [ ] Functions
- [x] Else-If Functionality
- [x] Macros
- [ ] Access to Syscalls
- [ ] Defining Structs (C-Style)
- [ ] Adding Fundamental Variable Types (float, double, char...)
- [x] String Concatenation & Equality Operators
## Building
### Linux
#### Requirements
- GCC Compiler
- Make command
```console
mkdir bin
make
```
### Windows
#### Requirements
- GCC Compiler
```console
mkdir bin
build.bat
```
## Example Usage
### A implentation of the [FizzBuzz problem](https://de.wikipedia.org/wiki/Fizz_buzz)
```bash
0 = counter
while counter 10000 < run
counter 3 % 0 == counter 5 % 0 == and if
"fizzbuzz" println
elif counter 3 % 0 == then
"fizz" println
elif counter 5 % 0 == then
"buzz" println
end
counter println
counter 1 + = counter
end
```
## Inspiration
- [Forth](https://de.wikipedia.org/wiki/Forth_(Programmiersprache)), a stack based, imperative programming language
- [Python](https://de.wikipedia.org/wiki/Python_(Programmiersprache)), a easy to used, interpreted programming language
- [C](https://de.wikipedia.org/wiki/C_(Programmiersprache)), a statically typed, low level programming language
## Contributing
You can contribue to Lantern by:
- [Fixing bugs or contributing to features](https://github.com/cococry/Lantern/issues)
- [Changing features or adding new functionality](https://github.com/cococry/Lantern/pulls)