A fast, powerful, and safe interpreter written in rust!

Overview

Kraber

A fast, powerful, and safe programming language written in rust!

About

It packs a punch like the Kraber .50-Cal. Kraber is designed to be minimal, flexible, and readable. Everything follows a clear and consistent pattern.

Syntax

Basic

  • declaring a variable called foo with type integer: declare foo as integer
  • setting the variable foo to the integer +1: set foo to +1
  • printing foo: foo

Scopes

Scoped blocks are defined by curly braces in Kraber. Accessing a local variable outside the block it was declared in will result in an error.

declare x as whole
set x to 0
while lt(x 4) {
  declare y as whole
  set x to add(x 1)
  set y to multiply(x 2)
}
y
called `Option::unwrap()` on a `None` value

Operators

Operators do not exist in Kraber. Instead, everything is done with functions because they are not limited to unary or binary operations. Functions that are both commutative and associative can take an infinite number of arguments.

Numeric Types

Kraber only performs type coercion on numeric data types.

The + and - signs are not operators but are used to prefix integers (signed) to distinguish them from whole (unsigned) numbers.

Examples

Implicit Printing

This makes debugging quick and easy.

declare x as text
set x to "Hello, Kraber!"
x

Boolean Operations

Boolean operations are handled by Kraber Functions written in rust.

Tip

All logic gates can be made using the nand gate!

declare x as boolean
set x to nand(true true)
x

Arithmetic Operations

declare x as float
set x to add(1 2)
set x to multiply(x 2)
set x to raise(x 2)
x

String Operations

declare word as text
set word to "OK, "
set word to multiply(word 2)
set word to join(word "thanks for making Kraber!")
word

Loops

Tip

While loops can be used to implement if statements!

declare x as boolean
set x to true
while x
{
  set x to nand(true true)
}

Functions

declare factorial as function
set factorial to fun (n as whole) as whole
{
  while equal(n 0) {
    return 1
  }
  return multiply(n factorial(add(n -1)))
}
factorial(69)
You might also like...
Simple yet powerful multi-line text editor widget for tui-rs and ratatui
Simple yet powerful multi-line text editor widget for tui-rs and ratatui

tui-textarea tui-textarea is a simple yet powerful text editor widget like textarea in HTML for tui-rs and ratatui. Multi-line text editor can be ea

A Typescript interpreter in Rust.

typescript This is a Rust native implementation of a Typescript Parser and a JIT execution engine. This project comes in two crates: [typescript-ast]:

An Interpreter for Brainfuck programming language implemented in the Rust programming language with zero dependencies.

Brainfuck Hello, Visitor! Hey there, welcome to my project showcase website! It's great to have you here. I hope you're ready to check out some awesom

Rust-based interpreter for the Dreamberd (https://github.com/TodePond/DreamBerd) language

Dreamberd.rs Rust-based interpreter for the Dreamberd language. The full specification for Dreamberd is available at https://github.com/TodePond/Dream

A BASIC language interpreter. Does not conform to existing standards. Mostly a toy.
A BASIC language interpreter. Does not conform to existing standards. Mostly a toy.

JW-Basic A toy language that is somewhat like QBasic. Features: Graphics: 160x96 (255 colors & transparent) Text: 32x16 (4x5 font) Character set: ASCI

🪞 Powerful reflection library for Rust

🪞 mirror-mirror Powerful reflection library for Rust 🚨 Warning 🚨 This library is still experimental and should not be used for anything serious, ye

🗄️ A simple (and safe!) to consume history of Client and Studio deployment versions.

🗄️ Roblox Version Archive A simple (and safe!) to consume history of Client and Studio deployment versions. About Parsing Roblox's DeployHistory form

An abstract, safe, and concise color conversion library for rust nightly This requires the feature adt_const_params

colortypes A type safe color conversion library This crate provides many methods for converting between color types. Everything is implemented abstrac

nvim-oxi provides safe and idiomatic Rust bindings to the rich API exposed by the Neovim text editor.

🔗 nvim-oxi nvim-oxi provides safe and idiomatic Rust bindings to the rich API exposed by the Neovim text editor. The project is mostly intended for p

Owner
Int Fract
TypeScript • Python • Dart • C# • Rust Young math enthusiast and software developer!
Int Fract
⚡️ A blazing fast way of maintaining powerful notes with connections between them.

Zettl ⚡️ A blazing fast way of maintaining powerful notes with connections between them. Installing Zettl To install Zettl, you will need the Rust too

Tirth Jain 26 Dec 2, 2022
Rustle: a powerful download manager and accelerator written in Rust

Rustle Rustle: a powerful download manager and accelerator written in Rust. Preview Features Resumable Downloads: Allow interrupted downloads to be re

Bishoy Roufael 4 Aug 19, 2023
A safe, fast, lightweight embeddable scripting language written in Rust.

Bud (budlang) A safe, fast, lightweight embeddable scripting language written in Rust. WARNING: This crate is not anywhere near being ready to publish

Khonsu Labs 13 Dec 27, 2022
A comprehensive collection of resources and learning materials for Rust programming, empowering developers to explore and master the modern, safe, and blazingly fast language.

?? Awesome Rust Lang ⛰️ Project Description : Welcome to the Awesome Rust Lang repository! This is a comprehensive collection of resources for Rust, a

Shubham Raj 16 May 29, 2023
RustVulnsScan is a powerful system vulnerability scanner written in Rust

RustVulnsScan is a powerful system vulnerability scanner written in Rust. It allows you to perform comprehensive scans of your system to identify potential vulnerabilities and security risks.

null 2 Jul 2, 2023
A lightweight but incredibly powerful and feature-rich BitTorrent tracker. Supports UDP + HTTP(S) and a private tracker mode.

Torrust Tracker Project Description Torrust Tracker is a lightweight but incredibly powerful and feature-rich BitTorrent tracker made using Rust. Feat

Torrust 162 Dec 31, 2022
An interpreter and compiler for the Brainfuck language.

Brainrust ?? An interpreter and compiler for the Brainfuck language. Prerequisites You need a LLVM 16.0.* installation on your system. On Windows, you

Michael Gerhold 4 Nov 4, 2023
The safe, fast and sane package manager for Linux

moss-rs A rewrite of the Serpent OS tooling in Rust, enabling a robust implementation befitting Serpent and Solus We will initially focus on moss and

Serpent OS 16 Oct 10, 2023
Estratto is a powerful and user-friendly Rust library designed for extracting rich audio features from digital audio signals.

estratto 〜 An Audio Feature Extraction Library estratto is a powerful and user-friendly Rust library designed for extracting rich audio features from

Amber J Blue 5 Aug 25, 2023
Simpler and more powerful replacement for `find`

FindFile (FF) An simple, ergonomic, and powerful replacement for find. Note: this repo is under active development The syntax is (mostly) figured out,

Sam Westerman 4 Jun 20, 2023