Professional Documents
Culture Documents
16
be transferred to new hardware in a control room – the old software would
run as an emulation on the new hardware (justifying the cost and complexity
issues – see Limitations).
Virtual machines are useful for testing a new OS or new app since they will
not crash the host computer if something goes wrong (the host computer is
protected by the virtual machine software).
Limitations
16 System software and virtual machines
You do not get the same performance running as a guest OS as you do when
running the original system.
Building an in-house virtual machine can be quite expensive for a large
company. They can also be complex to manage and maintain.
Key terms
Lexical analysis – the first stage in Backus-Naur form (BNF) notation –
the process of compilation: removes a formal method of defining the
unnecessary characters and tokenises grammatical rules of a programming
the program. language.
Syntax analysis – the second stage Syntax diagram – a graphical method of
in the process of compilation: output defining and showing the grammatical
from the lexical analysis is checked for rules of a programming language.
grammatical (syntax) errors. Reverse Polish notation (RPN) – a
Code generation – the third stage in method of representing an arithmetical
the process of compilation: this stage expression without the use of brackets
produces an object program. or special punctuation.
Optimisation (compilation) – the fourth
stage in the process of compilation: the
creation of an efficient object program.
394
object code
With an interpreter, the program source code is similarly input; there may also
be other inputs that the program requires or to correct errors in the source
program. No object code is output, but error messages from the interpreter
are output, as well as any outputs produced by the program being interpreted.
As there is no object code produced from the interpretation process, the
interpreter will need to be used every time the program is executed.
source code
error messages
error
INTERPRETER
corrections
program output
program input
▲ Figure 16.20
Both a compiler and an interpreter will construct a symbol table (see next
section for details). An interpreter will also allocate space in memory to store any
constants, variables and other data items used by the program. The interpreter
checks each statement individually and reports any errors, which can be corrected
before the statement is executed. After each statement is executed, control is
returned to the interpreter so the next statement can be checked before execution.
Lexical analysis
Lexical analysis is the first stage in the process of compilation. All unnecessary
characters not required by the compiler, such as white space and comments, are
removed.
395