flang the compiler proves your program cannot hang 0.9.0 GitHub Try in the browserTry it Русский

For language developers

This page is for changing flang itself. If you came to write in it, go here: Install → Your first program → Tutorial.

Everything internal is collected here: decisions, tasks, working plans and how the compiler is built. Pages for users of the language link to internal documents only through this page.

The tree is written in Russian: identifiers and most of the prose. Commit messages are English. An English form of the language exists and lexes to the same identifiers. A patch written in English is accepted.

What is where

WhatWhereWhat is in it
Conditions for release 1.0docs/road-to-1-0.mdseven conditions: what exists, what is missing, the command and threshold that check it (in Russian)
Working roadmapdocs/ROADMAP.mdstages of work, measurements, what the language does not have (in Russian)
Decisionsdocs/adr/why it is done this way: one decision, one numbered file
Tasksdocs/tasks/what is in progress and what is free: one task, one file
Repository layoutRepository layoutwhich directory is responsible for what
Lists of checks and filesdocs/ci-inventory.md, docs/tree-inventory.mdwhich checks run in CI and what the tree consists of
Numbers in documentsdocs/prose-numbers.mdhow to mark a number so an automatic check re-measures it
Building the compilerThe compiler builds itself, docs/reprint-cost.mdhow the compiler rebuilds itself and what it costs

Build it

There is one compiler here, written in flang itself, and it builds without Node. The tree carries a bootstrap point — that same compiler printed to C99. The whole dependency list is a C compiler and make:

git clone https://github.com/digitable-lol/flang && cd flang
make -C bootstrap
bootstrap/flang --version
flang 0.9.0

The built binary is what you run from then on:

bootstrap/flang check docs/examples/rosetta/towers-of-hanoi.flang

The compiler does not need Node: the language server ships inside the same binary — flang lsp --stdio (see the editor page). Node is needed only by the site build and by the js target.

Run the checks

Two checks run on the built binary and need no Node:

sh flang/test/обход.sh
sh flang/test/обход-примеров.sh

The first walks the tree with the compiler, the second runs the examples of every program in the tree.

A third check compares the printed C against what sits in bootstrap/:

sh scripts/bootstrap-reprint.sh --bystro   # the inputs of the print only, seconds
sh scripts/bootstrap-reprint.sh --check    # print again and compare byte for byte

The full --check takes hours on one core and tens of gigabytes of memory (the numbers are in docs/reprint-ledger.tsv), so the maintainers reprint bootstrap/ in batches. Your change to flang/self/ is not expected to do it; say in the commit message that it waits for a reprint.

If you touched the site pages, add:

node docs/site/build.mjs --check

It turns red on a link to nowhere, a page without its English pair, and a substitution with no value.

Code, output of the binary, error codes and the help of the commands stand on the pages as inserts from the tree, not typed by hand: the word insert in the first line of a fenced block or in an HTML remark above a table names the source. After changing an example or the compiler, rebuild the inserts and check that the pages agree with the code:

bootstrap/flang run-script docs:build
bootstrap/flang run-script docs:check

docs:check compares every page. The hook before a push runs docs:changed: it compares only the pages whose text or sources the branch changed against the dev of its remote — an inserted file, a file named in an inserted run, the binary under bootstrap/, the compiler sources for the table of codes, flang/stdlib for the library tables — and every page when the insert plan itself changed. CI runs the full docs:check.

How inserts work: ADR-0151.

Send a change

  1. Branch off dev: git switch -c my-change origin/dev.
  2. Write it. Put examples inside the function — they run with the same flang test command as everything else.
  3. Run the checks above. A red check is not something to explain away: the change is not ready.
  4. Commit message: English, in the form type(scope): what is now true; the rules are in docs/commit-messages.md.
  5. Open a pull request into dev at github.com/digitable-lol/flang.

For a bug without a fix, open an issue in the same repository. Attach the program text and the verbatim command output with its exit code: that is enough to reproduce it.

Read this before changing the language