Types of programming language, translators and integrated development environments (IDEs)
High-Level Languages:
- Advantages: Easier to read, write, and debug; portable across different hardware; programmer focuses on logic rather than memory addresses.
- Disadvantages: Slower execution speed; requires more memory; needs a translator (compiler/interpreter).
Low-Level Languages:
- Advantages: Fast execution speed; efficient use of hardware resources; allows direct control over system components.
- Disadvantages: Difficult to write and debug; not portable (hardware-specific); time-consuming to develop.
ADD, MOV, LDA) to represent machine code instructions. Because each mnemonic corresponds directly to a specific binary instruction understood by the CPU, it is classified as low-level.| Feature | Compiler | Interpreter |
|---|---|---|
| Translation Process | Translates the entire source code into machine code at once before execution. | Translates and executes the source code line-by-line (or statement-by-statement). |
| Output | Produces a separate executable file (e.g., .exe) that can be run independently. | No separate executable file is produced; the source code must remain available for execution. |
| Error Reporting | Checks all code for errors before running. Produces a full error report listing all syntax errors found. | Stops execution immediately when the first error is encountered. Reports only that single error. |
| Execution Speed | Faster at runtime because the code is already in machine language. | Slower at runtime due to the overhead of translating each line during execution. |
Correct Phrasing for Compiler: 'A compiler translates the entire source code into machine code before execution begins. It checks for syntax errors throughout the whole program and produces an error report if any are found.'
Reasoning: Examiners look for the keywords 'entire code', 'before execution', and 'executable file' to confirm you understand the batch-processing nature of compilation.
Reasoning: Examiners accept this because it highlights the sequential nature of interpretation and the immediate feedback loop, which distinguishes it from the batch processing of compilers.
Mistake: Stating that 'Interpreters produce faster running code' or 'Compilers are easier to debug because they stop at the first error.'
Correction:
- Compilers produce faster running code because the translation happens once, ahead of time.
- Interpreters are often considered easier for initial debugging because they pinpoint the exact line where execution stops, but Compilers provide a comprehensive list of all errors at once, which can be useful for fixing multiple issues simultaneously.
Correction: Computers only understand machine code (binary). High-level languages must always be translated by a translator (compiler or interpreter) before the CPU can execute them.
| Function | Description |
|---|---|
| Code Editor | A text editor with features like syntax highlighting (color-coding keywords), auto-completion, and pretty-printing to make code easier to read and write. |
| Compiler/Interpreter | Built-in translators that allow the programmer to compile or run the code directly from the IDE without switching applications. |
| Debugger | Tools to help find and fix errors, such as setting breakpoints (stopping execution at a specific line) and inspecting variable values. |
| Error Diagnostics | Real-time checking of code for syntax errors as the programmer types. |
Correct Phrasing: Use specific technical terms: 'Syntax highlighting', 'Auto-completion', 'Built-in compiler/interpreter', 'Debugger', 'Error diagnostics', and 'Pretty-printing'.
Reasoning: Examiners award marks for precise terminology. 'Syntax highlighting' is accepted because it directly describes the visual aid that distinguishes code elements by color, aiding readability.