3 ms·
I want that too - I mean to elaborate more on these aspects with real-use examples, but I guess I'm putting it off until I deal with other small issues. Regard
by stchacademy 6y ago
I want that too - I mean to elaborate more on these aspects with real-use examples, but I guess I'm putting it off until I deal with other small issues.
Regarding "homoiconicity", the way I would succintly put it is that: the line between what is considered code and what is data is super-fine. Basically, anything can be anything - depending on the context. Thus, an Arturo script can manipulate its own code, the way it can manipulate any other type of data.
Regarding Arturo's implementation: It's written in Nim (though I have written it in the past in almost every language you can think of... lol started with C++, went to D, then to Nim, back to C, and now in Nim again). Basically it's a Stack-based Bytecode Virtual Machine. And yes, Forth's influence is also important - although (intentionally) not that obvious at first sight.
The source text is parsed to an abstract structure/tree of words and symbols. That's the part that happens in translator/parse.
Then if it's an executable block, it is evaluated (as valid Arturo code) into Bytecode (this happens in translator/eval), and then this bytecode is executed by the virtual machine (in vm/exec).