esolang

DL

Typed variables, loops and jumps, every block closed with three dollars or three hashes.

Disa, 2013 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello World!

The idea

Disa made DL in 2013 and wrote an interpreter for it in Visual Basic, and a compiler that turns a DL program into a Windows executable. It is an imperative, statically typed language. A program sits between the lines DL Start and DL End, one statement to a line. Variables start with @ and are declared with a type, String, Integer or Bool. A say prints its text with every variable in it replaced by its value, so say(F(@step) prints F, a bracket and a number.

Read the story

The specification shows the statements and functions its four examples use, and the author's site lists more. This implementation has the ones the specification shows and leaves the rest out.

The machine

StatementDoes
Var Integer @nDeclare a variable of a type
say(text) NL()Print text, print a line break
@n = Read()Read a line of input
@n = #@n+1Calculate with +, ? (equal) or >
@n = Add(@n,2)Call a function, here Add, Sub, Mul, Cmp, StrPos, Len or SubStr
For(10) ... $$$Repeat 10 times
If(#@n?0) ... ###Run when true, or with IfNot when false
Tag(@top) Goto(@top)Mark a line, jump to it

Example

The Fibonacci asks for n, then counts a For loop up to it.
Expected: Hello, cat

The Fibonacci asks for n, then counts a For loop up to it. Three If blocks handle the first two numbers and the rest. After the loop it adds the last two once more to give F(n).

Expected: Enter n: F(0) = 0 F(1) = 1 F(2) = 1 F(3) = 2 F(4) = 3 F(5) = 5 F(6) = 8 F(7) = 13

The specification also has a Deadfish interpreter in DL. It reads a line, looks at its first character with StrPos, cuts it off with SubStr and jumps back with Goto until the line is used up. It runs, but it never stops, as nothing in it leaves the loop.

Further

Also in Turing tarpits

Write your own in Run Convert a program from DL

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: dl.

Command line

shib run dl -e 'DL Start
say(Hello World!)
DL End'
shib manual dl

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/dl.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org