Monolog

From Esolang
Jump to navigation Jump to search

Monolog (MONOLOG) is a programming language created by User:CMinusMinus.

Almost every thing you do, is for defining a variable. You can call functions, do simple maths and so on.

Variables

Lets define variable x with a value of "Hello":

x <- "Hello"

Lets define variable y with a value of x:

y <- x

Now, lets add " World!" to y:

y <- y <- " World!"

We added arg " World!" to arg "Hello".

Integers doesn´t exist.

Functions

To call a function, we have to put the name of it in brackets.

Name Action
reversed reverse arg
b64e Base64 Encode arg
b64d Base64 Decode arg
out Output arg
outln Output arg + \n
input set arg to user input
request request an url with arg
ping ping arg and return time
len return length of arg
active special variable "active" = arg
pass pass and reset arg
cuts cut arg by int(active) at start: arg[int(active):]
cute cut arg by int(active) at end: arg[:int(active)]
os run arg as os.system command
run parse arg
same go on in line if arg == active
notsame go on in line if arg != active
double returns arg + arg
exit exit loop
crepeat returns number of loops the program did
creset reset number of loops the program did




Lets call a function:

a <- (reversed) <- "Hello"

We defined variable a with a value of reversed("Hello")

But what if we want to do a = a + reversed("Hello)?
In this case we can easily do:

a <- (*reversed) <- "Hello"

How to output a text/variable?
To do this, we can use (out) or (outln), which adds a line break at the end.
So if we want to define variable X with a value of "foo" and output it at the same time, we can do:

X <- (outln) <- "foo"

BUT what if we just want to output it? BOOM:

* <- (outln) <- "foo"

A "*" as name will pass the variable-definition!

MONOLOG Settings

To change settings, you can use the "$MONOLOG" command.

$MONOLOG [OPTION] [1/0]

Example: (Changing "logvar" to true (1))

$MONOLOG logvar 1
Option Action
logvar Show all variables at end of program
error.ignore Ignore error
error.continue Continue on error
program.repeat Restart program at end
program.firsttime First time running program?

Examples

Hello, World!

Stage 1:

* <- (outln) <- "Hello, World!"

Stage 2:

hw <- "Hello, World!"
* <- (outln) <- hw

cat

Stage 1:

* <- (outln) <- (input)

Stage 2:

* <- (outln) <- (input) <- (out) <- "Enter Text: "

Count to 69

...

$MONOLOG program.repeat 1
* <- (outln) <- (*crepeat) <- "Hello, World! > "
stopat <- "69"
* <- (active) <- stopat
* <- (outln) <- "DONE!" <- (pass) <- (exit) <- (same) <- (crepeat)

Self Interpreter

$MONOLOG program.repeat 1
start: * <- (outln) <- "SELF INTERPRETER!"
* <- (run) <- (input)

External Links

Github