These pages are the manual of Zaka (စံကား). Where Learn teaches the language one small example at a time, the manual states the rules in full: what each sentence means, what the compiler checks, what the VM does while a program runs, and the reasons behind each choice.
How the manual is laid out
| Chapter | For | What it holds |
|---|---|---|
| The language | programmers | the exact rules of words, kinds, sentences, functions, pointers, ownership and lists |
| The compiler | programmers | the zakac commands, the stages a program passes through, and its messages |
| The VM | programmers | how the Zaka VM runs a program, holds its data, and stops on a mistake |
| Concepts | the curious | the ideas behind the design, explained with scenarios |
| Inside the compiler | contributors | how the code of the compiler is built, crate after crate |
The reference pages at the end list the reserved words, the operator precedence and each error code.
From a sentence to a running program
Each chapter looks at one part of this road:
program.zaka The language: what the sentences mean
│
▼
┌─────────┐ words ┌────────┐ tree ┌──────────────────────────┐
│ lexer │ ────────▶ │ parser │ ───────▶ │ natural wording, │
└─────────┘ └────────┘ │ names and kinds │
└────────────┬─────────────┘
The compiler: what it checks │ tree
▼
┌────────────────┐ IR ┌──────────────────┐ ┌──────────────┐
│ borrow checker │ ◀───── │ fold constants │◀─│ lower to IR │
└───────┬────────┘ └──────────────────┘ └──────────────┘
│ IR
▼
┌────────────────┐ instructions ┌──────────────┐
│ code generator │ ───────────────▶ │ Zaka VM │
└────────────────┘ └──────────────┘
The VM: how it runs
A mistake the compiler finds stops the program before it runs, with a
message and a code such as ZK0701. A mistake that slips past the checks stops the
program while it runs, with a message that starts the program stopped:.
Reading the examples
The examples in the manual run, just as the ones in Learn do: press Run to see the output, or change the program and run it again. Each example is checked against the compiler, so the output shown is the output the program prints now.
Expected output
မင်္ဂလာပါ
An example meant to fail states it, and names the code of the message it gives. A
program that prints Western digits in its source still prints Burmese digits (၁၂၃).
Start with the language, or open the table of contents.
Chapters
- 01The language
- Source text and words
- Kinds and values
- Conversions
- Expressions
- Statements
- Names and scope
- Functions
- Pointers
- Ownership and borrowing
- Lists
- Natural wording
- 02The compiler
- Commands
- Stages
- Diagnostics
- Pointer checks
- 03The VM
- Running a program
- Checked and packed blocks
- When a program stops
- Instructions
- 04Concepts
- The case for sentences
- Finding words in Burmese
- Ownership, explained
- Checks in the VM and in native code
- 05Inside the compiler
- The lexer
- The parser
- Names and kinds
- The borrow checker
- IR and code