1.3 Hardware and software

1.3.7 High- and low-level languages and their translators Software is created by using a computer language to set out a set of instructions that the computer will follow. There are many computer languages but they do share some common features. This mini-web takes you through some of these features.

HIGH LEVEL AND LOW LEVEL LANGUAGES A high-level language is an advanced computer programming language that isn't limited by the computer, designed for a specific job, and is easier to understand. Today, there are dozens of high-level languages; some examples include BASIC, C, FORTAN, Java, C++ and Pascal. These are independent of the internal machine code of any particular computer. High-level languages are used to solve problems and are often described as problem-oriented languages; a low-level language is the opposite of a HighLevel Language. It is one which exposes a significant amount of the computer's inner workings; for instance, in C Language, one deals with the concept of memory and pointers, whereas in HaskellLanguage, there is no concept of storing data. This aspect of C Language is lowlevel. The lowest-level language is Machine Code, which hides no details of the machine; not even the bit patterns used to form instructions are abstracted. Low-level languages have the advantage that the programmer is able to tune the code to be smaller or more efficient, and that more system-dependent features are sometimes available. They have the disadvantage that they are often (usually?) harder to program in. In computing, a low-level programming language is designed for a particular computer and reflects its internal MachineCode; low-level languages are therefore often described as machine-oriented languages. They cannot easily be converted to run on a computer with a different central processing unit, and they are relatively difficult to learn because a detailed knowledge of the internal workings of the computer is required. Since they must be translated into machine code by an assembler program, low-level languages are also called AssemblyLanguages. A mnemonic-based low-level language replaces binary machine-code instructions, which are very hard to remember, write down, or correct, with short codes (mnemonics) chosen to remind the programmer of the instructions they represent. For example, the binary-code instruction that means ‘store the contents of the accumulator’ may be represented with the mnemonic STA (Store to Accumulator). In contrast, high-level languages are designed to solve particular problems and are therefore described as problem-oriented languages: for example, BASIC was designed to be easily learnt by first-time programmers; COBOL is used to write programs solving business problems; and FORTRAN is used for programs solving scientific and mathematical problems.

WHY USE COMPILERS? A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer’s processor uses. Typically, a programmer writes Page 1 of 4

1.3 Hardware and software

1.3.7 High- and low-level languages and their translators language statements in a language such as Pascal or C one line at a time using an editor. The file that is created contains what are called the source statements. The programmer then runs the appropriate language compiler, specifying the name of the file that contains the source statements. When executing (running), the compiler first parses (or analyzes) all of the language statements syntactically one after the other and then, in one or more successive stages or "passes", builds the output code, making sure that statements that refer to other statements are referred to correctly in the final code. Traditionally, the output of the compilation has been called object code or sometimes an object module. (Note that the term "object" here is not related to object-oriented programming). The object code is machine that the processor can process or "execute" one instruction at a time. More recently, the Java programming language, a language used in object-oriented programming , has introduced the possibility of compiling output (called byte code ) that can run on any computer system platform for which a Java virtual machine or byte code interpreter is provided to convert the byte code into instructions that can be executed by the actual hardware processor. Using this virtual machine, the byte code can optionally be recompiled at the execution platform by a just-in-time compiler . Traditionally in some operating systems, an additional step was required after compilation - that of resolving the relative location of instructions and data when more than one object module was to be run at the same time and they cross-referred to each other's instruction sequences or data. This process was sometimes called linkage editing and the output known as a load module. A compiler works with what are sometimes called 3GL and higher-level languages. An assembler works on programs written using a processor's assembler language.

Page 2 of 4

1.3 Hardware and software

1.3.7 High- and low-level languages and their translators USING INTERPRETERS AS A MEANS OF TRANSLATION An Interpreter is a program that implements or simulates a virtual machine using the base set of instructions of a programming language as its machine language. You can also think of an Interpreter as a program that implements a library containing the implementation of the basic instruction set of a programming language in machine language. An Interpreter reads the statements of a program, analyzes them and then executes them on the virtual machine by calling the corresponding instructions of the library. Interactive interpreter session During an interactive interpreter session the statements are not only read, analyzed and executed but the result of the evaluation of an expression is also printed. This is also called a READ - EVAL - PRINT loop. ASSEMBLERS A utility program called an assembler is used to translate assembly language statements into the target computer's machine code. The assembler performs a more or less isomorphic translation (a one-to-one mapping) from mnemonic statements into machine instructions and data. This is in contrast with high-level languages, in which a single statement generally results in many machine instructions. Many sophisticated assemblers offer additional mechanisms to facilitate program development, control the assembly process, and aid debugging. In particular, most modern assemblers include a macro facility and are called macro assemblers.

