CCCP language
A downloadable programming language for Windows
CCCP is a simple interpreted programming language based on the USSR.
Source code: https://github.com/Kuvrot/CCCP
License: GPL-3.0 license
Example code: This next code creates two variables (comrades) and ask for user input, if the sum of the first variable plus the user input gives 4, the program will be ended, if the sum is equal to anything else, then the program will ask for input again.
To execute a program save your code with an .cccp extension execute the program cccp.exe and a terminal will open, a path for your file will be requested, enter the path and your cccp program should run.
Keywords:
comrade, if, gulag, alert, propaganda, manifesto, progress, censor, contribute, revolutionize, sendToGulag.
These keywords are used to perform various operations and control flow in the program.
Operators:
=
, +=
, -=
, *=
, /=
.
Comments:
;
is for commenting , when used everything that is written next to it do not executes.
; this is a comment and will be ignored by the interpreter
Variables: comrade
is used in order to declare variable (of integer type)
comrade number
you can assign a value to a variable with the operator =
number = 25
or you can assign a value when declaring it.
comrade number = 25
Conditions:
if is used to introduce a conditional statement. It allows you to specify a condition that is evaluated, and if the condition is true, the code block following the if
statement is executed. If the condition is false, the code block is skipped.
if [condition] [action]
if ivan == 4 alert ( 4! that's the number )
gulag
it's used to create loops, if you want to return to a specific point you can use the keyword gulag
. sendToGulag
is used when we want to go back to the point we selected with the keyword gulag
.
Functions:
Note: when using ()
it's important to mention that when putting content inside it don't join the '(' or the ')' , everything must be separated with the content inside. For example:
alert (Hello world!) ; this is incorrect alert (Hello world! ) ; this is incorrect alert ( hello world! ) ; this is correct
As you see, every single character or keyword must be separated by space.
alert () or propaganda () are for printing messages on the screen.
alert ( hello world! )
manifesto () is for printing a number or a variable.
manifesto ( 25 ) manifesto ( number )
progress
is for creating a new line in the screen
censor
clears the screen
contribute ()
allows the user to assign a value to a variable
alert ( enter a number ) progress ; the keyword progress is used to create a new line comrade number contribute ( number ) progress alert ( the number you entered is: ) manifesto ( number ) progress
Looping:
gulag
is used as a keyword to set the line or instruction where the program will loop back to after executing a certain block of code. It can be interpreted as a keyword designed for the purpose of controlling the flow of the program.
when the command sendToGulag
is called, it represents a condition or event that triggers the loop. Once the program encounters the sendToGulag
command, it will jump back to the line specified by the gulag
command, allowing the code within that block to be executed again. This creates a loop or repetitive execution of the code enclosed between the gulag
and sendToGulag
commands.
Operators
The operator=
is an assignment operator. It is used to assign a value to a variable or a data structure. When the "=" operator is used, the value on the right-hand side of the operator is assigned to the variable or data structure on the left-hand side.
number = 12 variable1 = variable2
The operator+=
is an addition assignment operator. It is a compound assignment operator that combines addition and assignment in a single step. It is used to add a value to an existing variable and update the variable with the result.
comrade num = 10 num += 10 manifesto ( x )
The output will be :
20
In the case of the rest of operators -=
, *=
, /= , %=
Work just like the "+=" operator, these compound assignment operators provide a concise way to perform the arithmetic operation and assignment in a single step.
in the case of -=
it's for substraction
in the case of *=
it's for multiplication
in the case of /=
it's for division
in the case of %=
calculates the modulus of a variable with a value and assigns the remainder back to the variable.
Download
Click download now to get access to the following files: