Retro

A concatenative, stack-based programming language with roots in Forth.

Latest Release: 11.2 (January 2012)


Core Language

To run Retro, you need a virtual machine and an image file.

These are the preferred implementations.
C, F#, Go, Common Lisp, Python, Ruby, ANS Forth, assembly (Linux/x86).

These have less features, but are still useful.
C#, Java, Lua, Perl, Scheme, Javascript.

Documentation

We provide ReST, HTML, and PDF formatted documentation.

Legal

Retro is open-source, distributed under the ISC license.


Mobile Devices

Mobile devices are increasingly common in today's world. Retro can be used on many of them.

Android
iOS (under development)
Chrome Web Store

Other Resources

View or file a bug report
Browse the source repositories
Read the blog
Browse logs of the irc channel
Join or read the mailing list
Join in discussion on the #retro irc channel

Code Samples

( chess.rx ) {{ : $, ( $- ) withLength [ @+ , ] times drop ; create blank "rnbqkbnrpppppppp" $, "................" $, "................" $, "PPPPPPPPRNBQKBNR" $, 0 , create board 64 allot : --- ( - ) " +-----------------+\n" puts ; : ### ( - ) " 0 1 2 3 4 5 6 7 \n" puts ; : row ( a-a ) "%d | " puts 8 [ @+ putc space ] times "|\n" puts ; : r,c ( ""-nn ) ', accept tib toNumber getToken toNumber swap ; : get ( ""-a ) r,c 8 * board 2+ ; ---reveal--- : display ( - ) cr ### --- board 8 [ row ] iter drop --- ### cr ; : new ( - ) blank board 64 copy display ; : move ( ""- ) get dup @ [ '. swap ! ] dip get ! display ; }}
( grep.rx ) ( Usage: "filename" "substring" grep ) ( display all lines containing ) ( "substring" in "filename" ) {{ 2 elements token content : clean ( $- ) withLength [ dup @ 10 13 within [ 999 swap &! sip ] ifTrue 1+ ] times drop ; : getLine ( $-$$ ) 999 ^strings'splitAtChar ^strings'chop ; : process ( $- ) dup @token ^strings'search [ puts cr ] &drop if ; : loadSourceData ( $- ) here swap ^files'slurp here !content heap +! 32 , 0 , @content clean ; : eachLine ( $- ) [ getLine process dup 1 <> ] while drop ; ---reveal--- : grep ( $$- ) cr keepString !token heap [ loadSourceData @content eachLine ] preserve ; }}