#languageprogramming — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #languageprogramming, aggregated by home.social.
-
I'm still designing my language.
Why not just introduce RegExps into pointers?
int *a; /* nonnull pointer to single int */
int *?a; /* can-be-null pointer to single int */
int +a; /* nonnull pointer to array begining */
int +?a;Isn't using the nonnull __attribute__ a bit long?
Now yes, I don't see the point of + and +?, but there is the 'array of unspecified length' syntax:
int *argv[];
so why not?#programming #languageprogramming #c #pointers #regex #regexHumor #humor #becauseWhyNot
-
A finite while loop succeded:
var g := 5; while (g) g -= 1;
I'm steadily moving forward.
Next I'll fix my compiling which still doesn't support the 'if' conditional statement. -
Now I see that it's too hard to both execute and compile at the same time, so my #assembly is still in bits and pieces, but it slowly takes some shape.
In the mean time I continue with the 'while' loop. -
It was a lot of work to convert the std::vector to mmap(), but it's done now! Now I have a little problem with con/destruction, as is often the case in #cpp: when pushing smth to the stack I need to use the placement new:
sp --; new (sp) Expression{...};
Otherwise operator= tries to destruct the dummy-initialized std::string inside Expression.
And also I need to destruct Expression if I don't want memory leaks from the constructed std::string. -
Should I use a kernel-handled memory arena for my language's stack now, or later?
I will need it any way, when #compiling to #assembly.I mean using MAP_GROWSDOWN and MAP_STACK flags for mmap(2) syscall.
[1/2] #programming #languageprogramming #doitmyself #diy #askfedi
-
Local variables done!
And also I'm entering the 3rd phase of my source structure: I'm breaking smaller, single-purpose functions out of my main loop. It makes the code clear and allowes to call these fcns from different parts of my program. And it's another step to make an interpreted language compilable... ;) -
The next thing in my interpreted #programming language will be local variables, since the 'if' works. I can either leave the object definition on the interpreter's stack or have them defined outside the stack, associated with the block in which they're defined.