Furry Paws

Implementation of programming language FP

Furry Paws is an interpreter for an extension of FP. It is written in FP and self-compiles, but the actual program code is translated to C and has to be compiled to an executable using GCC (since it uses specific extensions).

This implementation provides string processing and file input/output routines. It’s syntax differs from the one described in the main language article.

Examples:

Hello, World!:

Example for versions Furry Paws

~x is constant-value function (denoted with % in Interactive FP). emit is a function which writes its argument to stdout. main is a function which is the first to be invoked when the program is executed.

main = emit.(return ~"Hello, World!\n")

Factorial:

Example for versions Furry Paws

This example works in exactly the same way as the one in Interactive FP, except for that it doesn’t define zero function, since it’s built-in. Note that here all operations are done within integer data type, and 13! overflows it, so the program can be called only to print factorials up to 12!. show is another way to output data.

dec = sub.[id, ~1]
seq = zero -> [id] ; cat.[seq.dec, [id]]
factorial = zero -> ~1 ; mul.[id, factorial.dec]

main = show.(return @factorial.(seq.~12))

Fibonacci numbers:

Example for versions Furry Paws

This example works exactly like the one for Interactive FP.

one = eq.[id, ~1]
dec = sub.[id, ~1]
seq = one -> [~1] ; cat.[seq.dec, [id]]
fibonacci = lt.[id, ~3] -> ~1 ; add.[fibonacci.sub.[id, ~1], fibonacci.sub.[id, ~2]]

main = show.(return @fibonacci.(seq.~16))