Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jesperkha/fizz

Interpreted programming language built with Go
https://github.com/jesperkha/fizz

go golang interpreter language programming-language scripting tool

Last synced: about 2 months ago
JSON representation

Interpreted programming language built with Go

Awesome Lists containing this project

README

        




Logo

Fizz, the programming language


Interpreted dynamic programming language built with Go.


Documentation ยป




Examples
ยท
Report Bug
ยท
Download



Table of Contents


## About

Fizz is a dynamic and interpreted programming language built with Go. It is strongly typed and comes with very readable and accurate error messages. Fizz has most of the standard functionality that you would expect from modern programming languages. The library system also allows the user to implement their own features as Go functions and port them directly into Fizz. If you like this project, consider giving it a star ๐Ÿ˜‰

### Features

- Variables, conditionals, and loops
- Functions, arrays, and objects
- File imports and libraries
- Clean syntax and simple grammar


## Installation

Prebuilt binary of the [latest release (v1.1.0)](https://github.com/jesperkha/Fizz/releases/tag/v1.1.0).

You can also build from source. However, building from source from a non-release branch does not guarantee that everything works as expected as some things may be undergoing changes.

1. Clone repo
2. Run the `build.sh` file

### Syntax highlighting

Finally, there is also optional, but recommended, [syntax highlighting](https://github.com/jesperkha/fizz-extensions) extensions for both Visual Studio Code and micro.


## Documentation

You can read the [full language documentation](./docs/lang.md) to learn about all of Fizz's syntax. It is also recommended to quickly skim over [the language grammar](./docs/grammar.md) to make sure you undestand the basics of how Fizz is structured (don't worry, it's _very_ similar to most modern programming languages).

Make sure to check out [the command-line basics](./docs/cmd.md) too so you know how to run your code and also which configurations you can apply.


## Running a program

[Full documentation on command-line basics](./docs/cmd.md)

### Terminal mode

Running the interpreter without giving a filename will run the terminal mode where you can run any valid Fizz code live. Errors are printed but the program is not terminated. Newlines are supported for blocks and the code will not be executed until the block is closed.

### Run file

Running the interpreter and giving a filename simply runs the code in the file and halts if an error occurs. Fizz files must end with the `.fizz` suffix. Both of the following are valid:

```console
$ ./fizz myFile.fizz
$ ./fizz myFile
```


## Code examples

Some simple code examples written in Fizz. There are more and bigger examples in the `examples` directory. All of the features used here and many more are thoroughly documented in the [documentation page](./docs/lang.md).


Write to a file:

```go
include "io";
include "str";

define Person {
name, age
}

func writePerson(person) {
if person == nil : person.name == "" {
error "Please enter a valid person";
}

io.appendFile("names.txt", str.format(person));
}

john := Person("John", 59);
writePerson(john);
```


Find max and min numbers in array:

```go
include "str";

arr := [5, 3, 7.5, 8, 2];
max := 0;
min := 999;

range n in arr {
if n > max {
max = n;
}
if n < min {
min = n;
}
}

print "Max: " + str.toString(max);
print "Min: " + str.toString(min);
```