စံကား

Reference

Error messages

How to read a compiler message, and what the common codes mean.

When something is wrong, zakac prints a message instead of running the program. Here is one such message:

$ zakac run program.zaka
error[ZK0401]: expected isize, found f64
 --> program.zaka:2:10
  |
2 | အသက် ကို ၂.၅ ဟု ထားပါ။
  |       ^^^
  = help: convert the value with "ကို <kind> အဖြစ် ပြောင်းလဲသော ရလဒ်"
PartMeans
errorthe program will not run. A warning does not stop it.
[ZK0401]the code; look it up in the tables below
expected isize, found f64what went wrong
program.zaka:2:10file, line 2, character 10
^^^points at the problem in the line
help:a suggestion for fixing it (some messages have none)

Fix the first error first. A single mistake can confuse the compiler into reporting more errors after it.

When a program stops while running (for example, on a division whose zero appears at run time), the message starts with the program stopped: and has no code.

Short names for kinds

Messages use short names for kinds:

Short nameZaka kind
isizeကိန်းပြည့်
i8, i16, i32, i64, i128၈ ဘစ် ကိန်းပြည့် ... ၁၂၈ ဘစ် ကိန်းပြည့်
usizeလက္ခဏာမဲ့ ကိန်းပြည့်
u8, u16, u32, u64, u128လက္ခဏာမဲ့ ၈ ဘစ် ကိန်းပြည့် ...
f16, f32, f64, f128၁၆ ဘစ် ဒဿမကိန်း ... ; f64 is plain ဒဿမကိန်း
charစာလုံး
boolမှန်မှားတန်ဖိုး
*isize, *u8, **isize, ...ကိန်းပြည့် လိပ်စာ, ... ; one more * for each ၏ လိပ်စာ after it
ptrလိပ်စာ (the opaque pointer)
[3]isize, [2][3]isizeအကွက် ၃ ခုရှိသော ကိန်းပြည့် စာရင်း, ... ; one [n] for each စာရင်း, outermost first; [] while the count is not known
*[3]isizeအကွက် ၃ ခုရှိသော ကိန်းပြည့် စာရင်း လိပ်စာ, the address of a whole list
nullthe kind of ဗလာ

Codes

The first two digits tell which stage found the problem. Diagnostics explains how a message is set out and when a message stops the compiler.

ZK01: reading the characters

CodeProblemSee
ZK0101a character Zaka does not use, such as ; or ?
ZK0102a malformed number, such as ၂.၅e3 or ၁၈ဘစ်Writing integers
ZK0103Burmese and Western digits in one numberWriting integers
ZK0104text with no closing "Text in quotes
ZK0105a character literal with no closing ' on its lineCharacters
ZK0106unknown {...} or \ escapeCharacters
ZK0107a character literal with more than one characterCharacters
ZK0108a name in backticks with no closing backtick on its lineNames
ZK0109a name in backticks with nothing between themNames

ZK02: reading the sentences

CodeProblemSee
ZK0201something unexpected, often a missing ။Hello, world
ZK0202a value is missing where one was expected
ZK0203the statement does not end in a verb such as ပြသပါGrouping and order
ZK0204a logical expression printed without parenthesesLogic
ZK0205a verb is missing one of its partsParticles
ZK0206wrong or missing particle, often a name joined to ကိုSpaces between words
ZK0207two particles in a row after one operandParticles
ZK0208operands left waiting for a verb at the end of a clauseParticles
ZK0209operands left over before a statement verbParticles
ZK0210a comparison inside a comparisonComparison
ZK0211သို့မဟုတ်ပါက without an အကယ်၍ before itIf and else
ZK0212the ပြီးလျှင် update outside a generic loopGeneric loops
ZK0213the ပြီးလျှင် update is not lastGeneric loops
ZK0214a function declared inside a block or functionFunctions
ZK0215an if as the one-statement inner block of an ifIf and else
ZK0216a bit count that the kind does not have, such as ၁၀ ဘစ် ကိန်းပြည့်Integers
ZK0217a sign word before a kind that is not an integerIntegers
ZK0218a number base that is not a whole number from 2 to 36Writing integers
ZK0219a digit too big for the number baseWriting integers
ZK0220a number too big for its kindIntegers
ZK0221a fraction or exponent in a literal that is given an integer kindWriting integers
ZK0222a character or true/false kind written before a numberWriting integers
ZK0223text in quotes used somewhere other than printingText in quotes
ZK0225a generic loop that starts with ကိန်းသေGeneric loops
ZK0226a block closer with no block to closeBlocks and scope
ZK0227a list count that is not a whole number above zeroLists

ZK03: names

