Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

main

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Declares the synchronous program entry point.

Aliases: main, entry

Syntax: main <block>

Category#

function

Examples#

radix/corpus/reference/keyword/incipit/incipit.fab (canonical · keyword)#

Declares the synchronous program entry point.

test "do nothing deliberately" {
    pass
}
# =============================================================================
# main — Declares the synchronous program entry point
# =============================================================================
#
# What this teaches:
#   • Declares the synchronous program entry point.
#   • Related keywords: fn, import
#
# Common mistakes:
#   • Attaching `@ cli` to a non-`main` declaration — `@ cli` may only annotate an `main` entry point (SEM009).
#
# See also: fn, import
# =============================================================================

# main — basic program entry point
#
# main { <body> }
#
# GRAMMAR:
#   entryBlock :← 'main' block
#
# EXPECTED OUTPUT:
#   none — smoke asserts exit 0; entry diagnostic via print.
#
# BACKEND:
#   Contrast with salve-munde.fab (module-scope print), functionibus.fab
#   (calls module-level fn), and cli/cli.fab (main args).

main {
    print "ingressus"
}

Expected output:

ingressus

radix/corpus/reference/reject/incipit/top-level-statement-beside-entry-reject.fab (supporting · reject)#

An executable statement beside the entry block is refused.

# A top-level executable statement is ignored beside main; put it in main.
1
main {}

Expected: compilation rejects this example.