စံကား

01The language

Natural wording

The rules of the naturalness check, which warns when a sentence is valid Zaka but reads unlike Burmese, with the wording it prefers for each.

Zaka accepts more spellings than a Burmese speaker would write. A verb at the end of a clause can hold သည်, ပါ, ပါသည် or no ending at all, and a printed operand can be marked with ကို or ဟု. The parser takes each of them. A separate pass, the naturalness check, runs right after the parser and points out the spellings that read unlike Burmese. Its findings are warnings with codes ZK0501 to ZK0508. A warning never stops a program and never changes what it does. The Learn book introduces the idea in Natural Zaka.

What the check looks at

The check reads the tree of the program, not the text, so spacing does not change its answers. It looks at four kinds of place:

PlaceWhat is examined
a clause-final worda verb such as ကြီး, ညီ, မငယ်, the words မှန် and မမှန်, or မဟုတ်; its ending; and what follows it
a printed operandwhether it is a sentence, a string or a plain value, and whether it is marked with ကို or ဟု
a clause that gives a valuethe ending of its last word, when the clause is stored, returned, passed or used as a loop bound
a group in parentheseswhether the parentheses change the meaning

"What follows" matters because the ending depends on the next word: သို့မဟုတ် ("or"), ဖြစ်၍ ("and"), an attached လျှင် or နေသရွေ့, or the end of the clause.

When two rules fit one place, the first in the table below alone is reported. So မဟုတ်သည် before သို့မဟုတ် is reported once, as ZK0501.

The rules

CodeWherePrefersWarns about
ZK0501a "not" verb before သို့မဟုတ်မငယ်ပါ သို့မဟုတ်မငယ်သည် သို့မဟုတ်
ZK0502a verb before an attached လျှင် or နေသရွေ့ကြီးလျှင်, ကြီးနေသရွေ့ကြီးသည်လျှင်
ZK0503မဟုတ် ("not")မဟုတ်ပါ or မဟုတ်မဟုတ်သည်
ZK0504a verb before ဖြစ်၍ ("and")ကြီးသည် ဖြစ်၍ကြီးပါ ဖြစ်၍
ZK0505printing a sentence or a string"..." ဟု ပြသပါ"..." ကို ပြသပါ
ZK0506printing a plain valueအသက် ကို ပြသပါအသက် ဟု ပြသပါ
ZK0507parentheses that change nothingအသက် + ၁ ကို ပြသပါ(အသက် + ၁) ကို ပြသပါ
ZK0508a sentence used as a value... ကြီးသည် ဖြစ်ပါစေ... ကြီးပါ ဖြစ်ပါစေ

The right-hand column is still valid Zaka. It just sounds less natural. The "not" verbs are မညီ, မကြီး, မငယ်, မမှန် and မဟုတ်.

ZK0501: "not" before "or"

Before သို့မဟုတ် a negative verb takes ပါ.

စံကားZK0501

Expected warning

warning[ZK0501]: "မငယ်သည်" before "သို့မဟုတ်" reads better as "မငယ်ပါ"

ZK0502: a particle before an attached "လျှင်" or "နေသရွေ့"

The attached forms join straight onto the verb: ကြီးလျှင်, ကြီးနေသရွေ့. A particle between them is unnatural. To keep the particle, use the ဖြစ် forms: ကြီးသည် ဖြစ်လျှင်, ကြီးသည် ဖြစ်နေသရွေ့.

စံကားZK0502

Expected warning

warning[ZK0502]: "ကြီးသည်" before "လျှင်" reads better without the particle
help: write "ကြီးလျှင်", or keep the particle and write "ဖြစ်လျှင်"

The same holds for a loop:

စံကားZK0502

Expected warning

warning[ZK0502]: "ကြီးသည်" before "နေသရွေ့" reads better without the particle

ZK0503: "မဟုတ်" with "သည်"

The postfix negation takes ပါ or nothing at all. မဟုတ်သည် and မဟုတ်ပါသည် are grammatical but not idiomatic.

စံကားZK0503

Expected warning

warning[ZK0503]: "မဟုတ်သည်" reads better as "မဟုတ်ပါ" or "မဟုတ်"

ZK0504: "ပါ" before "ဖြစ်၍"

Before the conjunction ဖြစ်၍ ("and") a verb takes သည်. The ပါ forms belong before သို့မဟုတ် and at the end of a quoted sentence.

စံကားZK0504

Expected warning

warning[ZK0504]: "ကြီးပါ" before "ဖြစ်၍" reads better as "ကြီးသည်"

ZK0505 and ZK0506: "ဟု" and "ကို" in a print

ကို marks a thing: a name, a number, the result of a sum. ဟု quotes a sentence or a string: a comparison that ends in သည် or ပါ, or a string literal. A bare clause with no ending is a thing and keeps ကို.

စံကားZK0505

Expected warning

warning[ZK0505]: a sentence or a string is quoted with "ဟု", not marked with "ကို"
warning[ZK0505]: a sentence or a string is quoted with "ဟု", not marked with "ကို"
စံကားZK0506

Expected warning

warning[ZK0506]: a plain value is marked with "ကို", not quoted with "ဟု"

ZK0507: parentheses that change nothing

A group in parentheses is redundant when it is the whole operand of its place: a printed value, an assigned value, a returned value, an initial value, a loop bound, a call argument or a condition. It is also redundant inside another group. Such an operand is read as far as it goes, so the parentheses add nothing.

Parentheses are needed, and left alone, around a logical expression (one with ဖြစ်၍, သို့မဟုတ် or မဟုတ်) in an operand place, and inside an operator chain or a clause with more operands.

စံကားZK0507

Expected warning

warning[ZK0507]: these parentheses are not needed

ZK0508: "ပါ" on a clause used as a value

A clause that gives a value, as an initial value, a returned value, a call argument or a loop bound, names a fact and does not state a sentence, so its last word takes သည်. The ပါ forms belong to quoted sentences (... ဟု ပြသပါ, ... ဟု ထားပါ) and to the place before သို့မဟုတ်.

စံကားZK0508

Expected warning

warning[ZK0508]: "ကြီးပါ" as a value reads better as "ကြီးသည်"

All of the rules, followed

The same sentences in the wording the check prefers print the same and warn about nothing:

စံကား

Expected output

မှန်
မှန်
မှန်
အရွယ်ရောက်
၂၁
မှန်

Strict mode

--strict-particles turns each of these warnings into an error, so a program that has one does not run. This is useful once the rules feel familiar and each new program should read as Burmese.

zakac run --strict-particles program.zaka

The flag changes how the findings are reported and nothing more. For how the compiler collects and shows diagnostics, see Diagnostics.