DL

From Esolang
Jump to: navigation, search

DL is a new esoteric programming language, created and implemented by User:Disa. DL source files can be compiled to Windows Executable files.

Language overview

DL is an imperative language, statically typed. Example of usage:

Command Description
say(text) Print text on console output
Var String @str Declare @str as string variable
@str = Read() Put console input to @str
@sum = #1+2 Calculate sum of 1 and 2 and write it to @sum
@str = abc Define value of variable
For(10)
say(abc)
$$$
Put to console "abc" 10 times
@result = Cmp(1,1)
Alternative:@result = #1?1
@result = true if 1 = 1

Examples

Hello, World!

This program prints out the words Hello World!:

DL Start
say(Hello World!)
DL End

Cat

A cat program writes its input directly to its output.

DL Start
Var String @input
@input = Read()
say(@input)
DL End

Fibonacci sequence

DL Start
Var Integer @prev1
Var Integer @prev2
Var Integer @val
Var Integer @curr
Var Integer @step
say(Enter n: )
@val = Read()
NL()

For(@val)
say(F(@step)
say() = )
If(#@step?0)
	say(0)
	NL()
	@prev2 = 0
###
If(#@step?1)
	say(1)
	NL()
	@prev1 = 0
	@prev2 = 1
###
If(#@step>1)
	@curr = #@prev1+@prev2
	say(@curr)
	NL()
	@prev1 = @prev2
	@prev2 = @curr
###
@step = #@step+1
$$$
@curr = Add(@prev1,@prev2)
say(F(@val)
say() = @curr)
DL End

Deadfish interpreter

Command per line.

DL Start
Var Integer @x
Var String @cmd
Var Bool @bool
Var Integer @pos
Var Integer @tmp2
Tag(@again)
@cmd = Read()
Tag(@nextcomm)
@pos = StrPos(@cmd,i)
If(Cmp(@pos,1))
    @x = Add(@x,1)
###
@pos = StrPos(@cmd,d)
If(Cmp(@pos,1))
    @x = Sub(@x,1)
###
@pos = StrPos(@cmd,s)
If(Cmp(@pos,1))
    @x = Mul(@x,@x)
###
@pos = StrPos(@cmd,o)
If(Cmp(@pos,1))
    say(@x)
    NL()
###
If(Cmp(@x,-1))
    @x = 0
###
If(Cmp(@x,256))
    @x = 0
###
@tmp2 = Len(@cmd)
@tmp2 = Sub(@tmp2,1)
IfNot(Cmp(@tmp2,0))
    @cmd = SubStr(@cmd,1,@tmp2)
    Goto(@nextcomm)
###
Goto(@again)
DL End

Computational class

DL is probably Turing-complete, meaning that it is in the same computational class as universal Turing machines.

External resources

  • User:Disa's DL webpage contains a functions list, N++ language definition and a couple of interesting programs.
    • DLI – Interpreter written by author of language in Visual Basic.
    • DLC – Compiler written by author of language.
    • IDE – with syntax highlighting and some Intelli-sense features.