Skip to content

Latest commit

 

History

History
77 lines (44 loc) · 3.28 KB

README.md

File metadata and controls

77 lines (44 loc) · 3.28 KB

Travis Codecov GoDoc go-report

Talang

Talang is a custom programming language, specifically a lisp-dialect, implemented in Go, that we developed and use internally at Talon.One.

Motivation

The motivation behind developing our own custom language is that the very nature of what our customers are doing in the core of our product is a form of programming. We needed a language to represent these "programs" with certain characteristics:

  • Easy to parse, interpret and manipulate
  • Easy to represent in JSON
  • Safe runtime properties (Talang has no recursion, no infinite loops)
  • Type-safe expressions

No existing language would fit these requirements and was also easy to integrate.

How do we use Talang at Talon.One?

Within our product, we let our customers write their own sets of what we call "Rules". These are concluded of two main types of expressions:

  • Conditions: representing predicates which evaluate to a boolean reault
  • Effects: representing expressions which return side effects handled by the promotions

We needed a way to give our customers the flexibility and control when composing such "Rules".

At the core of our product we developed a processing engine which takes these predefined Rules, gives them an execution context, and evaluates them. The return result(s) from this engine then returned to our customers to process / work with.

Why would you need it?

Talang is a very simple, fast and flexible language which is very easy to represents in JSON objects. When you desire a language, customizable, expandable, with no compiling time and fast evaluation time - Talang can be a very good choice for your requirements.

Usage

Get the package:

$ go get github.com/talon-one/talang

Then import it and use the Interpreter:

interp := talang.MustNewInterpreter()
result, err := interp.LexAndEvaluate(`(+ 1 2)`)
if err != nil {
	panic(err)
}
fmt.Println(result.Stringify()) // 3

You can refer to the examples folder for more examples and usages.

Here you can see a list of the embedded function in the language.

Playing Around

Check out our brand new playground at https://talang-land.talon.one/.

Or alternatively, get our CLI locally and play with Talang in your consolse!

Contributing

We have collected notes on how to contribute to this project in CONTRIBUTING.md.

License

Talang is released under the MIT License.