DEV Community

Cover image for Long - An esoteric language
Pranav Baburaj
Pranav Baburaj

Posted on

Long - An esoteric language

Have you ever thought of creating a programming language just for fun? Yes, I made an attempt to create my own Esoteric Programming Language based on ASCII characters.

What is an esoteric language?

Esoteric programming languages are weird languages created just for fun rather than for practical use.

Some examples include Befunge

 "dlroW olleH">:v
              ^,_@
Enter fullscreen mode Exit fullscreen mode

LOLCODE

HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
Enter fullscreen mode Exit fullscreen mode

and Shakespeare

Act I: Hamlet's insults and flattery.
Enter fullscreen mode Exit fullscreen mode

Long

Long is a simple, useless, minimal esoteric programming language created for fun. The language is based on ASCII characters. You can find the code in GitHub

72+#29+#7+##3+#79-# 55+#24+#3+#6-#8-#68-#1+# ;
Enter fullscreen mode Exit fullscreen mode

How long works ??

The long programming language works like this:

  • Takes the file to run
  • The lexer breaks down the code into specific tokens and store them in an array
  • The tokens are grouped into different commands.
  • The commands are executed

How to use it??

Using long is pretty simple. You just have to create a project and run it.

To create a project, run

long new
Enter fullscreen mode Exit fullscreen mode

and answer all the prompts and you are ready to go. To run the project, get into the project directory and run long run(Make sure you have the right file mentioned in the entry-point field in the long.json file). Or, you can directly mention the file name like this,

long <path-to-file>
Enter fullscreen mode Exit fullscreen mode

The language works based on the value which is incremented and decremented

The main commands in the language are the following,
# for printing the current character
! for setting the value to 0
+, -, *, / for arithmetic operations

Arithmetic operations can be performed on the value which is initially set to 0. You can print out the current value converted to a character with the print command(#).

For example:

72+# 33+# ;
Enter fullscreen mode Exit fullscreen mode

Result:

Hi
Enter fullscreen mode Exit fullscreen mode

This piece of code will increase the value by 72 and print the value out. Again, the value is incremented by 33 and printed out.


Feel free to contribute on GitHub


To reach me just ping me on Discord and also, don't forget to join my Discord server.

Hope you got something new today. Thank you for scrolling and have a nice day.

Top comments (8)

Collapse
 
olus2000 profile image
Alex Esoposting • Edited

It's cool to make your own language but what you did is essentially a way to encode text. It's good if you had fun and/or learned something, that's the point of esolangs, but consider these:

  • How could your language take input from the user and react to it?
  • How could your language specify that some code should be run multiple (possibly a variable number of) times?
  • How could your language specify that some code should be run only if some condition is met?
  • How could your language store more than one value?

Making esolangs turing-complete is not a must, it's cool if you want to make a language to only do a specific thing, but if you are interested than think about my points, see how they are implemented in normal languages, and see if you may want to implement them in your own way in your language to make it more powerful.

Collapse
 
olus2000 profile image
Alex Esoposting • Edited

A minor note:
Use a single '?', not '??', at the end of questions, and don't put a space before it. Your subtitle should be:

How Long works?

Not:

How long works ??

Unless I'm dumb and you did it on purpose, than sorry, my bad :p

Collapse
 
pranavbaburaj profile image
Pranav Baburaj

Thank you @olus2000

Collapse
 
nevmenandr profile image
Boris Orekhov

This is a fantastic introduction to the wonderfully weird world of esoteric programming languages. Your post reminds me of why I, as someone coming from the humanities (philology and digital humanities), find these languages so fascinating—they are, in a way, a form of digital poetry.

I’ve written about this very topic myself, drawing a parallel between the expressiveness of natural languages and programming languages. Just as the Latin language, with its case system, allows for a freedom of word order that English lacks (leading to the famous quote about Horace's verse being untranslatably "concise and powerful"), some esolangs play with syntactic constraints in ways that challenge our assumptions about how code should look and behave.

For instance, there's a language called Perligata, which allows you to write code in Latin. Its defining feature is that variable assignment is determined not by the order of words, but by their grammatical case (dative for assignment, accusative for use). This directly challenges the rigid, position-based syntax of most languages, much like the R language's 5 -> x assignment flips the typical left-to-right logic of Python or C.

Then there's the Shakespeare programming language, where the code resembles a play by the Bard. The variables are named after characters like Romeo and Juliet; positive and negative numbers are assigned through "insults" and "compliments" (e.g., "Thou art as sweet as a sunny summer's day!" for a positive value); and the program's "flow" is structured in Acts and Scenes. It's a brilliant postmodern pastiche—and, like the poems written in Assembly that I've mentioned in my writing, it proves that the urge to bend a language's rules for aesthetic or intellectual pleasure is deeply human.

Your exploration of the self-referential, loop-based nature of "Long" continues this tradition perfectly. The V command that creates a variable that is also a jump address and a function—that's not just a coding feature; it's a philosophical statement about the nature of identity and reference in programming. It's exactly the kind of elegant, brain-teasing concept that makes esolangs so rewarding to study.

As the creator of Perligata, Damian Conway, famously said: “If you have to ask ‘Why?’, then the answer probably won’t make any sense to you either.” And that, I think, is the perfect sentiment for this entire field. They are "useless" in a practical sense, but invaluable as a form of intellectual play, a way to test the limits of formal systems, and a bridge between the humanities and the hard sciences. Thanks for writing this up so clearly—I'll be sharing it with my friends who think I'm crazy for loving this stuff!

Collapse
 
freakcdev297 profile image
FreakCdev

cool... I guess

Collapse
 
pranavbaburaj profile image
Pranav Baburaj

Thank you @freakcdev297

Collapse
 
javacode7 profile image
JavaCode7

Nice!

Collapse
 
pranavbaburaj profile image
Pranav Baburaj

Thank you @javacode7