The recommended way to use smoλ is through vscode, a popular and rather lightweight code editor.
But the steps below apply to any setup:
1. Install vscode (recommended)
Get vscode from its official site. You can also use your editor of choice, or visit the language's own web playground for tinkering with and running one file in your browser.
If you use an editor other than vscode, a Python syntax highlighter covers many language aspects.
However, a vscode extension is provided. This offers:
• syntax and error highlighting
• mouse hover tooltips about types and functions
• visiting definitions with ctrl+click
Either install the smoll extension
by searching for the extension within vscode, or visit its page in the vscode marketplace by following the next link.
Create a new folder. Place within it the executable matching your platform without changing its name. Then, open
vscode or your editor of choice in that folder.
In linux, also run chmod +x smoll to grant the download permission to run.
More instructions soon for other platforms, including cross-compilation using gcc.
4. Get a C compiler or interpret
Smoλ requires an assisting C compiler to produce a final executable,
It is recommended to install the
GCC compiler in your system, which the language tries to use by default. Otherwise
smoλ can act as an interpreter for its own intermediate C code
by adding --back vm. This is how the language runs in the web playground too.
In windows install GCC by installing msys2 first and then running:
Expand this to look at other supported compiler backends.
You can use the exemplary
antcc compiler (and add a star to it)
for WSL or linux. This is faster than GCC with roughly comparable optimization speeds for smoλ code.
A fork of that has been tailored to work well for us. Download
the precompiled executable (or compile it from scratch), and place it in your project directory.
Then add --back antcc to smoll runs.
You are now ready! Create a main.s file like the one below. To compile and run the outcome, open a
terminal in that folder (or use your editor’s integrated
one) and run ./smoll main.s, where main.s is the name of your main file.
The following will be printed in the console. Add –build to the command for only
producing the executable.