t27.aiРусский

Reading compiler errors

You will learn

How to read the line and column of an error, using four real mistakes.

A parse error says where the parser was, near which line, and the token it did not expect, with a line and a column. A type error names the constant and why its value does not fit. Read the position first, then look one token to the left: the mistake is often just before the place the parser stopped. The table shows what the compiler on this site answered for four small mistakes.

Try it

Make each of the four mistakes in the player and match the line and column with the table.

Open the interactive lesson →

t27 basics 25: four mistakes and what t27c says
t27 basics 25: four mistakes and what t27c says ↗

Four small mistakes in a t27 spec and the exact message the real compiler printed for each. Lesson 25 of the t27 basics course.

specs/basics/25_reading_errors.t27

// SPDX-License-Identifier: Apache-2.0
; t27 basics, lesson 25: Reading compiler errors.
; An error names a stage, a line and a column, and what the compiler expected.

module basics_25_reading_errors;

pub const MISTAKES_SHOWN : u8 = 4;

test four_mistakes {
    assert MISTAKES_SHOWN == 4;
}

Open the lesson's spec in the player ↗

All lessons