All Projects → NicoNex → tau

NicoNex / tau

Licence: GPL-3.0 license
Tau is an open source interpreted programming language designed to be minimal, fast and efficient.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to tau

nj
NJ is a simple script engine in golang with Lua-like syntax.
Stars: ✭ 19 (-26.92%)
Mutual labels:  interpreter
Cosmo
Embeddable scripting language loosely based off of Lua
Stars: ✭ 14 (-46.15%)
Mutual labels:  interpreter
chirp
Interpreter in C for rockstar programing language
Stars: ✭ 20 (-23.08%)
Mutual labels:  interpreter
prolog
The only reasonable scripting engine for Go.
Stars: ✭ 408 (+1469.23%)
Mutual labels:  interpreter
lpp-vita
Lua Player Plus for PSVITA. Documentation on: http://rinnegatamante.github.io/lpp-vita/
Stars: ✭ 149 (+473.08%)
Mutual labels:  interpreter
scheme.ml
Scheme (R6RS subset) interpreter written in OCaml
Stars: ✭ 14 (-46.15%)
Mutual labels:  interpreter
NPython
(Subset of) Python programming language implemented in Nim
Stars: ✭ 17 (-34.62%)
Mutual labels:  interpreter
huginn
Programming language with no quirks, so simple every child can master it.
Stars: ✭ 41 (+57.69%)
Mutual labels:  interpreter
fayrant-lang
Simple, interpreted, dynamically-typed programming language
Stars: ✭ 30 (+15.38%)
Mutual labels:  interpreter
lambda
lambda calculus interpreter
Stars: ✭ 23 (-11.54%)
Mutual labels:  interpreter
g2d
Craft beautiful geometric art using code.
Stars: ✭ 40 (+53.85%)
Mutual labels:  interpreter
monkey-rs
An interpreter for the Monkey programming language written in Rust
Stars: ✭ 27 (+3.85%)
Mutual labels:  interpreter
code editor unity
A code editor for MY-BASIC, powered by the Unity3D engine. With this you may create your own Code Editor, Debugger and IDE for different scripting languages.
Stars: ✭ 13 (-50%)
Mutual labels:  interpreter
nopforth
A dialect of the Forth programming language
Stars: ✭ 22 (-15.38%)
Mutual labels:  interpreter
opengml
GML interpreter
Stars: ✭ 30 (+15.38%)
Mutual labels:  interpreter
LambdaCore
An interpreted language written in Rust inspired by the Lisp family of languages.
Stars: ✭ 56 (+115.38%)
Mutual labels:  interpreter
gossa
The Go/Go+ Interpreter
Stars: ✭ 53 (+103.85%)
Mutual labels:  interpreter
PospoliteView
Pospolite View aims to be a simple HTML viewer engine fully made in Free Pascal.
Stars: ✭ 29 (+11.54%)
Mutual labels:  interpreter
pikt
🎨 Image-based poetic programming language.
Stars: ✭ 72 (+176.92%)
Mutual labels:  interpreter
PureScript
A C# hot reload framework for Unity3D, based on Mono's MONO_AOT_MODE_INTERP mode.
Stars: ✭ 258 (+892.31%)
Mutual labels:  interpreter

τ

Tau is a dinamically-typed open source programming language designed to be minimal, fast and efficient.

Installation

In order to install Tau, you'll need Go.

Once done, running the following command will successfully install the tau interpreter:

go install github.com/NicoNex/tau@latest

You can try it out in the terminal by simply running $ tau, alternatively to take advantage of the builtin virtual machine and gain a lot of performance run it with $ tau -vm. The flag -vm works when executing files too. For additional info run $ tau --help.

Syntax

Hello World

We all start from here...

println("Hello World")

Examples

File

As every interpreter Tau supports files either by passing the path to the interpreter or by using the shabang.

# helloworld.tau

println("hello world")
$ tau helloworld.tau
hello world

if-else blocks

if 1 > 0 {
	println("yes")
} else {
	println("no")
}
myVar = 10

if myVar > 10 {
	println("more than 10")
} else if myVar == 10 {
	println("it's exactly 10")
} else {
	println(myVar)
}

Declaring a function

loop = fn(times, function) {
	if times > 0 {
		function()
		loop(times-1, function)
	}
}

loop(5, fn() { println("Hello World") })

Noteworthy features

The return value can be implicit:

add = fn(x, y) { x + y }
sum = add(9, 1)
println(sum)
>>> 10

Also you can inline the if expressions:

a = 0
b = 1

minimum = if a < b { a } else { b }

The semicolon character ; is implicit on a newline but can be used to separate multiple expressions on a single line.

printData = fn(a, b, c) { println(a); println(b); println(c) }

Functions are first-class and treated as any other data type.

min = fn(a, b) {
	if a < b {
		return a
	}
	b
}

var1 = 1
var2 = 2

m = min(var1, var2)
println(m)
>>> 1
REPL

Tau also supports REPL:

>>> add = fn(a, b) { a + b }
>>> string(add)
fn(a, b) { (a + b) }
>>> string(21)
21
>>> recursive_loop = fn(n, func) { if n != 0 { func(n); recursive_loop(n-1, func) } }
>>> recursive_loop(10, fn(n) { println("hello", n) })
hello 10
hello 9
hello 8
hello 7
hello 6
hello 5
hello 4
hello 3
hello 2
hello 1

Data types

Tau is a dynamically-typed programming language and it supports the following primitive types:

Integer

my_var = 10

Float

my_var = 2.5

String

str = "My string here"

Boolean

t = true
f = false

Function

pow = fn(base, exponent) {
	if exponent > 0 {
		return base * pow(base, exponent-1)
	}
	1 # You could optionally write 'return 1', but in this case the return is implicit.
}

List

empty = []
stuff = ["Hello World", 1, 2, 3, true]

Map

empty = {}
stuff = {"Hello": "World", 123: true}

Loop

for i = 0; i < 10; ++i {
	println("hello world", i)
}

lst = [0, 1, 2, 3, 4]

println(lst)
for len(lst) > 0 {
	println(lst = tail(lst))
}

Objects

obj = new()
obj.value1 = 123
obj.value2 = 456

obj.sum_values = fn() {
	obj.value1 + obj.value2
}

obj.child = new()
obj.child.value = obj.sum_values()
Recommended usage
Dog = fn(name, age) {
	dog = new()

	dog.name = name
	dog.age = age

	dog.humanage = fn() {
		dog.age * 7
	}

	return dog
}

snuffles = Dog("Snuffles", 8)
println(snuffles.humanage())
>>> 56
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].