Source-language directive

Syntax and values

Pliro needs to know whether your instructions use English words such as say or Dutch words such as zeg. This choice is called the source language, or syntax locale. For a standalone English source file, put this language-setting line at the top:

# language: en

This special line is called a directive: it tells Pliro how to read the source. It looks like a comment because it starts with #, but Pliro recognizes its special meaning. It does not display a message when your program runs.

Pliro only looks for this directive on the first non-empty line. Put it before ordinary comments and program instructions. Empty lines above it are allowed, but keeping it right at the top is easier to follow.

When the language is supplied elsewhere

An IDE, the project’s information file, or a tool using Pliro’s API can supply the language setting. Only then may a source file omit the directive. If both the source and the other setting choose a language, they must agree.

For example, the terminal command pliro check --locale en directive-free.pliro checks an existing file named directive-free.pliro using English. The option --locale en means “read English source”; it does not translate the program or replace a conflicting directive.

The bundled choices are English (en) and Dutch (nl). Use these lowercase codes exactly. Additional installed language profiles can extend the available source-language choices.

An invisible label at the start of a file

Save source as UTF-8 without BOM. UTF-8 is the way your editor stores text. A BOM is an extra, invisible label that some editors place before that text. “UTF-8 with BOM” or “UTF-8-BOM” means the label is present. Pliro currently rejects it, even if your code looks correct.

Choose the editor’s UTF-8 without BOM saving option, then save and check the file again. Keep your language directive. What a BOM is and how to save without it explains the difference with a table and steps.

Code language and message language

The source language chooses code words such as if and say. The interface language chooses the tool’s labels, and the diagnostic language chooses its error messages. These are separate choices. English code can therefore receive Dutch error messages while doing exactly the same job.

Syntax and values · Built-ins · Programming guides