Right now the source is on gitlab.
This is a tech demo at the moment, so these examples let you see how the compiler works step by step. When Tenet has a working compiler, the site will be refocused on the target audience.
Tenet lets you define complex types using tuples, unions, enums, lists, sets, maps, strings and integers. Read more.
Unlike most serialization languages, Tenet is fully programmable, so you can define complex behavior along with types, but it has very predictable and simple semantics.
- A faux-mutable type system.
- It’s an immutable type system that prevents global side-effects.
- But using an imperative language accessible to subject matter experts and amateurs.
- Static types that are as easy as JSON.
- If you want to return
ok ~ ( data: "my data", count: 6 )you can just do that.
- Type inference figures out the actual type.
- And then Tenet can document it correctly for you.
- User-defined functions in a serialization language.
- Build smart API clients with functions that further analyze data.
- Evolve your API by writing functions to cast between versions.
How does it work?
To compile to different languages, you first need to simplify everything down to a common micro-language, and then rewrite that into the target languages.
Different languages only have a few things in common we can largely depend on, such as user-defined functions, local variables, etc. Even things like for-loops aren’t available in all languages.
The underlying principle used here is the same as any compiler: take a tree and repeatedly modify it.
As you perform those modifications, you simplify the problem slightly. For instance, Tenet is faux-mutable, so one
step is “delensing” which means converting
a.b := c into
a := !!set_slot(a, "b", c).
The last tree will be the target language’s syntax, and then that can be written out as text.