The Artima Developer Community
Sponsored Link

Heron-Centric: Ruminations of a Language Designer
Download the Cat
by Christopher Diggins
May 27, 2006
Summary
There is now a downloadable interpreter with source for the Cat programming language written in C#.

Advertisement

Cat is a stack based functional language inspired by the Joy programming language Like Joy, Cat is a cross between Forth and the FP language.

A prototype Cat interpreter, has been released into the public domain, and is available for download with C# source code at http://www.cdiggins.com/cat.zip.

Characteristics of Cat

Cat has no variables, no arguments, no constants, and no side-effects. Every Cat program takes a single stack as input, and returns a single stack as output. A Cat program is made up of a sequence of sub-programs. A sub-program may be user-defined or atomic programs.

A Nip of Cat

In Cat every operation, program, and literal, is a stack transform function. It takes a stack and returns a new stack. The following are examples of Cat programs:

    42; // pushes 42 onto the stack
    1 2; // pushes the value 1 and then the value 2 onto the stack
    1 2 swap; // pushes 2 and then 1 onto the stack.
    1 2 +; // pushes 3 onto the stack
    1 + 2; // increments the top value of the stack, then pushes 2 onto the stack
    pop; // removes the top item of the stack
    dup; // duplicates the top item on the stack
    [1 2 3]; // pushes a list of functions onto the stack
    [1 2 3] $; // pushes a list of values onto the stack
    [] 1 cons; // pushes a list containing the "1" function
  

There is a more detailed introduction to Cat available here.

Talk Back!

Have an opinion? Readers have already posted 14 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Christopher Diggins adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Christopher Diggins is a software developer and freelance writer. Christopher loves programming, but is eternally frustrated by the shortcomings of modern programming languages. As would any reasonable person in his shoes, he decided to quit his day job to write his own ( www.heron-language.com ). Christopher is the co-author of the C++ Cookbook from O'Reilly. Christopher can be reached through his home page at www.cdiggins.com.

This weblog entry is Copyright © 2006 Christopher Diggins. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use