An experimental programming language for exploring first class iterators.

Related tags

Utilities burn
Overview

Burn Language

An experimental programming language for exploring first class iterators.

Example

See examples for more.

fn main() {
    'Hello, world!\n' -> SINKS::stdout();
}

Building

Nothing to build, yet!

Design

The design of Burn is very simple as this is a learning experience in writing compilers. The focus of this language is on creating first class support for iterators as a way to logically model data flow through a program. The Burn run-time will concurrently read and write streams making it easier for programmers to focus on transforming the data in a meaningful way. See DESIGN.md for more information on the technical design of the compiler.

Data Types

  • bool
  • u8 u16 u32 u64
  • i8 i16 i32 i64
  • stream

You may notice there are no floating point or strings in Burn, but in the example above there is a string literal. The actual type of that string literal in Burn is stream . This makes interchanging input streams much easier; a useful feature for testing.

Functions

Functions are intended to model transfer functions, or "black boxes" with N inputs and M outputs. The below functions demonstrates how any number of inputs and outputs may be specified. Unlike other programming languages, all outputs must be named in Burn.

fn mix(a stream<u8>, b stream<u8>) -> (out stream<u8>) {
    while !a.eof() && !b.eof() {
        a.next() -> out;
        b.next() -> out;
    }
}

fn unmix(input stream<u8>) -> (a stream<u8>, b stream<u8>) {
    while !input.eof() {
        input.next() -> a; // next() is guaranteed here
        input.next() -> b; // but not here. In this case Burn detects
                           // the EOF and it will be a no-op.
    }
}

fn sum(a i32, b i32) -> (c i32) {
    // Return may still be used without referencing the return value names
    return a + b;
}

Additionally, if a function's outputs are all stream types, then Burn will execute the function as needed to progress the program. In other words, you may setup a chain of functions for which data will flow through one item at a time, rather than shuffling large buffers.

Tuples

Burn uses tuples to group inputs and outputs, however there is no tuple type. This means you cannot assign a tuple to a variable; it must be unpacked. Use _ to discard unneeded values.

x, y := unmix(data);

Arrow operator

The arrow operator -> has three purposes:

  • Function definitions to describe inputs and outputs
  • Syntactic sugar for passing tuples to functions
  • Most importantly, write a value to a stream

Syntactic sugar

fn main() {
    // All equivalent to mix('hello', 'world');
    ('hello', 'world') -> mix();
    'world' -> mix('hello', _);
    'hello' -> mix(_, 'world');
}

Write a value to a stream

fn main() {
    s := 'foo';
    ' bar' -> s;
    // When checked, s == 'foo bar'
}

Sources and Sinks

Burn uses special namespaces SOURCES and SINKS for defining all the sources and sinks a programmer may use. Remember this is an experimental language, so defining new sources or sinks is not possible. Below is the complete list.

Function Returns Description
SOURCES::stdin() stream Standard input
SOURCES::args() stream > Space separated command line arguments
SOURCES::raw_args() stream Command line arguments
SOURCES::tcp(port int) (input stream , output stream ) Opens a port and accepts a connection, returning the input and output streams associated with the connection
SOURCES::file(filename stream ) (found bool, data stream ) Reads a file from the filesystem
SINKS::file(filename stream ) stream Writes a file to the filesystem
SINKS::stdout() stream Standard output
SINKS::stderr() stream Standard error

stream methods

Method Returns Description
next() T Reads and consumes the next item in the stream
consume(n u32) stream Reads and consumes the next n items in the stream
get(n u32) T Returns the nth item in the stream without consuming any items
len() u32 Returns the number of items currently in the stream
eof() bool Returns whether the stream has ended or not (end of file)
cycle() stream Cycles the input stream indefinitely
split(delim stream ) stream > Splits the stream into chunks, excluding delim
parse() - Context specific; converts a stream to the inferred numeric type (defaulting to i32 if it cannot be inferred)

Progress and Current State

  • Design
  • Lexing
  • Parsing
  • Checking
  • Code generation

Contributing

Contributions are welcome!

