DEV Community

Cover image for Yet another programming language Unv

Yet another programming language Unv

Kavindu Santhusa on December 24, 2021

if 'Unv is awesome!' print('Hello World!') # keep editing for live results Enter fullscreen mode Exit fullscreen mode ...
Collapse
 
camillerkt profile image
Camille Rakotoarisoa • Edited

Hi Kavindu! Your work looks really good to me.
Like you, I've been passionate about programming since I was 11 years old and now I'm 1 year younger than you, so your work is even more inspiring.
However, I've been looking for a way to create my own programming language for several years now, but this time not in English. That's why I would like you to explain me how you did to create your programming language in JavaScript? Did you follow a tutorial or something? What is the logic behind it?
Otherwise, where can I contact you?
Thank you very much and good luck with your projects.

Collapse
 
ksengine profile image
Kavindu Santhusa

Hi Camille,

Thanks for your kind words.

I got this idea to create a programming language when I was younger than 10 years. It was similar to HTML.

Some programming languages are static and some of them are dynamic. static ones have unfriendly syntax. But they are easy to maintain. dynamic ones like python have friendly syntax. But they are somewhat buggy due to dynamic nature.

In my point of view, JavaScript is the most universal programming language because it can be used to develop web, mobile(react native...), desktop(electron...), IOT.
Unv combined this three features,

  • static
  • easy syntax
  • universal

Instead of creating own compiler or interpreter. Unv depends on existing programming languages. So it's universal.

Collapse
 
ksengine profile image
Kavindu Santhusa

This is how compiler works.

# input code
if 'Unv is awesome!'
    print('Hello World!')
# keep editing for live results
Enter fullscreen mode Exit fullscreen mode

First remove comments and handle strings

if 'Unv is awesome!'
    print('Hello World!')
Enter fullscreen mode Exit fullscreen mode

First slice the code by newlines

if 'Unv is awesome!'
Enter fullscreen mode Exit fullscreen mode
    print('Hello World!')
Enter fullscreen mode Exit fullscreen mode

Then convert the indention to brackets

if 'Unv is awesome!' {
    print('Hello World!')
}
Enter fullscreen mode Exit fullscreen mode

Then add parentheses when needed

if ('Unv is awesome!') {
    print('Hello World!')
}
Enter fullscreen mode Exit fullscreen mode

Then Its valid JavaScript

Thread Thread
 
ksengine profile image
Kavindu Santhusa

You can contact me via ksengine.github@gmail.com

Collapse
 
camillerkt profile image
Camille Rakotoarisoa

Great! But did you follow a particular tutorial to learn how to create this programming language?

Thread Thread
 
ksengine profile image
Kavindu Santhusa

I had read tons of tutorials. But no one helped me.

Thread Thread
 
camillerkt profile image
Camille Rakotoarisoa

Did you find them on the Internet?

Thread Thread
 
ksengine profile image
Kavindu Santhusa • Edited
Thread Thread
 
camillerkt profile image
Camille Rakotoarisoa

Okay, thank you very much !! Good luck with your projects ! :)

Thread Thread
 
ksengine profile image
Kavindu Santhusa

I am looking for contributors for this project. Can you join Unv organisation

Thread Thread
 
camillerkt profile image
Camille Rakotoarisoa

I'm really sorry but at the moment I don't have much time to contribute to projects. But I note the proposal! And thanks for this one