r/github • u/Folaefolc • Jul 15 '20
I made a scripting language for C++ projects, ArkScript
Hey everyone!
I wanted to talk about a project I'm very proud of, ArkScript. I started writing it for a contest, only with an interpreter and not the actual compiler + VM. That's how a (maybe too big) project was born, even after the results came in, I wanted to continue to work on it, to improve it. Performances weren't the first thing I wanted to work on, I wanted to make a language allowing the developper to be productive, and not lost them in a pool of 50+ different keywords, each for a very specific situation, thus we have only 10 of them, the bare minimum in such a language according to me.
I forgot to say that to work on the productivity side, I chose to make a lisp like. Those kind of languages are very easy to understand and use if you know two rules:
everything after a left paren is a function name, and everything after are the arguments
the only exception is when writing the list of arguments of a function, (a b c) isn't "call the function a with arguments b and c"
Starting from there, I had (according to me, thus this isn't objective at all) a quite nice language, allowing me to be more productive than in C++ or Python (again, this is my personnal preference).
Now, why would people chose this language over Lua? Some people would trade productivity for their habits with a "classic language", with {} or begin/end blocks because they see ((((())))) everywhere in lisp like codes. That's true, but I would argue that when you get to understand the power of lisp like languages, you don't see them anymore, and with good plugins in your favourite editor, you can match parens easily and avoid getting lost.
Compared to other languages:
compared to lua, we don't have OOP (but a nicer way (imo) to mimick it with closure and closure field's reading) ; also the arrays start at 0 and 1, which is (imo) counter intuitive ; no need for lengthy code using metatables to achieve something, functions and closures are your friends
compared to Ruby, we don't use the begin/end syntax for blocks (quite strange to read, but hey, everyone do as they want)
compared to Python, we don't use indentation to delimit blocks, avoiding the usual burden of mismatching indentation (tabs vs spaces), but we introduce something else, mismatching parens. Not really a problem, just something I wanted to point out
Thus, here we are: ArkScript-lang/Ark
TL;DR I made a Lisp like programming language to fit my needs and I hope others will find it useful or even come and help making it grow