Seven backends
You will learn
The names of the 7 backends and how much code each wrote for one small spec.
The compiler in your browser has 7 backends: c, js, rust, ts, verilog, verilog_hir and zig. Each reads the same parsed spec and writes code in its language; the verilog_hir backend is written from the hardware view, HIR. The table shows the bytes each backend wrote for the lesson spec, measured with the compiler on this site. Bigger is not better: each language needs a different amount of text.
Try it
Open each backend tab of the lesson spec in the player and find the function add.

How many bytes each of the 7 t27c backends wrote for one small spec, measured with the real compiler. Lesson 22 of the t27 basics course.
specs/basics/22_seven_backends.t27
// SPDX-License-Identifier: Apache-2.0
; t27 basics, lesson 22: Seven backends.
; One spec, seven languages: what each backend of t27c writes.
module basics_22_seven_backends;
pub const WIDTH : u8 = 8;
pub fn add(a: u8, b: u8) -> u8 {
return a + b;
}
test width_is_a_byte {
assert WIDTH == 8;
}
All lessons
Module 1 · A spec file
What a .t27 file holds: a module line, prose lines and comments.
Module 2 · Values and types
Constants, the width of a whole number, and true, false and text.
Module 3 · Arrays, trits and expressions
Lists of values, the three values of a trit, and what operators compute.
Module 4 · Tests and functions
A test block, several small tests in one spec, and a function with typed inputs.
Module 5 · Inside a function
Names with let and var, choices with if and switch, and loops.
Module 6 · Visibility and your own types
What pub shares with other modules, and the structs and enums you declare.
Module 7 · Modules, rules and gen-ts
Reading another module, stating a rule that always holds, and a spec turned into TypeScript.
Module 8 · The compiler and tri
The backends t27c writes, the stages it reads a spec in, and the tri command.
Module 9 · Errors, a program, what next
Reading a compiler error, one small complete program, and the course to take next.