~jojo/Carth

ref: 6b4681f4da9a8735bb35d6c24e9f5404e9952e39 Carth/README.org -rw-r--r-- 3.6 KiB
6b4681f4JoJo Codegen: Don't put every var on stack. Keep small things in regs 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#+TITLE: The Carth programming language

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

Visit [[https://carth.jo.zone/][https://carth.pink/]] 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 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][TODO.org]] for more extensive
  list of planned features and more detailed descriptions.

  - Typeclasses
  - Higher kinded types
  - Effect system
  - Linear types

* Building Carth
  The compiler is written in [[https://haskell.org][Haskell]] and uses the [[https://www.haskellstack.org/][Stack]] build system,
  while the core-library is written in [[https://rust-lang.org][Rust]]. The external dependencies
  required are [[https://llvm.org/][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 the binary in =~/.local/bin=, the core
  library in =~/.local/lib=, and the modules of the Carth standard
  library in =~/.carth/mod=.

* Building with Carth
  At compiler runtime, the dependencies are ~libsigsegv~, ~libdl~,
  ~libpthread~, ~libm~, and ~libgc~, which are linked into the
  executables produced by Carth.

  Carth must further be able to find the core library and standard
  library modules, so you must have added the directory of the
  installed core library (default =~/.local/lib=) to your
  ~LIBRARY_PATH~ environment variable, the directory of the installed
  standard library (default =~/.carth/mod=) to your
  ~CARTH_MODULE_PATH~ environment variable.

* Running
  #+BEGIN_EXAMPLE bash
  # 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

  # Run with the JIT compiler
  carth run examples/fizzbuzz.carth

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

* License
  Carth is released under the AGPL license, version 3 or later. See
  [[./LICENSE][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/>.