I'm planning a (massive? maybe) refactor (could even be called a rewrite) of #ArkScript (a scripting language) once the v4 is there.
I'm currently stuck on #cpp 17 and willing to go to C++20. There are a lot of things that could get optimized (and many copies could be avoided), I wanted to make something that works first, but never got around to rewriting some pieces and use newer and safer idioms
Oh boy, that's going to take me a few more years :blobfoxthisisfine:
Digging this up about a month ago: I somewhat failed (for now) by announcing that I wanted to work on #ArkScript again, and then I didn't
But it worked on #Pataro, I just started looking at the code again, improving it here and there and posting my progress after, and it feels great!
I saw a Reddit post asking if it was possible to generate revenue by making your own programming language
If you want to know, in the 4+ years I've been working on #ArkScript I might have earned about 400€ at most
#opensource is not profitable and #pldev is even less profitable, having a job on the side is a better idea than trying to rely on grants and donations
Oh yeah, since I migrated my mastodon account my old posts are lost, so if you don't know what #ArkScript is, here is your explanation:
I've been working on this language for the past 4 (5?) years, with the goal in mind to be portable (compile once, single bytecode file, runs on a VM), easy to use (10 keywords and that's it), easy to embed in your C & C++ programs.
My main goal was to do #gamedev with it, using it in my 2d video game lib... but I haven't touched this lib for a few years now 😅
Yesterday I got to work on the new parser for #ArkScript, polishing its integration into the existing compiler and started to implement the import solver
I'm proud to say that nearly all the parser tests are passing, checking the AST as well as the errors produced, and how they are formatted!
On the right you can see the list of imported packages and their type
I have a #pldev problem: how do I represent an if macro in #ArkScript, since the syntax changed from
!{foo 5} !{bar (a b) (+ a b)} !{if (= 5 foo) then else}
to
(macro foo 5) (macro bar (a b) (+ a b))
We have
- (macro if (= 5 foo) then else), it looks like we are creating a macro "if"
- (when (= 5 foo) then else), is that clear enough?
- (macro:if ...) a bit long
- (if ...), generic if: how do you know if that's runtime or compile time?
#ArkScript v3.5.0 is now available
The release is mainly focused on bug fixes and enhancements for us maintainers to catch bug quicker
https://github.com/ArkScript-lang/Ark/releases/tag/v3.5.0
#opensource #pldev
I might be able to create a new version of #ArkScript this weekend, mostly enhancing the macro processor and chipping at a few bugs.
However, this might be the last update to the v3, as I currently have to support both v3.x and v4 (and thus port bug fixes to both, as well as some non-breaking changes features)
Just a few things to add, like parsing \\uXXXXX in strings, going through all the crashes that the fuzzers reported (and fixing them if possible), and we will be able to add this to #ArkScript version 4!
Super excited for this, as this will let me experiment more on the import system, the goal being something like this, with imports being related to the entry file
The new parser for #ArkScript is nearly done! It would appear to be at most 2 times slower than the previous one and I'm fine with that (being able to parse 20k deeply nested nodes/second is plenty)
Those metrics are interesting, because you can see that in term of lines parsed/second, the new parser is just 20% slower than the old one ; this was something to expect, as I switched from a basic look ahead parser to parser combinators.
#pldev
Fun fact: I wrote #ArkScript because of the interpreter/bytecode pattern described in Game Programming Patterns (Bob Nystrom)
I discovered some time later that Crafting Interpreters existed (at the time the clox chapters were at their beginning, but they existed!)
#cppcast
https://cppcast.com/dart-crafting-interpreters/
Is it me or is #utf8 really easy to understand and parse?
I'm sort of rolling my own utf8 (nearly) random access iterator in #Cpp for a new parser for #ArkScript, and so far everything works well, not a lot of dark magic to add to it
Here is the POC if anyone is interested (or want to tell me I made a huge mistake) https://godbolt.org/z/Wq3M9he9r
I'm currently adding fuzz testing in the CI of a parser for #ArkScript and it was really easy to do thanks to AFL++.
They already have a production ready-ish Docker image and it just works™️
Look at this, I just copy pasted a few commands to build the target, generate a corpus, and fuzz it with some CI friendly parameters:
https://github.com/SuperFola/parser-combinators/pull/4/files
#PLdev
And here is a slight improvement in performances (a few more thousand nodes/sec) by creating only once the atom parsers.
I've worked a bit on it tonight, and we can handle things like comments inside blocks (only top level before, I don't know why), nested function calls and anonymous function calls!
Thanks to a very basic implementation of a bloom filter, variable lookups have been sped up by a factor of 1.20 in #ArkScript !
This was as easy as storing the min and max variable IDs we had in each scope, and checking if the requested variable ID was there before trying to fetch it.
And I decided to publish the first v4 pre-release so here you go! https://github.com/ArkScript-lang/Ark/releases/tag/v4.0.0-0.1
Keep in mind this isn't a final version, expect things to change drastically, binaries to be incompatible. ArkScript v4 will enhance the language a lot, by adding new features and breaking existing ones, and the same goes for the syntax.
Implementing new functionalities on #ArkScript while listening to BardCore has become my new favorite activity
If you're looking for a sort of ambient music, without any voice over, this may be for you:
https://deezer.page.link/J4epMcvz6aCP2N3k6
It looks like the legacy parser is 3 to 47 times faster than the new one. I have a few easy optimizations in mind that could help here, but even with this performance gap, when looking at the times par iteration, this is still considered fast.
I am trying to improve the goodput nodes/sec by lowering the average backtrack count needed per node and oh god this is tough. All of this just to be able to parse some code faster.
I should eat but I had ideas while I was at work so here I am implementing them because I have a break