Give one reason why some compilers produce their final output in an intermediate language instead of machine code?
Processor code is more portable
intermediate language is a language that is used to translate between two different languages.
Translators can be either compliers, interpreters, or assemblers.
A computer system is not able to execute source code programs without the source code first being translated into machine code.
Assemblers translate assembly code to machine code
Compliers: translates code from high level language to machine code
Pro: the user does not need a translator installed already and it code does not need to be translated again - faster running time.
Con: Errors are reported at the end of the translation - Disadvantage for large programs
Compliers: translates code from high level language to machine code
Compliers
Pro: the user does not need a translator installed already and it code does not need to be translated again - faster running time.
Con: Errors are reported at the end of the translation - Disadvantage for large programs
Interpreters execute the code, compliers dont execute code.
Interpreters:
Translates and execute each line of code one by one.
Each line is syntax checked. If found the code stops.
Intepreters
Pro: This line-by-line approach allows the developer to test the program and to quickly identify errors
Cons: User must have intepreter installed first. Runs more slowly than compiled code, each time the program is run, it must be translated all over again.
Interpreters use bytecode as an intermediate stage to speed up the translation process. The code is compiled to produce bytecode which is interpreted by a virtual machine.
What is a benefit of source code being publicly available?
It allows people to test and check for errors.
How does public availability of source code enhance security?
It allows for testing to identify flaws in the software.
What are the benefits of having publicly available source code?
People can test and check for errors
Security can be tested to identify flaws
Virtual Machine (VM)
A software layer thats, responsible for executing intermediate language code.
Compliers are faster and have early error detection
Disadvantage of Assembly code 1. Harder to understand by humans 2. Takes a lot of time to code