OREO

From Esolang
Jump to navigation Jump to search

OREO - esoteric language created by User:Kamish.

This language is useless as all of my languages, lol ;)

Commands

Okay, what commands exist:

Command Description
RE accumulator += 1
O pointer move right
&O print the accumulator as ASCII

All programs are as if you bake cookies: O is biscuit; RE is cream; &O is biscuit too.

Hello World program

ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O
ORERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE&O

Implementations

Common Lisp

A simple and concise implementation of an OREO interpreter in Common Lisp follows.

(defun interpret-OREO (code)
  "Interprets the CODE representing an OREO program and returns ``NIL''."
  (declare (type string code))
  (let ((memory  (make-array 1 :element-type '(integer 0 *)
                   :adjustable T :fill-pointer 1 :initial-element 0))
        (pointer 0))
    (declare (type (vector (integer 0 *) *) memory) (type fixnum pointer))
    (with-input-from-string (input code)
      (loop
        for   character of-type (or null character) = (read-char input NIL)
        while character
        do
          (cond
            ((and (char= character #\R) (char= (peek-char NIL input NIL) #\E))
              (read-char input)
              (incf (aref memory pointer)))
            ((char= character #\O)
              (incf pointer)
              (vector-push-extend 0 memory))
            ((and (char= character #\&) (char= (peek-char NIL input NIL) #\O))
              (read-char input)
              (write-char (code-char (aref memory pointer))))
            ((member character '(#\Newline #\Space #\Tab) :test #'char=)
              NIL)
            (T
              (error "Invalid command: ~s." character)))))))

Slashes

/RE/+//O/>//&O/./

Compiles to BF. Program is written after this code. Hello World code produces this output:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++.
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
>+++++++++++++++++++++++++++++++++.

C

#include<stdio.h>
int main(){
    char c,x=0;
    while((c=getchar())!=EOF){
        if(c=='O') x++;
        if(c=='&'&&getchar()=='O') putchar(x);
        if(c=='R'&&getchar()=='E') x=0;
    }
    return 0;
}

See also

Interpreters

GitHub offers a more elaborate implementation of the language.