Minimum
		
		
		
		Jump to navigation
		Jump to search
		
Minimum is a joke language by Ihope127 which is functional and has Unlambda-like syntax. Unlike Unlambda, a Minimum program defines a function which takes the two essential primitive functions, s and k (in that order), and uses them to construct something useful, instead of actually allowing s and k to be specified directly in the program. Though Minimum has an apply operator (Unlambda's `), it has no primitive combinators, therefore making it impossible to program in. The syntax:
<program> ::= "`" <program> <program>
Interpreter
As a functional language, it is especially suiting for an interpreter to be written in Haskell:
{-# LANGUAGE OverloadedStrings #-}
import Data.Attoparsec.ByteString
import Data.Void
import System.Exit (die)
import qualified Data.ByteString as B
data Program = App Program Program
eval :: Program -> Void
eval (App x y) = app (eval x) (eval y)
  where app = absurd
parser :: Parser Program
parser = string "`" *> (App <$> parser <*> parser)
main :: IO ()
main = do
  code <- B.getContents
  case parseOnly parser code of
    Left _ -> die "Invalid program."
    Right program -> absurd (eval program) (\x y z -> x z (y z)) const