2.5 Programming Languages and IDEs Flashcards
What is machine code?
- Binary representation of instructions in a format that the CPU can decode and execute
- Have operation code instruction and address or data to use
What are low level languages?
- Written in Assembly language
- Translated by an assembler into machine code
What are low level languages used for?
- Used for embedded systems and device drivers where instructing hardware directly is necessary
What are some features of low level languages?
- Harder to write and understand
- Memory efficient
- Fast to execute
What are high level languages?
- Source code written in languages such as Python, C++, Java, Visual Basic
What are high level languages translated by?
- Translated by compiler or interpreter into machine code
What does one source code instruction in a high level language translate to?
- Translates to many machine code instructions
Features of High level languages?
- Quicker and easier to understand and write
- Less memory efficient
- Could be slower to execute if not optimised
What does a compiler do?
- Translates source code from high level languages into object code and then into machine code ready to be processed by the CPU
- Whole program is translated to machine code before it is run
What are the advantages of a compiler?
- No need for translation software at run-time
- Speed of execution is faster
- Code is usually optimised
- Original source code kept secret
What are the disadvantages of a compiler?
- Program won’t run with syntax errors, making it more difficult to write the code
- Code needs to be recompiled when it is changed
- Designed for a specific type of processor
What does an interpreter do?
- Translates source code from a high level language into machine code ready to be processed by CPU
- Program is translated line by line while running
What are the advantages of an interpreter?
- Easy to write source code as it’s always running, stopping when finding a syntax error
- Code doesn’t need to be recompiled when changed
- Interpreted languages made very easy for beginner programmers
What are the disadvantages of an interpreter?
- Translation software is needed at run time
- Speed of execution is slower
- Code not optimised
- Source code needed
What functions do IDEs provide?
- Debugging tools for finding logic errors
- Help with preventing and identifying syntax errors
- Providing a run time environment
- Usability functions
How does an IDE help debug tools for finding logic errors?
- Breakpoints - stopping program at line of code during execution
- Stepping through lines of code one at a time to check which lines are executing
- Tracing through a program to output values of variables
How does an IDE help with preventing and identifying syntax errors?
- Illustrating keyword syntax and auto completing command entry
- Error highlighting
- Compiler producers an output of the error message to help identify it
How does an IDE provide a run time environment?
- Output window
- Simulating different devices the program can run on
What usability functions does an IDE provide?
- Navigation, showing/hiding sections of code
- Formatting source code
- Find and replace
- Comment or indent regions