Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.
/ spl Public archive

A toolchain for a simple programming language, inspired by the Go toolchain.

License

Notifications You must be signed in to change notification settings

lukasmalkmus/spl

Repository files navigation

lukasmalkmus/spl

A toolchain for a simple programming language, inspired by the Go toolchain. - by Lukas Malkmus

Build Status Coverage Status Go Report GoDoc Latest Release License License Status


Table of Contents

  1. Introduction
  2. Usage
  3. Contributing
  4. 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 # Build production binary
make install # Build and install binary into $GOPATH

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:
# SPL COMPILER TOOLCHAIN CONFIGURATION

# Source code formatter configuration.
[format]
# Indentation width used.
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.

License Status Large

About

A toolchain for a simple programming language, inspired by the Go toolchain.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published