Rev

From Esolang
Jump to: navigation, search

Rev is a small, stack based language based on Mouse.

Sample code

The Sieve of Eratosthenes in Rev can be written as follows:

~ Sieve of Eratosthenes
520 a:  ~ How many primes to find
a._x:   ~ Allocate a bunch of memory
2 n:    ~ Number to start at

0 y: ~ Initialize
(   0 x.y.+:  ~ set to 0
    y.1+y:    ~ Increment
    y. a. = ^ ~ Exit if initialized
)

( 
    x.n.+. 0 = 
    [
        n.! " " 
        n.y:  ~ Set y to n
        (
            y. n. + y: ~ y = y + n
            y. a. > ^  ~ If y > a, exit
            1 x.y.+:   ~ Set value to 1
        )
    ]
    n.1+n: ~ Increment n
    n. a. > ^ ~ Exit if n > a
)

"!"

External resources

  • This page has a full description of the language, currently under development.