BackTalk is a programming language designed to provide simple points of configuration or interaction within a larger piece of software. For instance, it could be used to allow a user to add custom behaviour to a button in a WYSIWYG website editor. You can try out BackTalk right now by going through the interactive BackTalk tutorial.

The syntax is designed to be expressive and also natural. It is also very simple, and can be easily remembered. Variables start with a “$” and function calls look like natural language. Here is an example of a small script you could write and execute with BackTalk:

-- this is a comment
with $color as "orange"
set the background color to $color

A more complicated script could look something like this:

with $all_words as (an empty set)

for each $word in the text:
    with $lowered as (convert $word to lowercase)
    add $lowered to $all_words

show message:
    "there are"
    (length of $all_words)
    "words in the text"

Many of the functions in the samples above would be expected to be written by the BackTalk embedder.

The embedder can write functions that execute asynchronously, create loops, modify and access the surrounding scope, and also run whatever JavaScript behaviours are desired. Any function which returns a Promise will pause the BackTalk VM until the promise is resolved. This is done transparently, allowing for complex async behaviours to appear as simple, synchronous scripts.

with $user_info as (GET "/user/3")
with $posts as (GET (attribute "posts_url" of $user_info))

-- let's say this renders the template using the scope Variables
-- set up in the block below it
render template "posts_index.html":
    with $user as $user_info
    with $posts as $posts

As you can see, BackTalk code sometimes looks a bit lispy. The whole project is still a bit rough around the edges, but it uses a PEG to parse the input, has a real AST, and uses a simple VM to run the code. The whole project is written in TypeScript, Microsoft’s static-typed superset of ECMAScript 6, and is well tested.