Professional Documents
Culture Documents
System Programming (BTCS-405A) Session:jan-May, 2018: Contents
System Programming (BTCS-405A) Session:jan-May, 2018: Contents
Session:jan-may,2018
Assignment-1
Contents:
2. Compiler
3.Assembler.
Submitted By:
Manish kumar,160280657
Group:A;
Submitted to:
Mr.malkeet Singh.
Assistant professor,CSE
A system programming language usually refers to a programming language used for system
programming; such languages are designed for writing system software, which usually requires
different development approaches when compared with application software.System software is
computer software designed to operate and control the computer hardware, and to provide a
platform for running application software. System software includes software categories such
as operating systems, utility software, device drivers, compilers, and linkers.
Features.
In contrast with application languages, system programming languages typically offer more-
direct access to the physical hardware of the machine: an archetypical system programming
language in this sense was BCPL. System programming languages often lack built-
in input/output (I/O) facilities because a system-software project usually develops its own I/O
mechanisms or builds on top of basic monitor I/O or screen management facilities. The
distinction between languages used for system programming and application programming
became blurred over time with the widespread popularity of PL/I, C and Pascal.
History.
The earliest system software was written in assembly language primarily because there was no
alternative, but also for reasons including efficiency of object code, compilation time, and ease
of debugging. Application languages such as FORTRAN were used for system programming,
although they usually still required some routines to be written in assembly language.
Mid-level languages "have much of the syntax and facilities of a higher level language, but also
provide direct access in the language (as well as providing assembly language) to machine
features."[1] The earliest of these was ESPOL on Burroughs mainframes in about 1960, followed
by Niklaus Wirth's PL360 (initially written on a Burroughs system as a cross compiler), which
had the general syntax of ALGOL 60 but whose statements directly manipulated CPU registers
and memory. Other languages in this category include MOL-360 and PL/S.
Higher-level languages.
While PL360 is at the semantic level of assembly language, another kind of system programming
language operates at a higher semantic level, but has specific extensions designed to make the
language suitable for system programming. An early example of this kind of language is
LRLTRAN,[3] which extended Fortran with features for character and bit manipulation, pointers,
and directly addressed jump tables.
Subsequently, languages such as C were developed, where the combination of features was
sufficient to write system software, and a compiler could be developed that generated efficient
object programs on modest hardware. Such a language generally omits features that cannot be
implemented efficiently, and adds a small number of machine-dependent features needed to
access specific hardware capabilities; inline assembly code, such as C's asm statement, is often
used for this purpose. Although many such languages were developed,C and C++ are the ones
that have survived.
Q2.
THE COMPILER.
ANS:
A compiler is computer software that transforms computer code written in one programming
language (the source language) into another programming language (the target language).
Compilers are a type of translator that support digital devices, primarily computers. The
name compiler is primarily used for programs that translate source code from a high-level
programming language to a lower level language (e.g., assembly language, object code,
or machine code) to create an executable program.
HISTORY.
1952 – An Autocode compiler developed by Alick Glennie for the Manchester Mark
I computer at the University of Manchester is considered by some to be the first compiled
programming language.
1952 – Grace Hopper's team at Remington Rand wrote the compiler for the A-
0 programming language (and coined the term compiler to describe it), although the A-0
compiler functioned more as a loader or linker than the modern notion of a full compiler.
1954-1957 – A team led by John Backus at IBM developed FORTRAN which is usually
considered the first high-level language. In 1957, they completed a FORTRAN compiler that
is generally credited as having introduced the first unambiguously complete compiler.
1959 – The Conference on Data Systems Language (CODASYL) initiated development
of COBOL. The COBOL design drew on A-0 and FLOW-MATIC. By the early 1960s
COBOL was compiled on multiple architectures.
1958-1962 – John McCarthy at MIT designed LISP.] The symbol processing capabilities
provided useful features for artificial intelligence research. In 1962, LISP 1.5 release noted
some tools: an interpreter written by Stephen Russell and Daniel J. Edwards, a compiler and
assembler written by Tim Hart and Mike Levin.
COMPILER CONSTRUCTION
A compiler implements a formal transformation from a high-level source program to a low-level
target program. Compiler design can define an end to end solution or tackle a defined subset that
interfaces with other compilation tools e.g. preprocessors, assemblers, linkers. Design
requirements include rigorously defined interfaces both internally between compiler components
and externally between supporting toolsets.
In the early days, the approach taken to compiler design was directly affected by the complexity
of the computer language to be processed, the experience of the person(s) designing it, and the
resources available. Resource limitations led to the need to pass through the source code more
than once.
A compiler for a relatively simple language written by one person might be a single, monolithic
piece of software. However, as the source language grows in complexity the design may be split
into a number of interdependent phases. Separate phases provide design improvements that focus
development on the functions in the compilation process.
THREE STAGE COMPILER STRUCTURE
The front end verifies syntax and semantics according to a specific source language.
For statically typed languages it performs type checking by collecting type information. If
the input program is syntactically incorrect or has a type error, it generates errors and
warnings, highlighting , them on the source code. Aspects of the front end include lexical
analysis, syntax analysis, and semantic analysis. The front end transforms the input program
into an intermediate representation (IR) for further processing by the middle end. This IR is
usually a lower-level representation of the program with respect to the source code.
The middle end performs optimizations on the IR that are independent of the CPU
architecture being targeted. This source code/machine code independence is intended to
enable generic optimizations to be shared between versions of the compiler supporting
different languages and target processors. Examples of middle end optimizations are removal
of useless (dead code elimination) or unreachable code (reachability analysis), discovery and
propagation of constant values (constant propagation), relocation of computation to a less
frequently executed place (e.g., out of a loop), or specialization of computation based on the
context. Eventually producing the "optimized" IR that is used by the back end.
The back end takes the optimized IR from the middle end. It may perform more analysis,
transformations and optimizations that are specific for the target CPU architecture. The back
end generates the target-dependent assembly code, performing register allocation in the
process. The back end performs instruction scheduling, which re-orders instructions to keep
parallel execution units busy by filling delay slots.
TYPES OF COMPILER
One classification of compilers is by the platform on which their generated code executes. This is
known as the target platform.
A native or hosted compiler is one whose output is intended to directly run on the same type of
computer and operating system that the compiler itself runs on. The output of a cross compiler is
designed to run on a different platform. Cross compilers are often used when developing
software for embedded systems that are not intended to support a software development
environment.
The output of a compiler that produces code for a virtual machine (VM) may or may not be
executed on the same platform as the compiler that produced it. For this reason such compilers
are not usually classified as native or cross compilers.
The lower level language that is the target of a compiler may itself be a high-level programming
language. C, often viewed as some sort of portable assembler, can also be the target language of
a compiler. E.g.: Cfront, the original compiler for C++ used C as target language. The C created
by such a compiler is usually not intended to be read and maintained by humans. So indent
style and pretty C intermediate code are irrelevant. Some features of C turn it into a good target
language. E.g.: C code with #line directives can be generated to support debugging of the
original source.
While a common compiler type outputs machine code, there are many other types:
Ans;
Assembler works in two passes : pass 1 and pass 2. Moreover , some high-end assemblers
provide enhanced functionality by enabling the use of control statements , data abstraction
services and providing support for object-oriented programming structures.
Future Trends of Assembler- The molecular assembler is a kind of molecular machine. It is
defined by K.Eric Drexler is a” proposed device able to guide chemical reactions by positioning
molecules with atomic precision” . The term “molecular assembler” usually refers to theoretical
human-made devices and used in science fiction and popular culture to refer to a wide range of
fantastic atom-manipulating nanomachines , many of which may be physically impossible in
reality. These include Hypothetical machines that manipulate individual atoms and machines
with organism-like self replicating abilities, mobility and so forth. Molecular assembler have
been confused with self-replicating machines. A single such theoretical molecule assembler
might be programmed to self-replicate, constructing many copies of itself . This would allow
exponential rate of production. A nanofactory is a proposed system in which nanomachines
(resembling molecules assemblers ,or industrial robot arms) would combine reactive molecules
via mechanosynthesis to build larger atomically precise part. Scientists will be able to create
molecular assembler or nano-forges that will harness the power of billions or trillions of
nanobots . These nanobots will have ability to act in unison to manufacture almost any object
from almost any row material . These nanoforges will literally have the ability of turning trash
into something useful and even turning dangerous and toxic wastes into something not harmful.
First step is to understand and create useful nanotechnologies , which is happening now. Second
step is to construct nanotechnologies as a platform to built nanobots and ability of these nanobots
would expand to be able to create any atom or molecule. These nanobots are able to built other
nanobots also. At this point, the nanobots will be able to create probably anything and
everything. These technologies is not possible but in future it is possible. Molecular assembler is
important because everything is made of atoms. That means that these molecular assemblers can
be the ultimate recycling machines. The molecular assemblers of the future would be able to-
Capture carbon dioxide (a greenhouse gas) from the atmosphere , and use the atoms to create
usable plastic or even oil
Molecular assembler are still vision which are striving to fulfill. In future we have molecular
assembler . A group of biochemists led by Simone Pisano ,created a molecular robot ,that could
selectively pick up very specific molecules , attach them to certain sites on other molecules and
repeat the action again and again. This is a very small step towards molecular assembler and in
this field a lot research is needed.
Micro-Assembler:-
It is also called meta assembler . A micro-assembler is a computer program that helps prepare a
microprogram to control the low level operation of a computer in much same way an assembler
helps prepare higher level code for a processor . The microgram defines the instruction set any
normal program (including both application programs and operating system) is written in. The
use of micro-computer allows the manufacturer to fix certain mistakes, including working
around hardware design errors, without modify the hardware . Another means of employing
micro assembler –generated micro programs is in allowing the same hardware to run different
instruction set. After it is assembled , the microprogram is then loaded to a store to become part
of the logic of a CPU’s control unit. If a given computer implantation supports a writeable
control store ,the micro assembler is usually provided to customers as a means of writing
customized microcode.
-specific instruction