Language Translators (Copy)
Cheat Sheet: A Level Computer Science – Language Translators & IDE Features
1. Need for Language Translators
Assembler
- Purpose: Translates assembly language into machine code
- Use Case: Required for low-level programming where direct hardware control is needed
Compiler
- Purpose: Translates entire high-level program into machine code before execution
- Use Case: When speed of execution is crucial (e.g., final software products)
Interpreter
- Purpose: Translates and executes line-by-line at runtime
- Use Case: Useful for development, debugging, and scripting (e.g., Python)
2. Compiler vs Interpreter
| Feature | Compiler | Interpreter |
|---|---|---|
| Translation | All at once, before running | Line-by-line during execution |
| Speed (after translation) | Fast | Slower |
| Error Detection | Detects all errors before running | Detects errors one at a time |
| Executable File | Creates standalone executable | No separate executable produced |
| Memory Usage | More efficient once compiled | Uses more during execution |
| Use Case | Final software deployment | Testing, development, small scripts |
Justification
- Use Compiler: When performance matters or offline use is needed
- Use Interpreter: When rapid prototyping or debugging is a priority
3. Hybrid Language Translators
- Example: Java
- Source code is compiled into bytecode
- Bytecode is interpreted or Just-In-Time (JIT) compiled by the Java Virtual Machine (JVM)
- Advantage: Platform independence + runtime optimization
4. Integrated Development Environment (IDE) Features
Coding Features
- Context-sensitive prompts: Auto-suggestions based on code context
- Code completion: Predicts keywords, variable names
- Syntax highlighting: Visual formatting for readability
Initial Error Detection
- Dynamic syntax checking: Flags errors in real-time during typing
- Underlining / inline hints: Highlight undefined variables, incorrect types
Presentation Features
- Prettyprint: Automatically formats code to standard indentation
- Expand/Collapse Code Blocks: Manage large code sections for readability
Debugging Tools
- Single Stepping: Execute one line at a time to trace logic
- Breakpoints: Pause execution at specific lines to inspect behavior
- Variable Watch: View current values of variables at runtime
- Expression Evaluation: Test logical or arithmetic expressions during execution
- Report Window/Console: Displays errors, outputs, and trace logs