You might also like...
Experimental playground for wiktionary data

wikt Experimental playground for wiktionary data. This document might not update as often as the code does. Set up You'll want a minimum of 10 GB free

Experimental syntax for Rust

Osy.rs Experimental syntax for Rust Hey everyone, this readme needs work! The spec has been roughed out in Osy.rs_spec.alpha, but the file could be be

An experimental Rust crate for sigstore

Continuous integration Docs License This is an experimental crate to interact with sigstore. This is under high development, many features and checks

Experimental Valve Index camera passthrough for Linux

Index camera passthrough Warning: This is still a work in progress, you could get motion sickness if you try it now The problem that the Index camera

Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code

Diplomat is an experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code. With Diplomat, you can simply define Rust APIs to be exposed over FFI and get high-level C, C++, and JavaScript bindings automatically!

An experimental implementation of Arc against Apache Datafusion

box This is an experimental repository to perform a proof of concept replacement of the Apache Spark executor for Arc with Apache DataFusion. This is

An experimental transpiler to bring tailwind macros to SWC 🚀

stailwc (speedy tailwind compiler) This is an experimental SWC transpiler to bring compile time tailwind macros to SWC (and nextjs) a-la twin macro. T

An experimental RISC-V recompiler

WARNING: All of this code is highly experimental and is a direct result of a two day hacking binge fueled by a truckload of tea. It's definitely not s

An experimental Athena extension for DuckDB 🐤

DuckDB Athena Extension WARNING This is a work in progress - things may or may not work as expected 🧙‍♂️ Limitations Only the default database is sup

Owner
Miccah
Miccah
The axiom profiler for exploring and visualizing SMT solver quantifier instantiations (made via E-matching).

Axiom Profiler A tool for visualising, analysing and understanding quantifier instantiations made via E-matching in a run of an SMT solver (at present

Viper Project 18 Oct 18, 2022
A proc macro for creating compile-time checked CSS class sets, in the style of classNames

semester Semester is a declarative CSS conditional class name joiner, in the style of React's classnames. It's intended for use in web frameworks (lik

Nathan West 11 Oct 20, 2022
Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.

Linkerd ?? Welcome to Linkerd! ?? Linkerd is an ultralight, security-first service mesh for Kubernetes. Linkerd adds critical security, observability,

Linkerd 9.2k Jan 1, 2023
Fegeya Gretea (aka green tea), new generation programming language.

Fegeya Gretea Gretea (aka green tea), new generation programming language. A taste of Gretea's syntax: import tea.green.fmt module hello { fn hel

Ferhat Geçdoğan 13 Sep 28, 2022
A formal, politely verbose programming language for building next-gen reliable applications

vfpl Pronounced "Veepl", the f is silent A politely verbose programming language for building next-gen reliable applications Syntax please initialize

VFPL 4 Jun 27, 2022
Cookiecutter templates for Serverless applications using AWS SAM and the Rust programming language.

Cookiecutter SAM template for Lambda functions in Rust This is a Cookiecutter template to create a serverless application based on the Serverless Appl

AWS Samples 24 Nov 11, 2022
The compiler of the okta programming language.

oktac The compiler of the okta programming language. For more information please visit the official website, and to quickly get okta running refer to

mikel 0 Dec 23, 2021
Aws-sdk-rust - AWS SDK for the Rust Programming Language

The AWS SDK for Rust This repo contains the new AWS SDK for Rust (the SDK) and its public roadmap. Please Note: The SDK is currently released as a dev

Amazon Web Services - Labs 2k Jan 3, 2023
Programming language just for fun, will kill LUA some day.

Loom Programming language just for fun, will kill LUA some day. Currently development of this language is algorithm driven. I'm trying to implement va

Mateusz Russak 5 Dec 4, 2023
A simple workshop to learn how to write, test and deploy AWS Lambda functions using the Rust programming language

Rust Lambda Workshop Material to host a workshop on how to build and deploy Rust Lambda functions with AWS SAM and Cargo Lambda. Intro What is Serverl

Luciano Mammino 13 Mar 28, 2024