Instructions
Follow these steps in order. Each one takes a few minutes.
Step 1: Install Python
- Open python.org/downloads and download the Windows installer.
- Run it. Choose Customize installation.
- Tick tcl/tk and IDLE (needed for windows and games).
- On the next screen, choose Install for me only.
- Finish the installation, then close any open Command Prompt windows.
Step 2: Download and extract SaiLang
- Download SaiLang {{VERSION}} and optionally check it with the checksum tool.
- Right-click the ZIP and choose Extract All. Put the folder somewhere permanent, such as
Documents\SaiLang.
Step 3: Open SaiLang IDLE
Open the extracted folder and double-click SaiLang-IDLE.pyw. The SaiLang editor opens.
- File > Open loads a
.saiprogram. Tryexamples\hello.sai. - Press F5 to run the program. Output appears in the lower pane.
- Press F6 to check a program for mistakes without running it.
- Press Esc to stop a running program.
- If a program asks a question, type the answer in Program input and press Enter.
To make .sai files open in IDLE: right-click a .sai file, choose Open with > Choose another app, select Python (or pythonw.exe in your Python folder), tick Always use this app, and click OK.
Step 4: Write your first program
- In IDLE choose File > New.
- Type:
make name = ask("What is your name? ") say "Hello,", name - Choose File > Save As and save it as
hello.sai. - Press F5, type your name in the Program input box, and press Enter.
Alternative: the Command Prompt
Open Command Prompt in the SaiLang folder and run:
set PYTHONPATH=src
python -m sailang examples\hello.sai
python -m sailang (starts the prompt)
python -m sailang check hello.sai (checks without running)
The set line lasts for one Command Prompt window, so run it again in each new window.
Windows and games
The examples desktop_app.sai, image_viewer.sai and coin_collector_game.sai open windows. Run them with F5 in IDLE. Closing the window ends the program.
Troubleshooting
- "Python was not found" or Windows opens the Microsoft Store
- Install Python from python.org as in Step 1. Then turn off the python "App execution alias" in Settings > Apps > Advanced app settings > App execution aliases.
- Windows or games do not open, and an error mentions Tkinter
- Run the Python installer again, choose Modify, and tick tcl/tk and IDLE.
- Double-clicking a
.saifile does nothing - Follow the "Open with" steps in Step 3 once. Windows does not know which program to use for
.saifiles until you choose. - Smart App Control blocks a file
- Use SaiLang-IDLE.pyw or the Command Prompt method. Both run through Python, which Windows allows. Do not try to unblock
.batfiles. - A file was saved as
hello.sai.txt - In Save As, set "Save as type" to All Files, or rename the file and remove the
.txt. - An error names a line number
- The message shows the file and line. In IDLE that line is highlighted in red. Read the message: it says what SaiLang expected.
- Text shows strange characters
- Save the file as UTF-8 (the IDLE save button does this for you).