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 (7)

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
 
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