Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomasboda/gen-lang-interpreter
The GEN Programming Language
https://github.com/tomasboda/gen-lang-interpreter
bytecode-interpreter programming-language virtual-machine
Last synced: 2 days ago
JSON representation
The GEN Programming Language
- Host: GitHub
- URL: https://github.com/tomasboda/gen-lang-interpreter
- Owner: TomasBoda
- Created: 2024-06-07T21:38:46.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-19T08:50:16.000Z (8 months ago)
- Last Synced: 2024-06-19T17:38:55.811Z (8 months ago)
- Topics: bytecode-interpreter, programming-language, virtual-machine
- Language: C
- Homepage:
- Size: 177 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# The GEN Programming Language
GEN is a general-purpose, procedural, dynamically typed programming language based on a bytecode virtual machine interpreter written in C.## About
Below is an example code of the GEN programming language representing a recursive fibonacci implementation without caching.
```
func fibonacci(var n) {
var i = 0;while (i < n) {
var index = i + 1;
var value = fibonacci_recursive(i);fibonacci_print(index, value);
i = i + 1;
}
}func fibonacci_recursive(var number) {
if (number <= 1) {
return number;
}return fibonacci_recursive(number - 1) + fibonacci_recursive(number - 2);
}func fibonacci_print(var index, var value) {
print index;
print ": ";
print value endl;
}func main() {
var n = 30;
fibonacci(n);
}
```## Building & Running
To build and run the interpreter with the example program in the `program.gen` file, run the prepared bash script.
```bash
./scripts/interpret.sh
```## Testing
To run the tests, run the prepared bash script.
```bash
./scripts/test.sh
```by [Tomas Boda](https://github.com/TomasBoda)