This section looks at computer languages from human readable languages (High level languages) such as Java to Machine Code (Low Level Languages) . This section also looks at the role of operating systems such as Android, Linux and Windows.
HIGH LEVEL LANGUAGE
A high-level programming language is a type of computer programming language that provides a high level of abstraction from the computer's hardware. This means that the programmer does not need to worry about low-level details such as memory management and error handling, as these tasks are handled automatically by the language. Examples of high-level languages include Python, Java, and C++. They are easier to read, write and maintain compared to low-level languages and provide a higher level of abstraction, making them more suited for general-purpose programming tasks. High-level languages are widely used for developing applications such as web development, data analysis, and desktop applications. They provide a more user-friendly interface and offer higher productivity, since the programmer can focus on the logic and functionality of the program, rather than the underlying hardware. Overall, high-level languages provide a higher level of abstraction and make it easier to write and maintain code, but may have performance trade-offs compared to low-level languages, and have less control over the system's hardware. Before a High level language will run it needs to go through a complier or interpreter, these will check the code for syntax errors and converts the code ready to run.
LOW LEVEL LANGUAGE
A low-level programming language is a type of computer programming language that provides minimal abstraction from the computer's hardware. This means that the programmer must perform many tasks, such as memory management and error handling, that are usually handled automatically by higher-level languages.
Examples of low-level languages include Assembly language and Machine code. They are closer to the binary code that the computer's processor executes and offer more direct control over the computer's hardware, but are more difficult to read, write and maintain than higher-level languages.
Low-level languages are generally used in specialized applications such as system programming, operating system development, device drivers, or embedded systems programming, where the low-level control is necessary for performance or specific hardware interactions.
Overall, low-level languages provide a closer interaction with the computer's hardware and offer more control over the system, but require more time and effort from the programmer and can be more error-prone compared to higher-level languages.
There are two main types of software error that you should be aware of as a programmer, syntax errors and runtime errors.
SYNTAX ERRORS - A syntax error is when there is a problem with the structure of content of the code, for example if you miss a bracket or have the wrong indentation. Syntax errors are usually detected before the program is run.
RUNTIME ERRORS - Are error that occur as the program is running, for example your program might be expecting the user to enter a number but instead a letter is entered, unless your program accommodates this scenario then a runtime error will occur and your program might crash. Runtime errors are not checked before the program is run.
Translators convert High level languages into machine code. When you code a Complier or Interpreter will translate your code. Another type of translator is an Assembler.
A compiler is a program that translates source code written in a high-level programming language into machine code (binary code) that can be executed by a computer. The compiler checks the source code for errors and then generates an executable file that can run on the target system. It performs tasks such as syntax checking, code optimization, and memory management. Compilers play a critical role in software development by allowing developers to write high-level code that is easy to read and maintain, while still executing efficiently on the target system.
An interpreter is a program that executes instructions written in a high-level programming language, one line at a time, rather than compiling the code into machine code before execution. Unlike compilers, interpreters don't generate an executable file, they directly execute the code. Interpreters can be used to test code snippets quickly and easily, or to run code on systems where compiling is not possible or practical. However, interpreted code generally runs slower than code that has been compiled, since the interpreter must parse and execute the code every time it is run. Overall, interpreters provide a more flexible and interactive development environment, but have a performance trade-off compared to compilers.
An assembler is a program that translates assembly language code into machine code (binary code) that can be executed by a computer. Assembly language is a low-level programming language that consists of mnemonics (abbreviated codes) representing machine instructions and symbols representing memory locations. The assembler replaces these mnemonics with the corresponding machine code and generates an executable file. The main advantage of using an assembler is that it allows for direct control of the underlying hardware and offers a level of performance that is not possible with higher-level programming languages. However, assembly language code is difficult to write, read, and maintain, and is generally only used in specialized applications where the performance benefits outweigh the additional development effort required. Overall, an assembler is a tool that provides a bridge between the human-readable assembly language and the machine-executable machine code, allowing developers to write code that is closer to the underlying hardware. An assembler converts/assembles assembly language to machine code. For example the assembly instruction LDA which loads the accumulator with the content from memory could be LDA 255 would be converted by the assembler to the binary for example: 10101001 11111111
When a program is finished it will often have various modules and objects attached to it, the role of the linker is to combine all elements of a program into one file, the executable file. There is also a dynamic linker/linking which can link during runtime, this can work by placing a link to a programs module within the program.
What is the difference between a compiler and an interpreter?
Can you give an example of a programming language that uses a compiler?
How does a compiler translate source code into machine code?
Why might someone choose to use an interpreter instead of a compiler?
What is the difference in execution time between compiled and interpreted code?
How does dynamic typing impact the difference between compiling and interpreting code?