CodeProblemSee
ZK0301a name that was never declared, or is out of scopeBlocks and scope
ZK0302the same name declared twice in one blockNames
ZK0303calling a function that does not existFunctions
ZK0304two functions with one nameFunctions
ZK0305two parameters of one function with one nameParameters
ZK0306changing a constantConstants
ZK0307changing a counted loop's counterCounted loops
ZK0308a constant without a valueConstants
ZK0309a break outside a loopBreak and continue
ZK0310a continue outside a loopBreak and continue
ZK0311ပြန်ပေးပါ outside a functionFunctions
ZK0312returning a value from a function without a resultResults
ZK0313returning without a value from a function with a resultResults
ZK0314the wrong number of argumentsParameters
ZK0315using a function without a result as a valueResults

ZK04: kinds

CodeProblemSee
ZK0401a value of the wrong kind for a variable or parameterConverting between kinds
ZK0402a condition that is not true/falseIf and else
ZK0403an operator used on the wrong kind, such as မှန် + ၁Arithmetic
ZK0404two kinds that cannot be combined without a conversionArithmetic
ZK0405a counted-loop bound or step that is not an integerCounted loops
ZK0406a number too big for the variable's kindIntegers
ZK0407a shift wider than the kind's bit countBitwise operators
ZK0408a conversion that is not allowedConverting between kinds
ZK0409a counted-loop step that is zero or lessCounted loops
ZK0410an invalid assignment target: not a variable or a dereferenceChanging a variable
ZK0411no address: taking the address of something that is not a variable or a dereferencePointers and the heap
ZK0412taking the address of a fixed name: a constant or a counted-loop variablePointers and the heap
ZK0413not a pointer: dereferencing a value that has no pointer kindPointer mistakes
ZK0414an opaque pointer (လိပ်စာ) dereferenced or offset before a conversionPointer arithmetic
ZK0415an operator not for pointers, such as * or / on an addressPointer arithmetic
ZK0416pointer kinds differ: comparing or subtracting pointers to different kindsPointer arithmetic
ZK0417a heap statement that needs a pointer but was given another kindThe heap
ZK0419a list literal with more or fewer cells than its kindList mistakes
ZK0420စာရင်းအလွတ် where no list kind is knownList mistakes
ZK0421a list kind with no count where nothing gives oneList mistakes
ZK0422cells of a value that is no listList mistakes
ZK0423a cell number that is not an integerLists
ZK0424a list as a function resultPassing and comparing lists
ZK0425a list kind too large for the VMLists of lists

ZK05: natural Zaka (warnings)

These are warnings: the program runs. With --strict-particles each one is an error. See Natural Zaka and Natural wording.

CodeProblemSee
ZK0501a "not" verb before သို့မဟုတ် ends in သည် instead of ပါNatural Zaka
ZK0502a particle between a verb and an attached လျှင် or နေသရွေ့Natural Zaka
ZK0503မဟုတ် with သည်Natural Zaka
ZK0504ပါ on a verb before ဖြစ်၍Natural Zaka
ZK0505a sentence or text printed with ကို instead of ဟုNatural Zaka
ZK0506a plain value printed with ဟု instead of ကိုNatural Zaka
ZK0507parentheses that change nothingNatural Zaka
ZK0508a sentence used as a value that ends in ပါNatural Zaka

ZK06: working out constants

CodeProblemSee
ZK0601a sum of constants that does not fit its kindArithmetic
ZK0602a constant zero as the divisorArithmetic
ZK0603a constant cell number outside its listList mistakes

ZK07: ownership and borrowing

The check of ownership and borrowing. With --mem-check warn, ZK0701 to ZK0704 and ZK0706 to ZK0712 are warnings and the program runs; with --mem-check off, the compiler leaves them out. The others are errors in each mode. See Pointer checks.

CodeProblemSee
ZK0701using an owner after its block moved to another ownerOwnership and borrowing
ZK0702giving back or resizing a block through a borrowPointer mistakes
ZK0703a borrow kept in a heap block, behind a pointer, or in a top-level variable from a functionOwnership and borrowing
ZK0704giving back, resizing or moving a block while a borrow of it is still in usePointer mistakes
ZK0705the address of a borrowOwnership and borrowing
ZK0706a function that returns a borrow of its own variableChanging the caller's variables
ZK0707a call that can give back a block through one argument while another argument reaches itPointer mistakes
ZK0708a block lost before it is given backPointer mistakes
ZK0709reading or writing through a pointer that is ဗလာPointer mistakes
ZK0710a box or cell number past the end of its blockPointer mistakes
ZK0711a warning, with --mem-strict alone: a pointer that can be ဗလာOwnership and borrowing
ZK0712subtracting pointers into different blocksPointer mistakes
ZK0713ငှားထားသော in the wrong place in a pointer kindOwnership and borrowing
ZK0714a borrow given where an owner is wantedOwnership and borrowing
ZK0715an owner given where a borrow is wantedOwnership and borrowing
ZK0716a raw address lent with တန်ဖိုးအငှားOwnership and borrowing
ZK0717a raw address kind under --no-rawOwnership and borrowing