Skip to content
cairdcoinheringaahing edited this page Jul 25, 2021 · 10 revisions

Welcome to the Commentator wiki!

Commentator is a programming language designed to be good at programming polyglots, through the use of commonly used comment symbols in well used languages such as C or Python.

Commentator has two commands that qualifies it as an official programming language by the consensus on PPCG, and may be Turing Complete (it has not yet been proven).

Every symbol not recognized by the interpreter is ignored and doesn't have any affect.

Memory

Commentator uses a series of accumulators, acting similar to a tape, as a memory system. The accumulators hold a single numerical integer value, such as 100, between -∞ and ∞. Commands operate on the active accumulator, which can be changed through the use of the {- and the -} commands. The active accumulator is referred to as active and the one directly to the left is referred to as inactive.

The inactive is mainly used for mathematical operations.

Commands

Command Symbol Description
<space> Adds 1 to active
/* Converts active to a Unicode character and outputs it
% Modulo active by the inactive
! Multiplies active by inactive
// Adds the input to active. If there isn't any more input, add the inactive to the active
-- Checks if active is a prime number
# Resets active to 0
*/ Outputs active as a number
<! Floor divides active by inactive
{- Moves 1 place to the right along the accumulators
e# Negates active
<# XORs active with 1
-} Moves 1 place to the left along the accumulators

For loop

If a line of code begins with a ; (after a newline), that line is execute the same number of times as the accumulator value. An example could be

          
;*//*
*/

(the first line has 10 spaces)

This will output

10
10
10
10
10
10
10
10
10
10
10

If statement

If a line of code begins with a : (after a newline), that line is only executed if the active isn't 0. An example could be

//--
:*/

which is a primality checker.

While Loop

If a line of code begins with a ? (after a newline), that line is executed until the active isn't 0. An example could be

//*/
?*/

which is a Truth Machine

Clone this wiki locally