4 ms·
Let's put it this way: if a program translates code written in a "smarter" language into code written in a "stupider" language, then it is okay to call it a com
by orthoxerox 1y ago
Let's put it this way: if a program translates code written in a "smarter" language into code written in a "stupider" language, then it is okay to call it a compiler.
If it translates a restricted subset of BASIC into Go, it doesn't really do anything beyond replacing one syntax with another.
- vrighter 1y ago"Smarter" and "stupider" are completely subjective terms. It translates one language into another, while maintaining logical correctness and its original semantics. Some cases are easier to do than others, but it doesn't change the nature of what is being done: language translation. It isn't as simple as you think. Ex. in basic, the goto statement allows you to jump from anywhere to anywhere. Go has restrictions, such as it may not jump over variables coming into scope (being declared), nor can it jump into another scope, only outwards. So, for starters, this probably needs to scan the BASIC code for variables and hoist everything to the top as well as rewrite any code where it is trying to jump into a deeper scope (ex. jump from the topmost scope of a function into the body of a for loop). Yes, it is a compiler. Maintaining semantics.