Jump to navigation Jump to search
Rev is a small, stack based language based on Mouse.
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 ) "!"
- This page has a full description of the language, currently under development.