Silly Joy Save

Interpreter for Joy in Haskell using extensible-effects

Project README

silly-joy

Build Status

silly-joy is an interpreter for the concatenative programming language Joy, implemented in Haskell using extensible-effects.

What's Joy?

Here are some resources:

Try it out!

Simplest way to try it out is by using Docker:

docker run -it rootmos/silly-joy --tui

You'll be greeted by a terminal UI with the REPL as well as a window showing the current stack. Very convenient when learning stack-based languages!

demo

Example session

> 1 2 +
> :stack
3
> 12 *
> print
36
> fact := [[pop 0 =] [pop pop 1] [ [dup 1 -] dip dup i *] ifte] dup i
> 10 fact
> :st
3628800
> ["foo" "bar" strcat] [strlen] b
> dup print
6
> 1 swap - print
-5
> even := 2 % 0 =
> odd := even not
> 3 odd 2 even and print
true
> prime := [dup even [3 <] dip or] [2 =] [prime_trial_division] ifte
> prime_trial_division := 3 [[pop % null] [pop =] [[2 +] dip x] ifte] x
> [2 3 4 5 6 7 8 9 10 11 12 13] [prime] map print
[true true false true false true false false false true false true]
> sum := 0 [+] fold
> div-3-5 := [dup [3 % null] dip 5 % null or] filter
> up-to := pred [[]] [cons] primrec
> 10 up-to div-3-5 sum print
23
> next-fib := dup [+] dip swap
> add-if-even := [even] [dup [rotate] dip + rotate] [] ifte
> 0 1 1 [100 >] [pop pop] [next-fib add-if-even] [i] genrec print
188
Open Source Agenda is not affiliated with "Silly Joy" Project. README Source: rootmos/silly-joy
Stars
34
Open Issues
0
Last Commit
6 years ago
Repository
License

Open Source Agenda Badge

Open Source Agenda Rating