https://github.com/fdero/verse
Interpreter of the Verse programming language (this language is the precursor of Basalt)
https://github.com/fdero/verse
compiler compiler-design interpreter language programming-language programming-languages
Last synced: 10 months ago
JSON representation
Interpreter of the Verse programming language (this language is the precursor of Basalt)
- Host: GitHub
- URL: https://github.com/fdero/verse
- Owner: fDero
- License: mit
- Created: 2022-12-24T12:26:01.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-23T16:27:07.000Z (12 months ago)
- Last Synced: 2025-03-25T21:11:32.312Z (10 months ago)
- Topics: compiler, compiler-design, interpreter, language, programming-language, programming-languages
- Language: C++
- Homepage:
- Size: 106 KB
- Stars: 17
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Verse
`verse` is an interpreter for the Verse programming language. This language was the result of various experimentations that ultimetly led to [Basalt](https://www.github.com/fDero/Basalt),
my second language. It's important to note that what i created has nothing to do with [Verse made by epic games](https://dev.epicgames.com/documentation/en-us/uefn/verse-language-reference).
### Installation (Building from source)
In order to install verse, you have to build it from source. By default, the build process tries to use `clang++`, but you can change that
to make it use `g++` instead if you so desire. Either way `c++20` or higher is required.
```bash
$$ git clone https://www.github.com/fDero/Verse
$$ cd Verse
$$ make build
```
### Hello World
To make your first hello-world program in verse, all it takes is to create a file with the `.verse` extension (in this case, it will be called `hello.verse`)
containing the following code:
```go
func main(){
println("Hello world!");
}
```
Once you have the file set up, to run it just use the `verse -r hello.verse` command in console.
```bash
$ verse -r hello.verse
$ Hello world!
```
### Types
Verse is a strictly typed language, it has a C-style type system with `Int`, `Float`, `Bool`, `Char`, `String` as primitive types.
```go
func main(){
var x : Int = 6;
var y : Float = 9.4;
var f : Bool = false;
var c : Char = 'z';
var s : String = "hello world";
}
```
### Recursion
Verse supports recursion just like any other language, and a good way to show it is with the classic fibonacci example, consider the following code:
```go
func fibo(n : Int){
if (n < 2) {
return 1;
}
else {
return fibo(n-1) + fibo(n-2);
}
}
func main(){
println(fibo(6));
}
```
assuming the file is called `fibo.verse`, then it can be executed just like we did earlier with the hello-world example, using the `verse -r` command.
```bash
$$ verse -r fibo.verse
$$ 21
```