lukasmalkmus/spl
A toolchain for a simple programming language, inspired by the Go toolchain. - by Lukas Malkmus
Table of Contents
- Introduction
- Usage
- Contributing
- License
Introduction
spl is a compiler and toolchain for a simple programming language
I had to build a compiler in an university course on building compilers. The
design is heavily inspired by the packages of the Go language and features
a handwritten parser as well as the two excellent books from Thorsten Ball on
building an interpreter and a compiler.
The languages specification can be reviewed here (in german).
A machine translated one in english (yes, I'm a lazy fuck) can be reviewed
here.
Usage
Installation
The easiest way to run spl is by grabbing the latest standalone binary from
the release page.
This project uses native go mod support for vendoring and requires a working
go
toolchain installation when installing via go get
or from source.
Install using go get
GO111MODULE=on go install github.com/lukasmalkmus/spl/cmd/spl
Install from source
git clone https://github.com/lukasmalkmus/spl.git
cd spl
make
make install
Validate installation
The installation can be validated by running spl version
in the terminal.
Configuration
spl is a Twelve Factor Application and can be configured by either
configuration file, the environment or command line flags. It provides a basic
help flag --help
which prints out application and configuration help. See
using the application.
Configuration files are TOML formatted:
[format]
indent = 8
Sections which are in TOML indicated by [...]
are mapped to their respective
environment variables by seperating sections and values with an underscore _
.
However, they are prefixed by the application name:
export SPL_FORMAT_INDENT=8
The same is true for command line flags but they are separated by a dot .
and
not prefixed:
spl --format.indent=8
Configuration values without a default value must be set explicitly.
The application itself can echo out its configuration by calling the config
command:
spl config > spl.toml
Configuration priority from lowest to highest is like presented above:
Configuration file, environment, command line option (flag).
Click to expand default configuration file:
[format]
indent = 4
Using the application
spl [flags] [commands]
Help on flags and commands:
spl --help
Contributing
Feel free to submit PRs or to fill Issues. Every kind of help is appreciated.
More information about the project layout is documented
here.
License
© Lukas Malkmus, 2019
Distributed under MIT License (The MIT License
).
See LICENSE for more information.