Skip to content

Beremiz Documentation

Beremiz is a fun, experimental language based on the stack-based principles of Porth, created by Alexey Kutepov. While Beremiz is designed to be playful and educational, it's not intended for serious programming. Its performance is limited because it runs on top of Lua, making it relatively slow.

The name Beremiz is inspired by the character Beremiz Samir, known as "The Man Who Counted." He was created by Júlio César de Mello e Souza, a Brazilian teacher and writer better known as Malba Tahan.

A simple "Hello, World!" in Beremiz:

"Hello, World!" show

Table of Contents

Getting Started

Prerequisites

Ensure you have Lua installed on your system. You can download it from the official Lua website.

Installation

Clone this repository locally:

git clone https://github.com/AdaiasMagdiel/beremiz.git
cd beremiz

Running Beremiz Code

There are two ways to run Beremiz code:

  • Using the REPL:

    lua main.lua
    

  • Passing a file:

    lua main.lua [file]
    

Example Files

You can find several example files in the examples folder to help you get started. Here are some key examples:

  • Factorial: A program that calculates the factorial of a number.
  • Pythagorean Theorem: Demonstrates the calculation of the hypotenuse in a right-angled triangle using the Pythagorean theorem.
  • Quadratic Equation: Solves quadratic equations and finds their roots.
  • FizzBuzz: Implements the classic FizzBuzz problem, printing numbers from 1 to 15 but replacing multiples of 3 with "Fizz", multiples of 5 with "Buzz", and multiples of both with "FizzBuzz".

Running Tests

This project uses Leste, an elegant testing framework for Lua developed by me. Ensure that Leste is installed and run the tests with:

leste -vx