An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Lantern
![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)

Lantern Logo

**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)