Scripting language for Go.

Overview

Minima

Minima is an experimental interpreter written in Go (the language is called the same). We needed a way to massage our JSON data with a scripting language.

The syntax (or the lack of it) is inspired by Lisp, to be easy to parse for machines. However, I tried to get rid of the zillions of parentheses to be easy to parse for humans too. With significant whitespace and indentation, the outermost parentheses are there, but they are kinda transparent.

Everything is subject to change.

General example

-- This is a comment
set n (+ 2 1)
set x 8
if (< n x)
	run
		println "Multiline if."
		println "n is smaller than " x
	println "n is greater or equal than " x
for n
	println "n is " n

This above snippet will produce:

Multiline if.
n is smaller than 8
n is 3
n is 3
n is 3

Newline shorthand

One can use the ";" as a shorthand for a newline with same indentation:

set a 10; set b 20

Function definition and call

set k 10
func l (u) (run
	println k
	+ u u u u)
println (l 20) 
println u

Produces:

10
80
<nil>

Closures

func l (u) (run
	set m 9
	func (v) (+ v u m))
set p (l 10)
println (p 30)
println (p 40)

Produces:

49
59

Recursion

func fib (x)
	if (| (eq x 0) (eq x 1))
		get x
		+ (fib (- x 1)) (fib (- x 2))
println (fib 15)

Produces:

610

Panic/recover

func k (panic "OMG")
func f (run
	recover (run(println "Recovering from " prob) (+ 1 1))
	println "Panicking in next function call."
	k
	println "This shall not run.")
func l (run
	println "Just a casual println..."
	set ret (f)
	println "This shall run."
	get ret)
println (l)
println "Recovered"

Produces:

Just a casual println...
Panicking in next function call.
Recovering from OMG
This shall run.
2
Recovered

Defer

func f (run
	defer (println 0)
	defer (println 1)
	println "This shall run before the deferred functions.")
f

Produces:

This shall run before the deferred functions.
1
0

Goals

  • Create a language in pure Go.
  • Create a scripting language which is statically typed.

Latest additions

  • Defer
  • Panic/Recover
  • Better recursion support.
  • Eq, |, & operators.
  • Variable scoping, functions, closures.

Roadmap

  • Defer
  • []interface{} and map[string]interface{} types to be able to handle JSON data.
  • More syntactic sugar (expect some neat things here).
  • More builtin goodies.
  • Static typing.
  • Packages.
  • A mongodb driver ;)
  • Optimizations.
You might also like...
The Slick programming language is an s-expression surface syntax for Go.

The Slick programming language The Slick programming language is a Lisp/Scheme-style s-expression surface syntax for the Go programming language, with

Pineapple Lang is a simple programming language demo implements by Go

Pineapple Lang is a simple programming language demo implements by Go. It includes a hand-written recursive descent parser and a simple interpreter, although the language is not even Turing-complete. But this repo's main goal is to give beginners of compilation principles a warm up and a simple look at how a programming language is built.

Compiler for a small language into x86-64 Assembly

Compiler This project is a small compiler, that compiles my own little language into X86-64 Assembly. It then uses yasm and ld to assemble and link in

GoPlus - The Go+ language for data science

GoPlus - The Go+ language for data science NOTE: Go+ is still under heavy developement. Please don't use it in production environment. Summary about G

GoPlus - The Go+ language for data science

GoPlus - The Go+ language for data science NOTE: Go+ is still under heavy developement. Please don't use it in production environment. Summary about G

⛳ A minimal programming language inspired by Ink, JavaScript, and Python.

⛳ Golfcart My blog post: Creating the Golfcart Programming Language Getting Started Scope Rules Usage Building and tests Contributions License Golfcar

Simple, safe and compiled programming language.

The X Programming Language Simple, safe and compiled programming language. Table of Contents Overview OS Support Contributing License Overview The X p

A interpreter of SweetLang, is writed in Go Programming language.

SweetLang ( Soon ) A interpreter of SweetLang, is writed in Go Programming language. SweetLang is made with clarity and simplicity we try to make its

interpreter for the basic language written in golang
interpreter for the basic language written in golang

jirachi interpreter for the basic language written in golang The plan supports the following functions: Arithmetic Operations (+, -, *, /, ^) Comparis

Owner
Janos Dobronszki
Life is cruft
Janos Dobronszki
A bytecode-based virtual machine to implement scripting/filtering support in your golang project.

eval-filter Implementation Scripting Facilities Types Built-In Functions Conditionals Loops Functions Case/Switch Use Cases Security Denial of service

Steve Kemp 92 Dec 30, 2022
Floppa programming language inspired by the brainf*ck programming language. Created just for fun and you can convert your brainf*ck code to floppa code.

Floppa Programming Language Created just for fun. But if you want to contribute, why not? Floppa p.l. inspired by the brainf*ck programming language.

null 19 Oct 20, 2022
T# Programming Language. Something like Porth, Forth but written in Go. Stack-oriented programming language.

The T# Programming Language WARNING! THIS LANGUAGE IS A WORK IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! Something like Forth a

T# 92 Jun 29, 2022
Yayx programming language is begginer friendly programming language.

Yayx Yayx programming language is begginer friendly programming language. What have yayx: Easy syntax Dynamic types Can be compiled to outhers program

null 1 Dec 27, 2021
Yayx programming language is begginer friendly programming language.

Yayx Yayx programming language is begginer friendly programming language. What have yayx: Easy syntax Dynamic types Can be compiled to outhers program

Yayx Programming Language 7 May 20, 2022
a dynamically typed, garbage collected, embeddable programming language built with Go

The agora programming language Agora is a dynamically typed, garbage collected, embeddable programming language. It is built with the Go programming l

Martin Angers 324 Dec 30, 2022
Gentee - script programming language for automation. It uses VM and compiler written in Go (Golang).

Gentee script programming language Gentee is a free open source script programming language. The Gentee programming language is designed to create scr

Alexey Krivonogov 101 Dec 15, 2022
Port of the lemon parser generator to the Go programming language

From the golang-nuts mailing list (with few modifications): --== intro ==-- Hi. I just want to announce a simple port of the lemon parser generator

null 54 Feb 17, 2022
An LL(1) parser generator for the Go programming language.

What is it? I have implemented an LL(1) parser generator for the Go programming language. I did this to build parse trees for my HAML parser. You can

Curtis Schlak 14 Jan 18, 2022
PHP bindings for the Go programming language (Golang)

PHP bindings for Go This package implements support for executing PHP scripts, exporting Go variables for use in PHP contexts, attaching Go method rec

Alex Palaistras 883 Dec 27, 2022