git clone https://github.com/spawnlang/spawn cd spawn make build # or make release for fastest build make build-fmt # optional, to install formatter
Add SPAWN_ROOT environment variable to your shell profile:
echo "export SPAWN_ROOT=$(pwd)" >> ~/.bashrc source ~/.bashrc
To use spawnc executable anywhere, run:
sudo ./spawnc --symlink
On Unix systems, it creates a /usr/local/bin/spawnc symlink to compiler
executable.
Build other tools:
make build-fmt
To build spawnprof see
spawnprof repository
Currently, the best support is provided in the IntelliJ IDEA family of IDEs with the Spawn plugin. It provides syntax highlighting, code completion, error highlighting, and more.
To install the plugin, go to Plugin Repository and follow instruction about manual installation.
VS Code extension provides only syntax highlighting at the moment.
To install an extension, go to
Extension Releases on GitHub.
Download .vsix file, open VS Code, press Ctrl+Shift+P, type Install from VSIX, and select downloaded file. After restarting VS Code, you should see
syntax highlighting for Spawn files.
You can try to install an experimental LSP server for Spawn. It is quite unstable and not recommended for use. To install it, run the following commands:
git clone https://github.com/spawnlang/spawn-analyzer cd spawn-analyzer spawnc . -o spawn-analyzer
Then in VS Code set the following settings:
{
"spawn.serverPath": "/path/to/spawn-analyzer",
"spawn.connectionMode": "tcp",
"spawn.tcpMode.port": 5010
}And reload VS Code.
Vim plugin provides only syntax highlighting at the moment.
To install a plugin, go to Plugin Repository and follow instruction about installation.
Spawn has a tree-sitter grammar that can be used in editors that support tree-sitter. To use it, go to tree-sitter-spawn repository to download the grammar. Then follow the instructions in your editor's documentation to install the grammar.
v install srackham.pcre2 // linux apt install libpcre2-dev // macos brew install pcre2
make build-tester ./bin/tester
See TESTS.md for more details.
spawnc file.sp # only compile spawnc --run file.sp # compile and run spawnc -g file.sp # compile with debug info spawnc --opt file.sp # compile with optimization and safety features spawnc --opt-fast file.sp # compile with optimization and no safety features spawnc --test file_test.sp # compile and run test spawnc --test ./ # compile and run test from directory spawnc --profile cpu.prof file.sp # profile cpu spawnc --mem-profile mem.prof file.sp # profile memory spawnprof cpu.prof # show cpu profile as list spawnprof cpu.prof --web # open cpu profile graph in browser spawnprof cpu.prof --graph g.svg # save cpu profile graph as svg ./cmd/sfmt -w file.sp # format file
This repository contains two Dockerfiles:
Dockerfile.vis used to create an image with optimized V compiler. This Dockerfile has nothing to do with Spawn, but it was placed here for organizational purposes. You don't need to use it at all (except for development). You can build V image with a commandsudo docker build -t spawnlang/spawn -f Dockerfile.v ..Dockerfileis used to create and image of optimized Spawn compiler + optimized tools (fmt,prof,pkg). This image also contains a GCC compiler. This image depends on the previously mentioned V image. You can build Spawn image with a commandsudo docker build -t spawnlang/spawn -f Dockerfile ..
You can also access these and other Docker images on Spawn's DockerHub.
Spawn is licensed under the MIT license. See LICENSE for the full license text.