Crafting a Programming Language

2024-09-13 | aprates.dev

Leia este post em português

                     `,,.`                                                 
                  ,--~~~~:::^'-,                                           
                 :rv++vvvvv+v+v+^                                          
                :rrrv+v:~-~-+vr+^                                          
                -vv;vav:,,`.`.`                                            
                .~-~-r;~+r+v:--`                                           
           '':-~;;a;rr',^,,^`^                                             
        `~;~~-~;-~^''~+++vrv;`                                             
         .,-~;;~--~-,,,-;xv-^                      ^---;;;~~;;~~;;;-       
  .vv+v;''''^^-;-v~--:^--;^--                     ,~;;-~~~~~-~--;==-       
  '=xa=+,,','^:^-::^~~~~-~::^,.                  ,;;-~;~;;--;--vrx~        
   v=aar-:'',':^^-:-::^^::--~-'.                .~-;~v+~---;--;==v         
   ;xa==~;-:,,,::~--:::-^~:r+~-^,.              -v-+~v;~++rv~~+x+          
   .x=x=v-;~~^-,-~:;-;-;-;~xv;;;;-'`..         -+++v-~v+r-r+rvx+.          
    +a===r~-~;~::^-:^:--~-,;vv+vr-;-~:-,'',.  :+vvr~~~-~;r;-vxr,           
    ;x=ax+r~;~~-;;~-;~:-:-,,,~-~--::--~~~.`,,^+vrrrv+++rrr==xa,            
    .=axa=+r+-;--;;-~~~;~~~+-,',,'','::,:-^--vvv+v+v+rr+rxa=x:             

The realm of programming languages is broad and nuanced, offering a wide array of needs and specific applications within computing. Some languages are preferred for data analysis due to their simplicity and ergonomics, while others are chosen for systems requiring high levels of hardware control and performance.

This diversity stems not only from technological evolution but also from personal preferences and the peculiar dynamics within programming communities. Different programmers and communities gravitate toward different programming paradigms, such as functional and object-oriented programming, each carrying its own set of complexities.

In this vast universe, I embarked on a personal challenge to create a new programming language, which I have named FatScript (more about the name down the line). Initiated not out of necessity but through a desire for exploration, this project was born from my own process of learning-by-doing, building something from scratch.

…but if a thing is humanly possible, consider it to be within your reach. - Marcus Aurelius

While creating a new programming language in 2022–24 might seem like reinventing the wheel, and possibly off-hype due to AI advancements, this journey was, in truth, about the satisfaction found in the way. While perhaps solving what I see as problems in other languages, and most surely creating brand new design flaws.

As a brazilian software engineer with a background in developing Flash games (good old times!) and working with distributed systems using Scala (yes, its compile time is bad) and React (loved it in 2018, not so much with the recent updates), my journey into language development was fueled by curiosity. The same bug that bit me when I was 12 years old and wrote Pong in Turbo Basic (ah, the noisy hard drive and the plastic smell of that 486, nostalgia).

So, eventually, came to life: "FatScript, a lightweight, interpreted programming language designed for building console-based applications. It emphasizes simplicity, ease of use, and functional programming concepts."

But, wait…

FATscript, a LIGHTWEIGHT programming language?

Hmm, something about this statement seems contradictory…

Indeed, there's some missing context! The expression "syntactic sugar" refers to features that make code easier to write by hiding underlying complexity. And, as with consuming too much sugar… there can be consequences: fatness. Which, in this sense, it's a good thing, at least I think - a lot of weight in few lines of code.

That said, FatScript is a relatively new language, and although it has been designed to be simple and intuitive, it is guaranteed not to be the best fit for all tasks, especially when it comes to high-performance computing or extremely complex workloads. However, despite its name, the FatScript's interpreter, fry [2], is tiny (lightweight), with a near-zero startup cost and benchmarking [3] shows it performing comparably to languages like Python or JavaScript.

So while calling it "lightweight" might be debatable, the language runtime is not inherently bloated and maintains an efficient profile in practice for most use cases.

And to be fair, why are we even worried about speed? Python has proven that you don't need speed when you've got style! Python has been known for years as being slow and, look at its popularity still growing. It manages to charm its way into everyone's toolkit. I even dare to say that a language being slow is irrelevant if it is fast enough and gives you some cool features, or even if it just makes you feel good about using it, it's already a win (certainly not the case with COBOL).

Well, FatScript, designed primarily for console-based applications, combines features I admire from other languages:






Where FatScript Shines

Here are a few places where you can see FatScript in action:




The language's simplicity and the capacity for rapid iteration make it suitable for these tasks, and I wonder how big of a challenge I can throw at it. Only time will tell.

So, my "humble" vision is that everyone will benefit from using FatScript, that it contributes to the rich tapestry of programming languages by offering a unique blend of simplicity, functional programming, and ease of use.

For those intrigued by new languages or those looking for a fresh perspective in programming, FatScript offers a distinct playful taste: spicy, sugary, and greasy… you should try!

For more insights and live demonstrations, join the weekly sessions on YouTube [6] every Monday at 8 PM (Brazilian time) or visit the official webpage at FatScript.org [7] to explore more about this super cool, fascinating language.

fry, The FatScript Interpreter

Benchmarking

FatScript Playground

Other Spin-Offs

FatScript YouTube channel

Official Webpage

See also

Capsule Archives

Capsule Home

Want more?

Comment on one of my posts, talk to me, say: hello@aprates.dev

Subscribe to the Capsule's Feed

Checkout the FatScript project on GitLab

Checkout my projects on GitHub

Checkout my projects on SourceHut

© aprates.dev, 2021-2024 - content on this site is licensed under

Creative Commons BY-NC-SA 4.0 License

Proudly built with GemPress

Privacy Policy


Source