CAESAR\

From Esolang
Jump to navigation Jump to search

OFFICIAL INTREPRETER: lol.xf.cz (not sketchy at all)

What is CAESAR?

Caesar is an esolang. That means that it's a programming language that is not supposed to be used for actual, useful purpose. Sometimes, its a work of art, but sometimes, like this time, its only purpose is to cause headache. Unlike other esolangs, though, it has pretty readabil-ish syntax. It was made in one evening by a 15yo. who is bad at programming language design and programming, so dont expect much.

How does it work?

The esolang is named after the Roman general Gaius Julius Caesar. Yes, you're now gonna be performing army.. more like exercise. It was loosely inspired by the Caesar problem from children algorithmisation book. So you essntially have 3 main subjects:

  • Caesar/Commander - a subject that performs most oerations. He prints to the output, he controls the program flow and he decides when we end. But he is dumb, so he can only remember one information at one time
  • Basket - essntially a stack with fancy name
  • Army - a subject that essentially operates the stack. They can receive commands from Caesar, perform basic operations (like addition or shuffling the stack), can receive information from him and send him information.

Commands

This esolang contains only like 10 commands that are as following:

  • raise x - raise flags A-F
  • yell - prints the content of Caesar's memory to the output
  • listen - listens for user input, saves it to commander memory
  • save - saves evenrything presented as argument to the Caesar's memory
  • signal - pushes the value in Caesar's memory to the basket
  • # - comment
  • if x y - if the value in the Caesar's memory is equal to x, do y
  • if! x y - same as if but actvates if x isn't equal to memory
  • move - move to the beggining of the program
  • stop - stops the program's execution

raise arguments:

  • A - put the value on top of the stack to the bottom
  • B - same but from bottom to top
  • C - add the first and last stack elements
  • D - add the first and second stack elements together
  • E - send the top stack value to Caesar
  • F - send the bottom stack value to Caesar
  • G - remove the top value from the stack

Syntacic quarks

Every command MUST END WITH SEMICOLON! Quotes do nothing here, this language is weakly typed without type declaration. The langage supports multiline commands, which means that this code is valid:

   save hello
   world; yell;

There are no codeblocks in this language, so

   if 5 {yell; yell;} #invalid;
   if 5 yell; yell; #invalid;
   if 5 yell; if 5 yell; #valid;

Entered argument x cannot contain spaces, but memory can.
comments are regarded as regular commands, so they must end in semicolon.

   #valid;
   #invalid
   #valid

Also, the code isnt interpreted in real time, instead it shows output after it's finished running.
The program allows up to 5000 iterations
The default value of memory is non

Example code

Hello world:

   save Hello World;
   yell;

cat:

   listen;
   yell;

truth-machine:

   if non listen;
   if 0 yell;
   if! 0 yell;
   if! 0 move;

addition of two numbers:

   if non listen;
   listen;
   signal;
   listen;
   signal;
   raise D;
   yell;