Fizz

command module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 11 Imported by: 0

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

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 extensions for both Visual Studio Code and micro.


Documentation

You can read the full language documentation to learn about all of Fizz's syntax. It is also recommended to quickly skim over the language grammar 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 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

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:

$ ./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.


Write to a file:

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:

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
lib
io
str

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL