![]() (Hmmm. I really should have just squash-merged all of these commits so I'd look infallible.) |
||
---|---|---|
doc | ||
examples | ||
extras | ||
src | ||
test | ||
thirdparty | ||
LICENSE.txt | ||
Makefile | ||
README.md | ||
config.mk |
README.md
Loom in C++
This is the initial implementation of the Loom Programming Language.
Is it fast? No. But is it it clean, elegant and readable? Also no.
Wait, Loom?
Loom is an attempt at a Smalltalk-style object-oriented programming language that is simple, homoiconic, and easy to implement. Smalltalk is to Loom what Common Lisp is to the quick-and-dirty incomplete Scheme system you hacked together on afternoon because you were bored.
- Here's a blog post describing the project.
- Here's the language reference (rendered html).
- Here's the library reference (rendered html).
There are also a couple of example programs in examples
.
What's it good for?
Right now, it's just a toy for trying out the underlying ideas. If you want to try to expand it to something more useful, be my guest. Ditto if you want to steal my ideas.
Compiling
You'll need a modern C++ compiler (I use Clang; gcc will probably also
work), make
, ruby
(for some basic scripting) and pandoc
if you
want to regenerate the documentation.
You'll also need to have the Boehm-Demers-Weiser conservative garbage collection installed. On Ubuntu, this is doable with
sudo apt-get install libgc-dev
(If you can't get it but still want to try Loom, you can also build
without it by adding NO_GC=yes
to the make
command line. Hey, RAM
is pretty cheap these days.)
If you're lucky, all you need to do is type
make RELEASE=yes test
to get an optimized build, or
make test
for a debug build.
There's no make install
; instead, do one of the following:
src/loom
is a bash script that will invoke loom under (the
extremely helpful) rlwrap
if that's installed, so if your system
supports bash, you can do this:
cp src/loom src/loom.exe /my/install/path/lib
ln -s /my/install/path/lib/loom /my/install/path/bin
Alternately, you can just copy loom.exe
to somewhere in your path:
cp src/loom.exe /my/install/path/bin/loom
(Yes, the binary ends with ".exe"; this is so that rm *.exe
will
work. If you're stuck with Windows, you'll need to leave the suffix
on.)
Running Loom
Invoking loom
with no arguments drops into the REPL:
$ loom
> self::*fib = {|n| n<=2.if{return 1};return self.fib(n - 1)+(self.fib(n - 2))}
> 1 -> 15 .map {|n| self.fib(n) }
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]
Invoking it with a loom program will run that program:
$ loom -- examples/sieve.loom 100
Solving up to 100...
Primes up to 100:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
It also accepts a number of arguments. Run it --help
for details.
If you wish to pass an argument to your program, use the --
argument
to indicate the end of loom.exe
's argument list
Other stuff
There is a rudimentary Emacs major mode for Loom in extras
.
Copyright and License
Loom is Copyright © 2023 by Chris Reuter and is released under the MIT license, with the following exceptions:
-
The code in the third_party subdirectory is written by others and distributed under the terms of their licenses. See the copyright statements and LICENSE.txt files for more details.
-
The file
extras/loom-mode.el
includes others' work and is released under the terms of the GNU GPL.