Your first program
After installing L and its build prerequisites, save the following program as main.l in a new directory. You do not need the compiler's source checkout.
Read the program
Section titled “Read the program”Use IO's Print from `io` as "Print".
"message" is `Hello World!`.Create "Hello" as a New Basic App.The App Prints message.Execute Hello.Show Hello's Output.Complete program. Source: demo/basic/main.l.
Example evidence
Canonical Hello World App with explicit IO.Print import and finalized output. existing-witness-not-run. Evidence guide.
Use IO's Print from `io` as "Print" imports a printing action. Backticks delimit Text; double quotes introduce names. Here, message names Text and Hello names an App.
New Basic App creates the App. The App refers to Hello, and Prints is a form of Print that puts the action in its body. See word forms.
Execute Hello starts the App and waits for it. The possessive 's selects its captured Output; Show writes those bytes without adding a newline.
Build and run
Section titled “Build and run”Run from the directory containing main.l:
l build main.l./mainThe first command builds the program and prints the executable path. The second runs it. Building alone does not execute your program.
Expected output:
Hello World!Print supplies one trailing newline. The program exits successfully with no stderr.
Keep the output together
Section titled “Keep the output together”Building main.l creates main and a companion directory main.apps beside it. Keep both together when moving the program. See the CLI reference for build options and published files for the layout.
Recognize common first-program failures
Section titled “Recognize common first-program failures”Keep the Print import. Use Execute to run and wait before reading Output. Remember that Print adds a newline, so message and Hello's Output differ by that final byte. See troubleshooting for build failures.
Next, learn how values and output are represented.
Canonical source: docs/guide/first-program.md.