I am curious as how cross-compilers such as Pyjamas work. Do they simply have a list keywords and line by line replacing each word with the translated code? I want to understand.
I apologize for my ignorance, I am just curious.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no one universal answer that always works, but typically a language-to-language translator works in much the same way that a compiler does – it reads in the source code, builds up an internal representation of the program, then emits code in a target language. The key difference between a normal compiler and a cross-compiler, though, is that a normal compiler usually outputs assembly (or some sort of bytecode), while a cross-compiler usually outputs constructs in a different programming language.
If you want to learn more about the key techniques involved in building such translators, you might want to read up on general compiler construction techniques. It’s really cool!
Hope this helps!