Write and run a program
beskid run analyzes the source, compiles it ahead of time, links an executable with the matching runtime kit, and runs that executable in a subprocess.
Prerequisites
Section titled “Prerequisites”Complete Install Beskid. Work in an empty directory where you can create a file.
Actions
Section titled “Actions”- Create
Main.bdwith this source:
i32 Main() { return 0;}-
Analyze the source:
Terminal window beskid analyze Main.bd --plain -
Check its canonical format:
Terminal window beskid format Main.bd --check -
If the format check reports drift, update the file before the next check:
Terminal window beskid format Main.bd --writebeskid format Main.bd --check -
Execute the program through the AOT pipeline:
Terminal window beskid run Main.bd --plain -
Check the process status with the command that your shell provides. A status of
0is success.
flowchart LR accTitle: Source to AOT execution accDescr: The CLI resolves and analyzes Main.bd, lowers it, compiles and links a native executable with the runtime kit, and then starts it as a subprocess. A[Main.bd] --> B[Resolve and analyze] B --> C[Lower] C --> D[AOT compile] D --> E[Link runtime kit] E --> F[Run subprocess]
Diagram text
Section titled “Diagram text”- The CLI resolves
Main.bdand checks its syntax, names, and types. - The compiler lowers the checked program and emits native object code.
- The linker uses the matching runtime kit to create an executable.
- The CLI starts the executable as a subprocess and returns its status.
Expected result
Section titled “Expected result”Analysis completes without an error diagnostic. The format check exits successfully. The program prints no text and exits with status 0.
Recovery
Section titled “Recovery”If analysis points to the function name, use the exact default entrypoint Main. If formatting fails, run the documented --write command. If linking reports a missing or incompatible runtime kit, reinstall the same toolchain release; do not combine compiler and runtime files from different releases.
Next task
Section titled “Next task”Connect the editor and language server, then use build, run, and test for development work.