Languages and Translators Flashcards
What is a high-level language?
A language that is programmer friendly. It is easy for humans to understand, debug and maintain
What type of translator does a HL language need?
Needs a compiler or interpreter to translate into machine code
What are some examples of HL languages?
Python
JavaScript
C#
C++
Ruby
What are the advantages of HL languages?
Hardware independent; can run on any system and are easily portable from one device to another
Little to no hardware knowledge is required to write programs
Syntax very similar to English language, therefore easier to write, understand and debug
What are the disadvantages of HL languages?
Not memory efficient -> consumes more memory than LL languages
Must be compiled/interpreted before it can be run
What is a low-level language?
A language that is machine-friendly. It is difficult for humans to understand, but easy for a machine to interpret
What type of translator do LL languages require?
Needs an assembler for direct translation of the language instructions
What are the examples of LL languages?
Machine language
Assembly language
What are the advantages of LL languages?
Memory efficient
Execute very quickly
What are the disadvantages of LL languages?
Hard for humans to read and knowledge of hardware is a prerequisite to write programs
Very machine-dependent and not portable between different devices
What is machine code?
Binary representation of instructions in a format that the CPU can decode and execute
What are the three types of translators?
Compiler
Interpreter
Assembler
What does an Assembler do?
Translates assembly language into machine code
Converts basic commands and operations into binary code that can be understood by a specific type of processor
What are the advantages of Assemblers?
Programs written in machine language can be replaced with mnemonics
Memory efficient
Speed of execution is faster
Hardware-oriented
What are the disadvantages of Assemblers?
Takes a long time to write the program and it is difficult to remember syntax
Lack of portability between computers of different makes can not have the same assembler
What does a compiler do?
Translates source code from HL languages into object code and then machine code
The whole program is translated into machine code before it is run
After compilation, the compiler provides an error report for the whole code
What are the advantages of Compilers?
No need for translation when running
Speed of execution is faster than interpreted code
Provides an executable file so that the original code doesn’t need to be compiled again
What are the disadvantages of Compilers?
The program will not run with syntax error, which makes it more difficult to write long code
Code needs to be recompiled when it is changed
What is an Interpreter?
Translates source code from HL languages into machine code
The program is translated line by line as it runs
Stops execution as soon as an error is found
What are the advantages of Interpreters?
Easy to write source code, as the program will always stop when it finds a syntax error
Code does not need to be recompiled when code is changed
Easier for beginner programmers to learn to code
What are the disadvantages of Interpreters?
The interpreter must be installed to run the program
Takes longer to execute as the instruction is translated before it is executed
Source code will be interpreted every time it is run
Which HL languages are interpreted?
Python and JavaScript
Which HL languages are compiled?
C# and VB