New language track: Triton VM assembly (tasm)

Since github.com/exercism/generic-track’s issue template suggests that the protocol for proposing new language tracks is to first raise the issue on the forum and then propose it on the issue tracker, I’ll post the suggestion here first:

What programming language should we add?

Triton VM assembly (tasm)

What is the official website for the language?

https://triton-vm.org/

Is this a language that comes in many variants?

Only one variant.

Does the language have an official logo?

https://triton-vm.org/img/triton.svg

Is there a testing framework available for the language?

Not yet.

Triton VM assembly is still not so ergonomic to work with. An Exercism track would be a motivating framework to make Triton VM assembly generally accessible, for example with better command-line support, less direct dependence on Rust, and an interactive, graphical debugger.

Is this language listed as ‘supported’ by Highlightjs?

Not yet.

If it is not supported by Highlightjs, what is the closest supported language it maps to?

None.

It would be simple to add Triton VM assembly to Highlightjs, but I wouldn’t consider syntax highlighting a required feature. Assembly programming doesn’t have a lot of syntax.

Who will be leading the effort to launch the track?

sshine – I’ve previously been a track maintainer for a handful of languages. I proposed the creation of the tcl track and the jq track. I did contribute a little to the tcl track (some bootstrapping, creation of some exercises), but glennj did most of the work on both tracks. Besides my past involvement with Exercism, I’ve been writing a fair deal of Triton VM assembly.

jan-ferdinand – the main contributor of Triton VM. While I’m among those who know the assembly language best, Ferdinand has architected the VM and will be happy to take some role in building the learning material. He is the main author of docs for the VM: Instruction Set Architecture - Triton VM

Pitch

An idea is to create a language track for learning Triton VM assembly (tasm) on Exercism.

Because tasm is both an assembly-level language and somewhat domain-specific, a tasm track could draw inspiration from the jq track (being domain-specific) and the x86_64 track (being an assembly-level language):

Triton VM was built to execute zero-knowledge protocols, so the problems that are interesting to solve in tasm are often cryptography-related. Because of the cost model of the VM (which clocks only at the megahertz level when you factor in the total cost of all the zk-STARK cryptography), efficient execution matters more.

The assembly-level interface to Triton VM is unintuitive in a number of ways:

  • Because math, one does not just goto; they skiz call.
  • Because crypto, the VM has a secret back-door input channel, and the machine word size is not 64-bit, but wraps around at p = 2^{64} - 2^{32} + 1.
  • Because reasons, the VM is stack-based and not register-based, so if you were used to program with variables, good luck, they keep changing their position.

A number of practice exercises would revolve around getting comfortable with basic control-flow; e.g. how to roll your own if-then-else, while-loop, early exit, how to allocate memory, how to call other subroutines without messing up the stack, how to build basic recursive functions like Fibonacci.

A number of concept exercises would revolve around making Triton VM practically useful; e.g. simulating 64-bit arithmetic with carry-logic, hashing Merkle trees, proving and verifying Merkle-tree membership, verifying a sudoku solution, proving that the n’th Fibonacci number is fib(n) succinctly (without revealing the execution), zero-knowledge rock-paper-scissors-lizard-spock, in which two players commit to a gesture, and with

Lastly, protocols that involve Triton VM’s flagship program, The Recufier, can be made for recursively verified protocols; e.g. given two integers (a, b) and a proof is_fib(a, b), prove is_fib(b, a+b). The neat and innovative thing here is that verifying that these are Fibonacci numbers is asymptotically faster than computing the sequence.

1 Like

Hi Simon. Nice to hear from you.

Sounds like a good plan. The only one thing I’d say is that because Concept Exercises come before Practice Exercises, we might need to at least make a few basic concept exercises for the control flow stuff too.

We’ll get a repo set up for you :slight_smile:

Awesome!

Sounds like the control-flow practice exercises I suggested might as well be concept exercises, and the practice exercises could be a relevant subset of the practice exercises that are shared between tracks.

This sounds really interesting!

I’ve created the repository here:

I sent invitations to the maintainer team to both sshine and
jan-ferdinand.

1 Like