Language Translators

Language Translators
Compiling Java
Java has a separate compiler and library of
modules everywhere the source code is to be
turned into machine language
Java is 'compiled' to an intermediate stage (Java bytecodes),
which are a tokenised/compressed version of the original
code. This is passed to an interpreter, Java Virtual Manager
(JVM), which is written for every platform Java is to run on.
Translated highlevel instructions that can be directly executed one by one.
Compiled programs run faster
than interpreted ones
Advantages is that the line of code
being interpreted is executed straight
Programmers normally have access to IDEs
which integrate editor, to create source code,
and debugger, to remove bugs.
Summary: Converts source code into object code that can
be executed. Compiled code can be executed without the
compiler. However, object code can't be modified but
source code that runs in an interpreter can be viewed.
What are they?
Translational program that
converts source code into object
Converting HLL into an
equivalent LLL so that it can be
Compiled object code can
be executed by the
Process of compiling
Lexical analysis
Remove all spaces and comments and look
for reserved words such as do/while/if/etc.
Compiler produces a new version of the code.
Syntax analysis
Program is checked against the syntax rules
(brackets match, do matches with while).
Syntax errors are reported.
Code generation
The machine code that will be run by the
computer is created. Any standard library
functions are linked into the final compiled
Compiler needs to be loaded into memory. Compiled code usually
executes faster than an interpreted version of the same program.
Can be moved across computers, however, source code cannot and
may need some changes to be made.
Compiler vs Interpreter:
Interpreter analyzes and executes each line of source code in
succession without looking at the entire program while a
compiler creates a completely new program that is executed.
It does not stop at the first error and just reports the errors.
High-level vs Low-level
High level
One instruction = many
machine code instructions
Portable, taskoriented
More englishlike
Low level
One instruction = one machine
code instruction
Machine specific, machineoriented
Less easy to write and debug
High-level language translators
2 types of computer languages
Lowlevel language
Highlevel language
Hardware only runs on machine code, which is
represented by the 1's and 0's of binary code. Electrical
circuits and magnetic storage devices only recognize this
Also known as Assembly Language. Each
line of an assembler program corresponds
to one of the machine code. However, one
Highlevel language statement usually
translates into many machine code
They are portable (be able to
run on different machines)
Englishlike/Easier to understand
Different languages are
developed for different tasks
FORTRAN(FORmula TRANslation Language)
intended for mathematical and scientific
COBOL(Common BusinessOriented
Language) for developing business and
dataprocessing applications.
ALGOL(ALGOrithmic Language) introduced
structured programming and led to the
development of C and Pascal.
BASIC(Beginners Allpurpose Symbolic
Instruction Code) gave many an easy
introduction to programming
Object Orientated Languages (SMALLTALK,
C++ and Java) have taken structured
programming one step further.
Define Syntax
and Semantics
The rules that govern how statements in
computer programming language must be
Incorrectly spelling a keyword
Using the wrong brackets
Leaving off the matching bracket
Leaving off the end statement symbol (;)
The meaning conveyed by a
collection of staments.
It is possible to write a syntactically correct
statement that would be semantically
A computer can detect syntax errors. For example word
processor checking spelling mistakes or a software compiler
checking for syntax error. However, computers will never
know the semantic meaning of what was written or
Software Development Tools
Make the development of
certain software easier.
HTML Editor
Enables web pages to be created without
needing to know or remember the syntax of a
range of HTML instructions.
Data Base Management Systems enable database to be
created without needing to write specific code. Enable data
dictionaries and files to be created, manages data, creates
CASE Tools
Computer Aided Software Engineering enable
stages of system development cycle to be
implemented and managed in an integrated
Tools include: summarizing initial
requirements, developing flow diagrams,
scheduling tasks, preparing documentation,
Developed by recording a series of keystrokes which can
be referenced later. Referencing may be provided by
using a set of keystrokes, known as 'shortcut keys'.
Saves time and effort by automating repetitive