t27.aiРусский

What a spec is

You will learn

What goes into a .t27 file and what the compiler gives back for it.

A spec is a plain text file that ends in .t27. It opens with a module line, declares values and functions, and carries test blocks that check them. The compiler, t27c, reads the file and answers with a verdict and code for 7 backends. The spec under this lesson has 2 constants and 1 test, and the site compiles it in your browser.

Try it

Open the lesson spec in the player and find its three parts: the module line, the constants, the test.

Open the interactive lesson →

t27 basics 1: the three parts of a spec
t27 basics 1: the three parts of a spec ↗

A table of the parts of a .t27 file and a diagram of what t27c gives back for it. Lesson 1 of the t27 basics course.

specs/basics/01_what_a_spec_is.t27

// SPDX-License-Identifier: Apache-2.0
; t27 basics, lesson 1: What a spec is.
; A spec is one .t27 file: a module line, named values, and tests that check them.

module basics_01_what_a_spec_is;

pub const SIDES : u8 = 3;
pub const CORNERS : u8 = 3;

test a_triangle_has_as_many_corners_as_sides {
    assert SIDES == 3;
    assert CORNERS == SIDES;
}

Open the lesson's spec in the player ↗

All lessons