Skip to content

9618 · 5.2

Language Translators — FAQ

Frequently asked questions for 9618 Language Translators. Direct answers first, then deeper explanation — then practise with marking.

Can a language be both compiled and interpreted?

Yes, this is common in hybrid systems. A prime example is Java. Java source code is first compiled into a platform-independent intermediate code called 'bytecode'. This bytecode is then run on any device that has a Java Virtual Machine (JVM). The JVM acts as an interpreter for the bytecode, translating it into native machine code for the specific processor it's running on.

If compiled code is faster, why does anyone use interpreters?

Interpreters offer significant advantages during the development phase. The rapid feedback loop (write code, run instantly, see error on the exact line) makes debugging much faster. This flexibility and ease of testing often outweigh the performance penalty for many applications, especially in web development, scripting, and data analysis where development speed is a priority.

What happens during syntax analysis if the code is wrong?

If the syntax analyser (parser) receives a stream of tokens that violates the language's grammar rules, it cannot build a valid parse tree. At this point, it will halt the compilation process and generate one or more syntax error messages, which are then reported to the programmer. For example, a missing semicolon or mismatched brackets would be caught at this stage.