Swag can be used to build and run a simple script file, thanks to the fact that the compiler can run anything at compile time. No executable will be generated, the compiler will do all the job. To create a new script file with the special extension swgs:
This will generate a simple file with a #dependency block and the program entry point #main.
You can then run your script with the script command.
You can also just specify the script file with the extension as a command.
As examples, you will find a bunch of small scripts in swag/bin/examples/scripts. To run one of them from the console, go to the folder and type for example swag flappy.swgs.
You can add external dependencies, and they will be compiled and used as native code.
A special hidden workspace (in the Swag cache folder) will be created to contain all the corresponding native code.
If your script is divided in more than one single file, you can add #load <filename> in the #dependencies block.
The compiler comes with a bytecode debugger that can be used to trace and debug compile time execution. Add @breakpoint() in your code when you want the debugger to trigger.
The debugger command set is inspired by Pdb, the python debugger.