Quickstart
TIP
Before you begin: See the Installation Guide for how to download and set up the Myst interpreter.
Running Myst
REPL Mode:
To start an interactive session:
shmyst -r
Note
If your terminal does not support Burmese fonts or Unicode properly, the REPL output may appear broken or unreadable. For that, it's recommended to run your code using a file with the redirect operator to capture the output (see the example command below).
Run a File:
To execute a
.myst
file:shmyst <filename.myst>
Example:
shmyst helloworld.myst
Note
Currently, the Myst language only provides some built-in functions and there is not much you can do except basic conditions and logic. It does not support any OS features (such as file I/O, networking, etc.). If you run your code and the output in your terminal appears broken or unreadable, it is recommended to redirect the output to a file and open it with your IDE or a text editor that supports Burmese fonts:
shmyst helloworld.myst > output.txt
You can then read
output.txt
in your IDE for proper display.
Language Basics
Variable Assignments
အမည် သည် "မောင်မောင်"။
အသက် သည် ၂၅။
အပိုင်းကိန်း = ၃.၁၄။
အသက်ကြီးသလား သည် အမှန်။
Arithmetic Operations
အဖြေ၁ သည် ၁၀ + ၅။
အဖြေ၂ သည် ၁၀ - ၃။
အဖြေ၃ သည် ၄ * ၆။
အဖြေ၄ သည် ၁၀ / ၃။
ထုတ်ပြ("၁၀ + ၅ = " + အဖြေ၁)။
ထုတ်ပြ("၁၀ - ၃ = " + အဖြေ၂)။
ထုတ်ပြ("၄ * ၆ = " + အဖြေ၃)။
ထုတ်ပြ("၁၀ / ၃ = " + အဖြေ၄)။
Functions
နှစ်ဆ သည် လုပ်ဆောင်ချက်(ဂဏန်း) {
ရလဒ် ဂဏန်း * ၂။
}။
အဖြေ၅ သည် နှစ်ဆ(၇)။
ထုတ်ပြ("၇ နှစ်ဆ = " + အဖြေ၅)။ // output=> "၇ နှစ်ဆ = ၄၉"
Conditionals
တကယ်လို့ (အသက် > ၁၈) ဖြစ်ခဲ့လျှင် {
ထုတ်ပြ("အရွယ်ရောက်ပါပြီ")
} မဟုတ်လျှင် {
ထုတ်ပြ("အရွယ်မရောက်သေးပါ")
}
Arrays
နာမည်များ သည် ["အေးအေး"၊ "ထွန်းထွန်း"၊ "ကျော်ကျော်"]။
ထုတ်ပြ("ပထမဆုံး: " + နာမည်များ[၀])။ // output => "ပထမဆုံး: အေးအေး"
Hash Maps
လူ သည် {
"အမည်": "ဘာညာ"၊
"အသက်": ၃၀၊
"အလုပ်အကိုင်": "ပရိုဂရမ်မာ"၊
}။
ထုတ်ပြ("အမည်: " + လူ["အမည်"])။ // output => "အမည်: ဘာညာ"
Built-in Functions
ထုတ်ပြ(...)
— Output/print value(s)အရေအတွက်(...)
— Count length of string or arrayထည့်သွင်း(array, value)
— Append value to arrayထိပ်ဆုံး(array)
— Get first element of arrayနောက်ဆုံး(array)
— Get last element of arrayနောက်အကျန်(array)
— Get all except first element
More Examples
Integer and Float Division
အဖြေ၁ သည် ၁၀ / ၂။
ထုတ်ပြ("၁၀ / ၂ = " + အဖြေ၁)။ // output => "၁၀ / ၂ = ၅"
အဖြေ၇ သည် ၃.၁၄ * ၂။
ထုတ်ပြ("၃.၁၄ * ၂ = " + အဖြေ၇)။ // output => "၃.၁၄ * ၂ = ၆.၂၈"
Float Operations and Conditionals
အပိုင်းကိန်း သည် ၃.၁၄။
အပိုင်းကိန်းနှစ်ဆ သည် အပိုင်းကိန်း * ၂။
ထုတ်ပြ("အပိုင်းကိန်းနှစ်ဆ သည် " + အပိုင်းကိန်းနှစ်ဆ)။ // output => "အပိုင်းကိန်းနှစ်ဆ သည် ၆.၂၈"
တကယ်လို့ (အပိုင်းကိန်း > ၃) ဖြစ်ခဲ့လျှင် {
ထုတ်ပြ("အပိုင်းကိန်း သည် ၃ ထက်ကြီးပါတယ်")
} မဟုတ်လျှင် {
ထုတ်ပြ("အပိုင်းကိန်း သည် ၃ ထက်ငယ်ပါတယ်")
} // output => "အပိုင်းကိန်း သည် ၃ ထက်ကြီးပါတယ်"