Page 3 of 4

1.3 Hardware and software

1.3.7 High- and low-level languages and their translators

What happens in the CPU when an Interrupt is generated during a fetch execute cycle? We have just said that 'An interrupt is a signal for the CPU to stop what it is doing and instead carry out the interrupt task, once the task is complete, the CPU goes back to what it was doing'. But what is meant by 'back to what it was doing'? To appreciate this, you need to understand a little about what goes on inside a CPU. A CPU contains a number of 'registers'. A register is a small section of on-chip memory having a specific purpose. Registers range from 8 bits wide on an 8 bit CPU to 64 bits and beyond. Registers in the CPU hold all of the data currently being handled. These include The current instruction being executed (Instruction Register), The location in primary memory of the next instruction (Program Counter) A number of general purpose registers holding current data The registers are updated by each tick of the system clock so at any instant in time, they hold specific values. When an interrupt comes along, all the register values are copied to a special data structure or memory area called the 'stack' which is in primary memory. And they stay in the stack whilst the CPU starts executing the interrupt service routine (ISR). Once the routine is over, the registers are loaded back with their original values from the stack and can continue with what they were doing before the interrupt came along. This jumping of instructions from current CPU operations to the ISR and then back again is called 'context switching'

Page 4 of 4

1.3.7 High- and low-level languages and their translators.pdf ...

An Interpreter reads the statements of a program, analyzes them and then executes them on the virtual. machine by calling the corresponding instructions of the ...

99KB Sizes 3 Downloads 206 Views

Recommend Documents

High-quality InGaN/GaN heterojunctions and their ...
4Department of Electronic Engineering, Chang-Gung University, Taoyuan 333, ... high-performance photovoltaic cells with open-circuit voltage of around 2.1 eV ...

High-quality InGaN/GaN heterojunctions and their ...
8, the au- thors experimentally demonstrated the photovoltaic effect .... other hand, the bright-field TEM image can support this point as shown in the inset of Fig.

Languages and Compilers
Haaften, Graham Hutton, Daan Leijen, Andres Löh, Erik Meijer, en Vincent Oost- indië. Tenslotte willen we van de gelegenheid gebruik maken enige studeeraanwijzingen te geven: • Het is onze eigen ervaring dat het uitleggen van de stof aan iemand a

Alphabets, Strings, and Languages - GitHub
If Σ = {a, b}, then. Σ = {ε, a, b, aa, ab, ba, bb, aaa, aab, aba, . . .} . ..... We shall now take this concept and develop it more carefully by first defining ... Moreover, only strings that can be constructed by the applications of these rules a

western civilization their history and their culture pdf
Page 1 of 1. File: Western civilization their history. and their culture pdf. Download now. Click here if your download doesn't start automatically. Page 1 of 1. western civilization their history and their culture pdf. western civilization their his

Languages and corporate savings behavior
Aug 2, 2017 - It has recently been shown that heterogeneity in languages explains the .... While there is little evidence to support the strong form (e.g., Chomsky, 1957 ..... 365. 0.084. South Africa. 293. 2089. 0.115. South Korea. 1163. 5702.

PDF Online Languages and Machines
Theory of Computer Science (3rd Edition) - PDF ePub Mobi - By .... theoretical concepts and associated mathematics are made accessible by a "learn as you go".

Return-Oriented Programming: Systems, Languages, and Applications
systems, has negative implications for an entire class of security mechanisms: those that seek to prevent malicious ... understood that W⊕X is not foolproof [Solar Designer 1997; Krahmer 2005; McDonald. 1999], it was thought to be a ..... The remai

Overcoming the Multiplicity of Languages and ... - CiteSeerX
inlined inside the HTML code using a special tag to fit the declarative and ... 2. The QHTML Approach. QHTML1 provides an integrated model in the form of a set ...

Read PDF Languages and Machines
... in information design The app is certainly a relic from a time when the casual ... Shkreli wrote to me after I asked if he thought his Astronomers doctors and ...

Overcoming the Multiplicity of Languages and ... - CiteSeerX
side events. Server side-scripts in both ASP and PHP are also inlined with ..... Mehl, M.: The Oz Virtual Machine - Records, Transients, and Deep Guards. PhD.

Page 1 Programming Languages Design and Implementation ...
Include. C. ) software simulation. : (. ) .... software simulation. (. ). 24 я я я ...... SiP j i. C. SB. SA. S end i output y output xx j begin integer j char y integer. xP ... Global param begin param integer param. SuB procedure. List array. In

Languages, Politics and Education
would be the matters to discuss, about languages, in Communist University ... Of course, this may mean that less people read or hear what the contributor is.