3 ms·
Ok, I'll be the slow witted one in the room - When creating your own language, what did you write it in? If you're using Java or C, are you still using it's com
by laserDinosaur 14y ago
Ok, I'll be the slow witted one in the room - When creating your own language, what did you write it in? If you're using Java or C, are you still using it's compiler but coming up with your own syntax? I'm a little confused how it worked.
- dazzawazza 14y agoGood question. You can write a language in any other language. Say you create a language called LASERD and chose to write it in C: You write a program in C that is able to transform LASERD source files in to a form that it can interpret and then execute. One way to do this is to create a simple virtual machine as part of your C program that is sort of like a virtual CPU (with registers, pretend memory and simple opcodes like ADD, SUBtract, MOVe etc. The C program takes the LASERD source file interprets the syntax and generates code that can 'run' on the virtual CPU. This is basically how Lua, Python, Ruby, Java etc work. Does that make sense?
- dovyski 14y agoIt makes sense to me. Even though this is the "right" way of creating an "interpreted" language, the assignment I asked my students was way more simple: they had to interpret the source code and react to it immediately. There was no intermediate instructions (such as Java byte-code).
- laserDinosaur 14y agoAwesome, thanks for the explanation :)