Skip to content
The Carth programming language. https://carth.jo.zone/
Haskell Rust Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
examples
foreign-core
src
std
test
.gitignore
.gitlab-ci.yml
CHANGELOG.org
Dockerfile
LICENSE
Makefile
README.org
Setup.hs
TODO.org
build-upload-docker.sh
package.yaml
stack.yaml
stack.yaml.lock

README.org

The Carth programming language

Purely functional programming with lisp-syntax. Less infix, more parens!

Visit https://carth.jo.zone/ for an overview of the language and more info.

WORK IN PROGRESS

Just as a little disclaimer: this project is in the very early stages of development, so there are no guarantees of stability etc.

Features

  • Scheme-inspired syntax and feel
  • Static, Hindley-Milner typechecking à la ML
  • Currying
  • Closures
  • Algebraic datatypes
  • LLVM-based backend

Roadmap

This is a high-level overview of what is planned for the language, and some of the points are just tentative. See TODO.org for more extensive list of planned features and more detailed descriptions.

  • Typeclasses
  • Higher kinded types
  • Effect system
  • Linear types

Building

The compiler is written in Haskell and uses the Stack build system, while the core-library is written in Rust. The external dependencies required are LLVM version 9.

To build the project and install the carth binary, the core library, and the standard library, simply run make install, which defaults to installing everything in ~/.carth/. Then add the directory of the installed core library (default ~/.carth/lib) to your LIBRARY_PATH environment variable, so that the compiler can find it for the linking step, and add the directory of the installed standard library (default ~/.carth/mod) your CARTH_MODULE_PATH environment variable, so that the parser can find all Carth modules.

Running

# General help
carth help
carth -h
carth --help

# Help for a specific subcommand
carth help c

# Compile and run a program with default output filename
carth c examples/fizzbuzz.carth
./out

# Compile a program with a specific output filename
carth c -o examples/fizzbuzz examples/fizzbuzz.carth
./examples/fizzbuzz

License

Carth is licensed under the AGPL, version 3 or later. See LICENSE.

Note that by default, all programs written in Carth will have to be distributed under the AGPLv3 license as well, as not just the compiler itself, but also the standard library you include and the core library you link with are AGPLv3 licensed. Technically you could write your own standard library and core library with some non-copyleft license to avoid this, but I hope you won’t! ;)

Notice

Copyright (C) 2020 Johan Johansson

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

You can’t perform that action at this time.