The initial implementation of the Loom Programming Language
 
 
 
 
 
Go to file
Chris c076243100 Updated the README.md to link to the blog post.
(Hmmm.  I really should have just squash-merged all of these commits
so I'd look infallible.)
2023-11-19 16:49:04 -05:00
doc Various small tweaks: 2023-11-19 14:43:39 -05:00
examples Initial release. 2023-11-11 15:27:08 -05:00
extras Initial release. 2023-11-11 15:27:08 -05:00
src Various small tweaks: 2023-11-19 14:43:39 -05:00
test Various small tweaks: 2023-11-19 14:43:39 -05:00
thirdparty Initial release. 2023-11-11 15:27:08 -05:00
LICENSE.txt Initial release. 2023-11-11 15:27:08 -05:00
Makefile Initial release. 2023-11-11 15:27:08 -05:00
README.md Updated the README.md to link to the blog post. 2023-11-19 16:49:04 -05:00
config.mk Initial release. 2023-11-11 15:27:08 -05:00

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.

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.

Loom is Copyright © 2023 by Chris Reuter and is released under the MIT license, with the following exceptions:

  1. 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.

  2. The file extras/loom-mode.el includes others' work and is released under the terms of the GNU GPL.