OOLANG

From Esolang
Jump to navigation Jump to search
Logo
OOLANG
Paradigm(s) imperative
Designed by Zonald Haider
Appeared in 2016
Memory system stack-based and variables
Dimensions one-dimensional
Computational class Turing complete
Major implementations By Author (from the Wayback Machine; retrieved on 17 September 2019)
File extension(s) .obj

OOLANG(Object Oriented LANGuage), simple stack based esoteric programming language, but with object oriented syntax.

Examples

Hello, World!

Hello, World!.println;

99 bottles of beer

i.99.set;
t.0.set;
i.2int;
t.2int;

start.label;
i!=t.7.17.if;

i.dec;
i.get;
%sbottles of beer on the wall,%s.print;
i.get;
%sbottles of beer%d%n.print;
Take one down and pass it around,%s.print;
i.get;
%sbottles of beer on the wall%n.print;
start.goto;

No more bottles of beer on the wall, no more bottles of beer%d%n.print;
Go to the store and buy some more, 99 bottles of beer on the wall%d.print;

Counts to ten

i.0.set;
t.10.set;

4.rem;
start.label;
i!=10.6.11.ifa;

i.inc;
i.get;
%s.print;

start.goto;

Outputs input

var.Input please.0.in;
var.get;

Truth-machine

start.label;
var.Input.0.in;

var==0.4.7.ifa;

0.print;
.halt;

var==1.9.9.ifa;

1.print;
start.goto;

Powering number

Using JavaScript.

b.Input firts..in;
v.Input second..in;
a.Math%dpow(stack["b"],stack["v"]).evjs;
a.get;

Self-interpreter

a.Input code:..in;
a.eval;

Deadfish interpreter

In this interpreter added instruction "h", to end execution.

x.0.set;
a.label;
a.Input code:..in;

x>256.31.5.ifa;

x<0.31.7.ifa;

a==i.9.12.ifa;

x.inc;
a.goto;

a==d.14.17.ifa;

x.dec;
a.goto;

a==s.19.22.ifa;

x.x.mul;
a.goto;

a==o.24.27.ifa;

x.get;
a.goto;

a==h.29.29.ifa;

.halt;

x.0.set;
a.goto;

Created by Andry Kvart.rem;

InterpretMe interpreter

start.label;
code.Input..in;

code==*.4.6.ifa;

start.goto;

.halt;

Docs

Basic

Command syntax in this language:

param1.param2.param3.command;

I/O

Special char allowed in string: %d = symbol "." | %n = newline | %s - space | %t - tab | %c - symbol ";" | %% - symbol "%"

str.print

print string on display

str.println

prints line on display

var.message.message2.in

input data and put it in var(using javascipt prompt)

Variables

var.value.set

setting variablex

var.get

prints value of variable to screen

var.inc

increments value of variable

var.dec

decrements value of variable

var.2int

converts value of variable to integer

var.2str

converts value of variable to string

var1.var2.add

var += var2

var1.var2.sub

var -= var2

var1.var2.mul

var *= var2

var1.var2.div

var /= var2

var.str.delim.strsplit

splits value of var by delim in var<

var.var1.var2.strcat

contacts value of var1 and var2 and puts its in var

var.var1.strlen

getting length of value of var1 and puts its into var

Goto

name.label

creates label

name.goto

jumps to label

Arrays

name.length.array

creating array

var.name.elem.aget

puting value from array to var

name.elem.agets

puting value from array to screen

name.elem(var).var.agetv

getting value from array name and puts its into var

name.elem.var.aset

setting elem value from var in array

name.elem.val.asets

setting elem value in array

name.elem.var.asetv

setting elem value taked from variable in array

name.elem.a2int

converts value of array elem to integer

name.elem.a2str

converts value of variable to string

var.array.arrlen

getting length of array and puts its into var

Conditional

conditional.lineif.lineelse.if

compare variables value(e.x. a==b) and gotos to lineif if true, and to lineelse if false

conditional.lineif.lineelse.ifa

compare variable and value(e.x. a==5) and gotos to lineif if true, and to lineelse if false

conditional.labelif.labelelse.ifg

compare variables value(e.x. a==b) and gotos to labelif if true, and to labellse if false

Special

text.halt

end program

none.gl

printing current line to console(for debuging)

js.evljs

evaling javascript and printing result

var.js.evjs

evaling javascript and puting result into var

Comment

comment.rem

one line comment

It's turing complete?

Yes, because we can easily use javascript api. Very simple example:

a.5.set;
b.5.set;
Using javascript!.rem;
out.stack["a"]+stack["b"].evjs;
out.get;

External resources