esolang

FHC

Three letters, three famous programs, and nothing else.

Mihai Popa, 2023 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello, world!

The idea

Mihai Popa made FHC in 2023, after HQ9+. It has three commands. F runs FizzBuzz, H prints Hello, world! and C runs a cat. The specification's interpreter is a Windows batch file that asks for one letter at a time.

Read the story

That batch file settles the details. Its cat reads one line. Its FizzBuzz counts from 1 to 99, not 100, writes Fizz! (3) where most write Fizz, and puts its lines in a file called paper.txt rather than on the screen. Then it exits. This implementation prints those lines, each with the space that the batch's echo leaves before the line break, and F ends the run.

The machine

CommandDoes
HPrint Hello, world!
CRead a line and print it
FFizzBuzz from 1 to 99, then stop

Lower case works too, as the batch compares with /i. Any other letter prints the interpreter's error line and the run goes on.

Example

F prints 99 lines.
Expected: cat
Expected: Hello, world! abc
Expected: Error! You chose a wrong character. Only these are accepted: F, H and C

F prints 99 lines. The first five are 1, 2, Fizz! (3), 4 and Buzz! (5), and the fifteenth is Fizz Buzz! (15).

Further

Also in Jokes

Write your own in Run Convert a program from FHC

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: fhc.

Command line

shib run fhc -e 'H'
shib manual fhc

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/fhc.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org