til
til is an extension language that aims to be implemented in as many other languages possible.
It is not intended to be a "general purpose language", but a simple way to give power to the users of applications written in other languages to configure and extend them.
Syntax
It's very similar to Tcl.
Why "til"?
- It's named after my Youtube channel: "til cleber" (it translates to "tilde cleber" or "~cleber")
- It's good to have three-letter names, as they make nice files suffixes.
- It means to, until, for, by, with, at, of, through, as, and on in Norwegian (and I discovered that after choosing the name, so I was very pleasantly surprised). See https://blogs.transparent.com/norwegian/the-norwegian-word-til/
Please, notice: do not call it "til lang" if you need to specify better that it's a programming language. I'd prefer "langtil".
Also notice the idea behind the language is to be implemented in many different other languages as an extension, so most of the names are going to be simply til-C, til-D, til-Py, til.js, til-sharp, et cetera.
Example
run std ${import std} run struct ${import struct} run dict ${import dict} run math ${import math} run iterators ${import iterators} run functions ${import functions} # Strings: set name {Cléber Zavadniak} set first_name "Cléber" set last_name "Zavadniak" # Basic math: set x 1.234 set y 4.321 run z1 ${math.run $x + $y} run z2 ${$x + $y > math.run} # Every value is a "function" that returns itself. std.out "z:$z" # There is NO auto-substitution. # The following line will print `z:$z`, literally: "z:$z" > std.out # If you want substitution, you should call the `fill` command: "z:$z" > fill > std.out # The language itself does NOT implement functions. You # should implement this feature yourself in your own # underlying language. But the overall idea would be # something like this: run g {functions.create {x} { math.assert {$x ">" 100} { iterators.foreach i {list.range 1 $x} { $i > fill > std.out } } else { $x > fill > std.out } } # (Assertions should be implemented by the user, too.) math.assert {$inc == 1} || std.fatal("$inc != 1", 1) math.assert {$x == 2} || std.fatal("$x != 2", 1) math.assert {${f 0} == 1} || std.fatal("${f 0} != 1", 1)
Components
- set variable value - assigns a value to a variable
- run variable subprogram - run a subprogram and assing it's return value to a variable
- fill value - substitute $-tokens inside value with correspondent variable values
- return value - exit current scope setting value (literally) as return value
- {} - defines a subprogram
- "" - defines a string
- > - use data returned from one function as first argument of the next
- dot-lists: a.b - should be used as namespace separators and access to fields in struct-like values
- colon-lists: in the form a:b, they are the smallest form of sequence in the language (not counting strings) - should be used as a kind of qualifier to values
til was created by Cléber Zavadniak and is released without any license.
If you want, you can read our Code of Conduct