项目作者: darius

项目描述 :
A programming argot
高级语言: Scheme
项目地址: git://github.com/darius/cant.git
创建时间: 2015-08-02T14:00:14Z
项目社区:https://github.com/darius/cant

开源协议:GNU Affero General Public License v3.0

下载


Cant, a message-oriented language

This is a hobby project: a programming language descended mainly from
E and Scheme. Nowadays there are at least two
more-direct E descendants, in a much more useful state: Secure
EcmaScript
and
Monte.

Why make this, then? I’ve long wanted a computing
system

that’s completely explained, simple enough to grasp in full detail
without getting bored or overwhelmed, and powerful enough that I’d
actually use it. Wirth’s Oberon is one inspiring example of such a
system. I’m aiming at another according to my own taste and
idiosyncrasies. Call it a learning project, or outsider art.

So the message is “buzz off”?

Just don’t expect any stability, at least anytime soon.

How to run it?

Install Chez Scheme. Then run
./incant (in Unix; if don’t have a Unix shell, then adapt your
invocation from that script).

If you use Emacs and want a language mode, then also install
plug-ins/cant-mode.el;
see the comments there.

What’s done so far?

A new Lisp dialect with a molasses-slow interpreter and an
almost-useless debugger. On the bright side, it’s pretty close now to
enforcing capability
security
,
and I’m sometimes pleased with the syntax and the library. I think
it’s more concise than Scheme without becoming more cryptic, once you
get familiar.

Example code?

  1. $ ./incant
  2. -> (out .say "Hey, world.\n")
  3. Hey, world.
  4. -> (to (fib n) (if (< n 2) 1 (+ (fib (- n 1)) (fib (- n 2)))))
  5. #<fib>
  6. -> (fib 10)
  7. 89
  8. ->

Any interesting example code?

You can try browsing
examples/ and
library/. See
examples/games and
examples/automata
for maybe-fun starting points.

To run a source file from the shell:

  1. $ ./incant examples/automata/game-of-life.cant

Or from the listener:

  1. $ ./incant
  2. -> (load "examples/automata/game-of-life.cant")
  3. #<map {~ update #<update>} {~ show #<show>} {~ grid<-picture #<grid<-picture>} {~ r-pentomino #<set((1 -2) (1 -1) (1 0) (2 0) (0 -1))>}>
  4. -> (run r-pentomino 1)
  5. O
  6. O O
  7. O O
  8. #<set((1 -2) (1 0) (0 -1) (0 0) (0 -2) (2 0))>
  9. ->

Documentation?

There’s a start at
guide.md.

Thanks

Of course, this project would not exist without Scheme or E. It’s
pretty likely to get more like E, because so far I’ve been consulting
my decades-old memory instead of the sources, and E probably did
things better.

Thanks to Kragen Sitaker for early discussions about the language.