esolang

Inverted Logic

Ask whether true is true, and it says false.

PinkysWorld, 2022 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello World

The idea

PinkysWorld made Inverted Logic in 2022, a language that reverses booleans. A line holding true prints false, and and gives the answer of nand. The inversion is not complete, though. By the specification's own table or, nor, xor and xnor give their usual answers, and only and and nand trade places.

Read the story

Apart from that a program prints text, one statement a line. There is no input, no variable and no loop.

The machine

StatementDoes
print textPrint the text
println textPrint the text and a line feed
printsp textPrint the text and a space
true, falsePrint the other one
a and b, a nand bPrint a nand b, or a and b
a or b, a nor b, a xor b, a xnor bPrint what they say
exitEnd the program
; textA comment

The specification also lists keywords and errorcodes, which print lists kept on a separate interpreter page, and says numbers flip their sign without saying how to write one. This implementation leaves those three out. A boolean answer prints with a line feed.

Example

The last one prints a greeting on one line, then or answers true as usual, and false prints true.
Expected: false
Expected: true
Expected: Hello World true true

The last one prints a greeting on one line, then or answers true as usual, and false prints true.

Further

Also in Jokes

Write your own in Run Convert a program from Inverted Logic

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: inverted-logic.

Command line

shib run inverted-logic -e 'print apple'
shib manual inverted-logic

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/inverted-logic.js

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

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