OOLANG
From Esolang
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 |
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.printprint string on display
str.printlnprints line on display
var.message.message2.ininput data and put it in var(using javascipt prompt)
Variables
var.value.setsetting variablex
var.getprints value of variable to screen
var.incincrements value of variable
var.decdecrements value of variable
var.2intconverts value of variable to integer
var.2strconverts value of variable to string
var1.var2.addvar += var2
var1.var2.subvar -= var2
var1.var2.mulvar *= var2
var1.var2.divvar /= var2
var.str.delim.strsplitsplits value of var by delim in var<
var.var1.var2.strcatcontacts value of var1 and var2 and puts its in var
var.var1.strlengetting length of value of var1 and puts its into var
Goto
name.labelcreates label
name.gotojumps to label
Arrays
name.length.arraycreating array
var.name.elem.agetputing value from array to var
name.elem.agetsputing value from array to screen
name.elem(var).var.agetvgetting value from array name and puts its into var
name.elem.var.asetsetting elem value from var in array
name.elem.val.asetssetting elem value in array
name.elem.var.asetvsetting elem value taked from variable in array
name.elem.a2intconverts value of array elem to integer
name.elem.a2strconverts value of variable to string
var.array.arrlengetting length of array and puts its into var
Conditional
conditional.lineif.lineelse.ifcompare variables value(e.x. a==b) and gotos to lineif if true, and to lineelse if false
conditional.lineif.lineelse.ifacompare variable and value(e.x. a==5) and gotos to lineif if true, and to lineelse if false
conditional.labelif.labelelse.ifgcompare variables value(e.x. a==b) and gotos to labelif if true, and to labellse if false
Special
text.haltend program
none.glprinting current line to console(for debuging)
js.evljsevaling javascript and printing result
var.js.evjsevaling javascript and puting result into var
Comment
comment.remone line comment
It's turing complete?
Yes, because we can easy 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
- http://alc.comuf.com/oolang.php (First know online interpretater)