Download the latest release from github, and unzip it in a folder. Of course a SSD is better.
You must install the latest version of the Windows 10 SFK in order to be able to build an executable for Windows. Otherwhise the compiler will complain, and exit. You can try here
You should register the location of the swag compiler (swag.exe) in the PATH environment variable to be able to call it from everywhere.
You can open a Powershell window, and run the following code :
The Windows Defender realtime protection is activated by default, and runs each time you launch an executable. This can increase the compile time of your project, so consider excluding your Swag folder from it !
Under Windows 11, there's also something called the Smart App Control, which can also have a great impact on execution time if it is activated (or in evaluation mode).
The compile unit of swag is a workspace which contains a variable number of modules. A module will compile to a dynamic library or an executable.
To create a fresh new workspace named first :
This will also create a simple executable module first to print "Hello world !".
F:/first/modules/first/src/main.swg
A workspace contains a predefined number of sub folders:
A module is also organized in a predefined way:
A module always contains a special file named module.swg. This file is used to configure the module, and is mandatory.
You can omit the workspace name (-w:first or --workspace:first) if you call the compiler directly from the workspace folder. This command will compile all modules in modules/.
You can also build and run your workspace.
The Swag folder contains the compiler swag.exe, but also a bunch of sub folders.
You should take a look at the reference/ sub folder in the Swag directory, or to the corresponding generated documentation. It contains the list of all that can be done with the language, in the form of small tests (in fact it's not really exhaustive, but should be...).
It's a good starting point to familiarize yourself with the language.
And as this is a normal Swag workspace, you could also build and test it with swag test -w:swag/reference.
You will also find some small examples (mostly written for tests) in swag/bin/examples/modules. To build and run one of them from the console, go to the workspace folder (/examples) and type for example swag run -m:wnd.