Technologic

From Esolang
Jump to navigation Jump to search

Technologic is a programming language created in 2018 in which all keywords are lyrics to the Daft Punk song "Technologic".

Design Philosophy

The main goal of Technologic is to make programs that look like the lyrics to the titular song. Also, each line in the "lyrics" must also be in the same rhythm: DAH dih DAH dih DAH dih DAH dih. For example, here is a cat program in Technologic:

start it, name it, code, rename it
buy it, click, format it, rate it
press it, name it, code, rename it
name it, code it, quick - rename it
quick - format it, print it, break it

technologic

If you say this out loud, you can hear the "rhythm" to the words. This rhythm might be required if an interpreter is made.

Keywords

"Useless" commands

All of these commands are basically ignored.

Code Comment
quick - [word]
Ignored. Place this behind a 2-syllable word to make it fit the rhythm.
mail it
Ignored. Another more flexible rhythm fitting/NOP word.
pause it
[comment]
play it
Introduces a comment. pause it must end the line it's on (even if it doesn't cleanly fit the rhythm), and play it must start the line it's on.

Variables

Variables are datatypes that can hold an arbitrary-precision rational number.

Code Comment
name it, [var], rename it
Refer to variable [var]. Legal variable names are any combination of valid keywords other than name, rename, use, code, call, bring, and any one of the "useless" commands. Attempting to refer to a variable before it's defined is illegal.
[exp], write/rewrite it, [var]
Store the value of [exp] to variable [var]. (Note: write and rewrite are synonyms here. Defines [var] if not previously defined.

Numbers

Numbers are represented simply by listing out the commands for the digits in order. Storing a number to a variable requires that it be used in an expression first.

Code Comment
erase it
0
click it
1
watch it
2
view it
3
work it
4
surf it
5
update it
6
upgrade it
7
zoom it
8
fill it
9
point it
Decimal point

Expressions

Expressions are mathematical operations done to numbers and/or variables. They can be pretty much as complicated as you want them to be, and they are evaluated from left to right. Expressions must be ended with format it.

It should be noted that any command taking an expression as an argument actually takes the last expression evaluated, which does not necessarily have to be right before the command itself.

Code Comment
[X], touch it, [Y]
[X] + [Y]
[X], trash it, [Y]
[X] - [Y]
[X], cross it, [Y]
[X] * [Y]
[X], cut it, [Y]
[X] / [Y]
[X], crack it, [Y]
[X] / [Y] (integer division)
[X], rip it, [Y]
[X] mod [Y]
zip it, [X], unzip it
Enclose [X] in parentheses
[X], turn it
- [X]

Control Flow and Conditional Statements

Conditional operators return 1 for true and 0 for false, and can be used in expressions. Conditional statements consider anything nonzero to be true, and 0 to be false.

Code Comment
[X], drag and drop it, [Y]
Conditional operator: [X] == [Y]
[X], pay/buy it, [Y]
Conditional operator: [X] < [Y]
[X], charge it, [Y]
Conditional operator: [X] > [Y]
[cond-op], switch it
Opposite of [cond-op]
[exp], check/rate it
[code]
break it
An if statement. If [exp] is true, execute [code].
[exp], check/rate it
[code1]
jam/snap it
[code2]
break it
An if-else statement. If [exp] is true, execute [code1], otherwise execute [code2].
[exp1], check/rate it
[code1]
fix/tune it, [exp2], check/rate it
[code2]
break it
An if-elseif statement. If [exp1] is true, execute [code1]. If [exp2] is true, execute [code2]. This can be combined with a jam/snap statement.
lock it, [exp], check/rate it
[code]
break it
While [exp] is true, execute [code]. [exp] is evaluated before the start of the loop.
start it, [exp], check/rate it
[code]
break it
Until [exp] is true, execute [code]. [exp] is evaluated after the end of the loop.
leave it
Prematurely leave a lock it or start it loop.
burn it
Immediately end program execution.
technologic
The equivalent of labels. (This is also required to be the last line of the program.) There must be a blank line on either end of it.
[exp], find it
Goto the [exp]th label in the program (1-indexed). 0 indicates the required label at the end of the program; negative numbers are illegal.

Input/Output

Code Comment
scan it, [var]
Read a numeric input, and store it in [var]. Defines [var] if not previously defined.
press it, [var]
Read a character input, and store its ASCII value in [var]. Defines [var] if not previously defined.
[exp], send it
Print [exp] as a number (without a newline).
[exp], print it
Print [exp] as an ASCII character (without a newline).
scroll it
Print a newline.

Functions

Functions are pieces of code that can be called at any point during the program, and can optionally take 1 or more number arguments.

Code Comment
use it, ([arg1], bring it, [arg2], bring it,...) [func], code it
[code]
break it
Defines a function called [func], optionally with arguments [arg1], [arg2], etc. Arguments are referred to in the function definition by their names only, without the use of name or rename. [code] is executed whenever the function is called. Legal function and argument names are any combination of valid keywords other than name, rename, use, code, call, bring, and any one of the "useless" commands. Attempting to define a function more than once (even if both definitions take different amounts of arguments) is illegal.

Within the function, use name it, [var], rename it for each argument like normal, but the value of these are not the same as the variables with equivalent names in the regular code would be. Or, to put it briefly, scopes.

use it, ([arg1], plug it, [arg2], plug it,...) [func], call it
Calls function [func], optionally with arguments [arg1], [arg2], etc. This can be used within expressions. Attempting to call a function before it is defined is illegal.
[exp], unlock it
Return [exp].

Oh yeah there's a stack

Oh yeah, I forgot to tell you, there's also a stack for some reason.

Code Comment
[exp], save it
Push [exp] to the top of the stack.
load it
Pop the top stack item destructively. Popping from an empty stack is illegal.
fax it
Pop the top stack item, except the value can be used inside an expression. If this is used multiple times in an expression, the stack keeps getting popped. Popping from an empty stack, once again, is illegal.
[exp], paste it
Get the value of the [exp]th stack item from the top (0-indexed). This can be used within expressions. Attempting to get a non-existent stack item is illegal.
[exp1], change it, [exp2]
Store [exp1] to the [exp2]th stack item from the top (0-indexed). Attempting to store to a non-existent stack item is illegal.

Example Programs

Hello World

quick - upgrade it, watch it, mail it
mail, format it, print it, mail it
click, erase it, click, format it
print it, click, erase it, zoom it
quick - format it, print it, print it
click it, click it, click, format it
print it, work it, work, format it
print it, view it, watch, format it
print it, zoom it, quick - upgrade it
quick - format it, print it, click it
click it, click, format it, print it
click it, click it, work, format it
print it, click, erase it, zoom it
mail, format it, print it, click it
quick - erase it, quick - erase it
mail, format it, print it, view it
view it, quick - format it, print it

technologic

Truth Machine

send it, name it, fax, rename it
start it, name it, fax, rename it
drag and drop it, quick - erase it
quick - format it, rate it, name it
fax, rename it, quick - format it,
send it, mail it, break it, mail it

technologic

External resources