Danicb

From Esolang
Jump to navigation Jump to search
This language is a derivative of Danica.

Danicb is a programming language which is based on many other programming languages. This language is most obviously based on a language called Danica made by someone who does not wish to be named, but its rules are noticeably different.

User Code

The user code can only consist of f and space. If any other characters are included, the error "f" is thrown. Groups of f's are separated by spaces.

There can only be groups of 1 to 6 f's, inclusive. If there are groups of more or less (i.e. two spaces in a row), the error "f" is thrown.

Program Execution

First, all of the f's are turned into letters using the following correspondence.

Letter to Code Correspondence
Letter Representation
a f f
b f ff
c f fff
d f ffff
e f fffff
f ff f
g ff ff
h ff fff
i ff ffff
j ff fffff
k fff f
l fff ff
m fff fff
n fff ffff
o fff fffff
p ffff f
q ffff ff
r ffff fff
s ffff ffff
t ffff fffff
u fffff f
v fffff ff
w fffff fff
x fffff ffff
y fffff fffff
z ffffff

In all subsequent cases, the representation using letters instead of different numbers of f will be referred to as the wimpmode.

Then, some of these letters are turned into characters. Once the letters have accomplished their purpose, they either disappear or are replaced by the character they represent:

Caption text
Word Result
First Pass (Important to Comprehension)
cap Makes the following letter a capital letter
Second Pass (Important to Visuals)
amp Turns into the character &
ast Turns into the character *
bak Turns into the character \
car Turns into the character ^
cbc Turns into the character }
cbk Turns into the character ]
col Turns into the character :
com Turns into the character ,
cpr Turns into the character )
dot Turns into the character .
eight Turns into the character 8
eq Turns into the character =
exc Turns into the character !
five Turns into the character 5
four Turns into the character 4
gt Turns into the character >
lt Turns into the character <
new Turns into the character for a newline
nine Turns into the character 9
one Turns into the character 1
obc Turns into the character {
obk Turns into the character [
opr Turns into the character (
quot Turns into the character "
pipe Turns into the character |
seven Turns into the character 7
six Turns into the character 6
slash Turns into the character /
space Turns into the character for a space
three Turns into the character 3
two Turns into the character 2
und Turns into the character _
Second Pass (Important to Code)
sar indicates a break between two separate arguments
tar indicates that arguments have either started being indicated or stopped being indicated, defaults to "not being indicated" at start of code
tst indicates that the text either is or is not a string, defaults to "not a string" at start of code
Final Pass (Important to Both)
del deletes the character before it

Then, the actual code starts working. Text can either be:

  • an instruction, one of five specific words followed by tar
  • an argument, after the tar which follows an instruction but before the next tar
  • a string label, neither an instruction nor an argument, surrounded by tst on either side
  • variable label, neither an instruction nor an argument, not surrounded by tst

There are five instructions: print, read, >jump, <jump, =jump.

Caption text
Word Result Use of Second Pass
print

checks if there are any sars between the next two tars
throws the error "f" if so
otherwise, prints output to console

tar used to surround all the arguments of this function, tst used to toggle between variables and strings or concatenate the value of the two variables around it by typing it twice
read assigns values from object given to one or multiple variables:
  • assigns value of string if the first argument starts with tst
  • takes in value from input otherwise
  • checks that all the arguments other than the first are not strings
  • throws the error "f" if any of them are strings

when there is more than one variable, the variables before the end will contain one character until either:

  1. there are no more characters (next variables will be empty)
  2. the last variable shows up (the rest of the characters will be in this variable)
tar used to surround all the arguments of this function, sar used to toggle between arguments, tst used before and after ends of string, or to surround the value of a variable in a string in order to
All the following commands throw the error "f" if they have more than two arguments.
greater checks whether the first string (or the string represented by that variable) is greater in length than the second string (or the string represented by that variable)

if yes, checks the second argument.

  • if it is a string
    • jumps to the first instance of the string outside of any arguments
    • throws the error "f" otherwise
  • if it is a variable
    • jumps to the first instance of the string represented by the variable outside of any arguments
    • jumps to the first instance of the variable outside of any arguments if the represented string is not available
    • throws the error "f" otherwise

if no, does not jump

tar used to surround all the arguments of this function, sar used between arguments, tst used within an argument to toggle between variables and strings or concatenate the value of the two variables around it by typing it twice
small checks whether the first string, or the string represented by that variable, is less in length than the second string, or the string represented by that variable

if yes, checks the second argument.

  • if it is a string
    • jumps to the first instance of the string outside of any arguments
    • throws the error "f" otherwise
  • if it is a variable
    • jumps to the first instance of the string represented by the variable outside of any arguments
    • jumps to the first instance of the variable outside of any arguments if the represented string is not available
    • throws the error "f" otherwise

if no, does not jump

tar used to surround all the arguments of this function, sar used between arguments, tst used within an argument to toggle between variables and strings or concatenate the value of the two variables around it by typing it twice
compare checks whether the first string (or the string represented by that variable) is the same as (not just equal in length to) the second string (or the string represented by that variable)

if yes, checks the second argument.

  • if it is a string
    • jumps to the first instance of the string outside of any arguments
    • throws the error "f" otherwise
  • if it is a variable
    • jumps to the first instance of the string represented by the variable outside of any arguments
    • jumps to the first instance of the variable outside of any arguments if the represented string is not available
    • throws the error "f" otherwise

if no, does not jump

tar used to surround all the arguments of this function, sar used between arguments, tst used within an argument to toggle between variables and strings or concatenate the value of the two variables around it by typing it twice

Example Code

In some instances, the wimpmode code will be written in a way which puts functions and labels on their own lines. Keep in mind this is invalid code and will not run.

Hello, World!

ffff f ffff fff ff ffff fff ffff ffff fffff ffff fffff f f ffff fff ffff fffff ffff ffff ffff fffff f fff f f ffff f ff fff f fffff fff ff fff ff fff fffff f fff fff fffff fff fff ffff ffff ffff f f f f fff f fffff f fff f f ffff f fffff fff fff fffff ffff fff fff ff f ffff f fffff fffff ffff f fff ffff fffff ffff ffff ffff fffff ffff fffff f f ffff fff

prints Hello, World!

printtartstcaphellocomspacecapworldexctsttar

Cat Program

ffff fff f fffff f f f ffff ffff fffff f f ffff fff ffff fffff ffff ffff ffff fffff ffff fffff ffff ffff ffff fffff ffff ffff f f ffff fff f ff f fffff ff ff ff ffff fff ffff ffff fffff f f ffff fff f ff f fffff ff ff ff ffff fff ffff ffff fff f fffff f f f ffff ffff fffff f f ffff fff f f ffff fff ff ff ffff fffff f f ffff fff ffff f ffff fff ff ffff fff ffff ffff fffff ffff fffff f f ffff fff f f ffff fff ff ff ffff fffff f f ffff fff ff ff ffff fffff ff fffff fffff f fff fff ffff f ffff fffff f f ffff fff f f ffff fff ff ff ffff ffff f f ffff fff f ff f fffff ff ff ff ffff fff ffff ffff fffff f f ffff fff

readtartsttstsarbegintarbeginreadtarargtarprinttarargtargtjumptarargsarbegintar

readtartsttstsarbegintar (assigns the value of an empty string to "begin")
begin (this is the label, the variable which contains the empty string)
readtarargtar (reads a value into "arg")
printtarargtar (prints the value in "arg")
gtjumptarargsarbegintar (halts if "arg" is the empty string, otherwise jumps to "begin")

Computational Class

This language should theoretically be Turing-complete.

Implementation