coms241+unit+i+additional+reference
TRANSCRIPT
-
8/3/2019 COMS241+Unit+I+Additional+Reference
1/11
COMS 241: SYSTEM SOFTWARE & OPERATING SYSTEMS
UNIT I: System Software Concepts(Additional Reference)
Assembler
Assembly languages are a type of low-level languages for programming computers,
microprocessors, microcontrollers, and other (usually) integrated circuits. They implement a
symbolic representation of the numeric machine codes and other constants needed to program aparticular CPU architecture. This representation is usually defined by the hardware
manufacturer, and is based on abbreviations (called mnemonics) that help the programmer
remember individual instructions, registers, etc. An assembly language family is thus specificto a certain physical (or virtual) computer architecture. This is in contrast to most high-level
languages, which are (ideally)portable.
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 isomorphictranslation (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 (described below), and are called macro assemblers.
Compare with:Microassembler.
Typically a modern assembler creates object code by translating assembly instructionmnemonics into opcodes, and by resolving symbolic names for memory locations and other
entities.[1] The use of symbolic references is a key feature of assemblers, saving tedious
calculations and manual address updates after program modifications. Most assemblers also
include macro facilities for performing textual substitutione.g., to generate common shortsequences of instructions as inline, instead of called subroutines, or even generate entire
programs or program suites.
Assemblers are generally simpler to write than compilers forhigh-level languages, and havebeen available since the 1950s. Modern assemblers, especially for RISC based architectures,
such as MIPS, Sun SPARC, and HP PA-RISC, as well as x86(-64), optimize instruction
scheduling to exploit the CPU pipelineefficiently.
There are two types of assemblers based on how many passes through the source are needed toproduce the executable program.
One-pass assemblers go through the source code once and assumes that all symbols will
be defined before any instruction that references them.
http://en.wikipedia.org/wiki/Low-level_languagehttp://en.wikipedia.org/wiki/Computerhttp://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Integrated_circuithttp://en.wikipedia.org/wiki/Integrated_circuithttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/Mnemonic#Assembly_mnemonicshttp://en.wikipedia.org/wiki/Instruction_(computer_science)http://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/Portinghttp://en.wikipedia.org/wiki/Utility_programhttp://en.wikipedia.org/wiki/Isomorphismhttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Microassemblerhttp://en.wikipedia.org/wiki/Microassemblerhttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/Identifierhttp://en.wikipedia.org/wiki/Assemblers#cite_note-0http://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Inline_expansionhttp://en.wikipedia.org/wiki/Inline_expansionhttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/RISChttp://en.wikipedia.org/wiki/MIPS_architecturehttp://en.wikipedia.org/wiki/MIPS_architecturehttp://en.wikipedia.org/wiki/SPARChttp://en.wikipedia.org/wiki/PA-RISChttp://en.wikipedia.org/wiki/X86http://en.wikipedia.org/wiki/X86-64http://en.wikipedia.org/wiki/Instruction_schedulinghttp://en.wikipedia.org/wiki/Instruction_schedulinghttp://en.wikipedia.org/wiki/Instruction_schedulinghttp://en.wikipedia.org/wiki/CPU_pipelinehttp://en.wikipedia.org/wiki/CPU_pipelinehttp://en.wikipedia.org/wiki/Low-level_languagehttp://en.wikipedia.org/wiki/Computerhttp://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Integrated_circuithttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/Mnemonic#Assembly_mnemonicshttp://en.wikipedia.org/wiki/Instruction_(computer_science)http://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/Portinghttp://en.wikipedia.org/wiki/Utility_programhttp://en.wikipedia.org/wiki/Isomorphismhttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Microassemblerhttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/Identifierhttp://en.wikipedia.org/wiki/Assemblers#cite_note-0http://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Inline_expansionhttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/RISChttp://en.wikipedia.org/wiki/MIPS_architecturehttp://en.wikipedia.org/wiki/SPARChttp://en.wikipedia.org/wiki/PA-RISChttp://en.wikipedia.org/wiki/X86http://en.wikipedia.org/wiki/X86-64http://en.wikipedia.org/wiki/Instruction_schedulinghttp://en.wikipedia.org/wiki/Instruction_schedulinghttp://en.wikipedia.org/wiki/CPU_pipeline -
8/3/2019 COMS241+Unit+I+Additional+Reference
2/11
Two-pass assemblers (and multi-pass assemblers) create a table with all unresolved
symbols in the first pass, then use the 2nd pass to resolve these addresses. The
advantage of a one-pass assembler is speed, which is not as important as it once waswith advances in computer speed and capabilities. The advantage of the two-pass
assembler is that symbols can be defined anywhere in the program source. As a result,
the program can be defined in a more logical and meaningful way. This makes two-passassembler programs easier to read and maintain.[2]
More sophisticated high-level assemblers provide language abstractions such as:
Advanced control structures
High-level procedure/function declarations and invocations
High-level abstract data types, including structures/records, unions, classes, and sets Sophisticated macro processing (although available on ordinary assemblers since late
1960s forIBM/360, amongst other machines)
Object-Oriented features such as encapsulation,polymorphism, inheritance,interfaces
Assembly language
A program written in assembly language consists of a series of instructions--mnemonics that
correspond to a stream of executable instructions, when translated by an assembler, that can beloaded into memory and executed.
For example, an x86/IA-32 processor can execute the following binary instruction ('MOV') as
expressed in machine language (see x86 assembly language):
Hexadecimal: B0 61 (Binary: 10110000 01100001)
The equivalent assembly language representation is easier to remember (example in Intel
syntax, more mnemonic):
MOV AL, 61h
This instruction means:
Move (really a copy) the hexadecimal value '61' into the processor registerknown as
"AL". (The h-suffix means hexadecimal or = 97 in decimal)
The mnemonic "mov" represents the opcode 1011 which actually copies the value in thesecond operand into the register indicated by the first operand. The mnemonic was chosen by
the designer of the instruction set to abbreviate "move", making it easier for the programmer to
remember. Typical of an assembly language statement, a comma-separated list of arguments orparameters follows the opcode.
In practice many programmers drop the word mnemonic and, technically incorrectly, call
"mov" an opcode. When they do this they are referring to the underlyingbinary code which it
http://en.wikipedia.org/wiki/Assemblers#cite_note-1http://en.wikipedia.org/wiki/Assemblers#cite_note-1http://en.wikipedia.org/wiki/High-level_assemblerhttp://en.wikipedia.org/wiki/IBM/360http://en.wikipedia.org/wiki/Object-oriented_programminghttp://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)http://en.wikipedia.org/wiki/Type_polymorphismhttp://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)http://en.wikipedia.org/wiki/Interface_(computer_science)http://en.wikipedia.org/wiki/Assembly_language#Assemblerhttp://en.wikipedia.org/wiki/Assembly_language#Assemblerhttp://en.wikipedia.org/wiki/X86http://en.wikipedia.org/wiki/IA-32http://en.wikipedia.org/wiki/MOV_(x86_instruction)http://en.wikipedia.org/wiki/Machine_languagehttp://en.wikipedia.org/wiki/X86_assembly_languagehttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Hexadecimalhttp://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/Hexadecimalhttp://en.wikipedia.org/wiki/Decimalhttp://en.wikipedia.org/wiki/Binary_codehttp://en.wikipedia.org/wiki/Assemblers#cite_note-1http://en.wikipedia.org/wiki/High-level_assemblerhttp://en.wikipedia.org/wiki/IBM/360http://en.wikipedia.org/wiki/Object-oriented_programminghttp://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)http://en.wikipedia.org/wiki/Type_polymorphismhttp://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)http://en.wikipedia.org/wiki/Interface_(computer_science)http://en.wikipedia.org/wiki/Assembly_language#Assemblerhttp://en.wikipedia.org/wiki/X86http://en.wikipedia.org/wiki/IA-32http://en.wikipedia.org/wiki/MOV_(x86_instruction)http://en.wikipedia.org/wiki/Machine_languagehttp://en.wikipedia.org/wiki/X86_assembly_languagehttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Hexadecimalhttp://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/Hexadecimalhttp://en.wikipedia.org/wiki/Decimalhttp://en.wikipedia.org/wiki/Binary_code -
8/3/2019 COMS241+Unit+I+Additional+Reference
3/11
represents. To put it another way, a mnemonic such as "mov" is not an opcode, but as it
symbolizes an opcode, one might refer to "the opcode mov" for example when one intends to
refer to the binary opcode it symbolizes rather than to the symbol -- the mnemonic -- itself. Asfew modern programmers have need to be mindful of actually what binary patterns are (the
opcodes for specific instructions), the distinction has in practice become a bit blurred among
programmers but not among processor designers[citation needed].
Transforming assembly into machine language is accomplished by an assembler, and the(partial) reverse by a disassembler. Unlike high-level languages, there is usually a one-to-one
correspondence between simple assembly statements and machine language instructions.
However, in some cases, an assembler may provide pseudoinstructions (essentially macros)which expand into several machine language instructions to provide commonly needed
functionality. For example, for a machine that lacks a "branch if greater or equal" instruction,
an assembler may provide a pseudoinstruction that expands to the machine's "set if less than"and "branch if zero (on the result of the set instruction)". Most full-featured assemblers also
provide a rich macro language (discussed below) which is used by vendors and programmers
to generate more complex code and data sequences.
Each computer architecture andprocessor architecture usually has its own machine language.On this level, each instruction is simple enough to be executed using a relatively small number
of electronic circuits. Computers differ by the number and type of operations they support. For
example, a new 64-bit machine would have different circuitry from a 32-bit machine. Theymay also have different sizes and numbers of registers, and different representations of data
types in storage. While most general-purpose computers are able to carry out essentially the
same functionality, the ways they do so differ; the corresponding assembly languages reflect
these differences.
Multiple sets ofmnemonicsor assembly-language syntax may exist for a single instruction set,
typically instantiated in different assembler programs. In these cases, the most popular one is
usually that supplied by the manufacturer and used in its documentation.
Basic elements
Any Assembly language consists of 3 types of instruction statements which are used to define
the program operations:
Opcode mnemonics
Data sections
Assembly directives
Opcode mnemonics
Instructions (statements) in assembly language are generally very simple, unlike those in high-level languages. Generally, an opcode is a symbolic name for a single executable machine
language instruction, and there is at least one opcode mnemonic defined for each machine
language instruction. Each instruction typically consists of an operation oropcode plus zero or
more operands. Most instructions refer to a single value, or a pair of values. Operands can beeither immediate (typically one byte values, coded in the instruction itself) or the addresses of
http://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttp://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttp://en.wikipedia.org/wiki/Assembly_language#Assemblerhttp://en.wikipedia.org/wiki/Disassemblerhttp://en.wikipedia.org/wiki/Disassemblerhttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/One-to-one_correspondencehttp://en.wikipedia.org/wiki/One-to-one_correspondencehttp://en.wikipedia.org/wiki/One-to-one_correspondencehttp://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Computer_architecturehttp://en.wikipedia.org/wiki/Processor_architecturehttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/Operandshttp://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttp://en.wikipedia.org/wiki/Assembly_language#Assemblerhttp://en.wikipedia.org/wiki/Disassemblerhttp://en.wikipedia.org/wiki/High-level_languagehttp://en.wikipedia.org/wiki/One-to-one_correspondencehttp://en.wikipedia.org/wiki/One-to-one_correspondencehttp://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Computer_architecturehttp://en.wikipedia.org/wiki/Processor_architecturehttp://en.wikipedia.org/wiki/Mnemonichttp://en.wikipedia.org/wiki/Opcodehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/Operands -
8/3/2019 COMS241+Unit+I+Additional+Reference
4/11
data located elsewhere in storage. This is determined by the underlying processor architecture:
the assembler merely reflects how this architecture works.
Data sections
There are instructions used to define data elements to hold data and variables. They define thetype of data, the length and the alignment of data. These instructions can also define whether
the data is available to outside programs (programs assembled separately) or only to theprogram in which the data section is defined.
Macros
Many assemblers support predefined macros, and others support programmer-defined (and
repeatedly redefinable) macros involving sequences of text lines that variables and constants
are embedded in. This sequence of text lines may include a sequence of instructions, or asequence of data storage pseudo-ops. Once a macro has been defined using the appropriate
pseudo-op, its name may be used in place of a mnemonic. When the assembler processes such
a statement, it replaces the statement with the text lines associated with that macro, thenprocesses them just as though they had appeared in the source code file all along (including, in
better assemblers, expansion of any macros appearing in the replacement text).
Since macros can have 'short' names but expand to several or indeed many lines of code, they
can be used to make assembly language programs appear to be much shorter (require less linesof source code from the application programmer, as with a higher level language). They can
also be used to add higher levels of structure to assembly programs, optionally introduce
embedded de-bugging code via parameters and other similar features.
Many assemblers have built-in (orpredefined) macros for system calls and other special codesequences, such as the generation and storage of data realized through advanced bitwise and
boolean operations used in gaming, software security, data management, and cryptography.
Macro assemblers often allow macros to take parameters. Some assemblers include quite
sophisticated macro languages, incorporating such high-level language elements as optionalparameters, symbolic variables, conditionals, string manipulation, and arithmetic operations,
all usable during the execution of a given macro, and allowing macros to save context or
exchange information. Thus a macro might generate a large number of assembly languageinstructions or data definitions, based on the macro arguments. This could be used to generate
record-style data structures or "unrolled" loops, for example, or could generate entire
algorithms based on complex parameters. An organization using assembly language that hasbeen heavily extended using such a macro suite can be considered to be working in a higher-
level language, since such programmers are not working with a computer's lowest-level
conceptual elements.
Macros were used to customize large scale software systems for specific customers in themainframe era and were also used by customer personnel to satisfy their employers' needs by
making specific versions of manufacturer operating systems; this was done, for example, by
http://en.wikipedia.org/wiki/Booleanhttp://en.wikipedia.org/wiki/Parameter_(computer_science)http://en.wikipedia.org/wiki/Booleanhttp://en.wikipedia.org/wiki/Parameter_(computer_science) -
8/3/2019 COMS241+Unit+I+Additional+Reference
5/11
systems programmers working with IBM's Conversational Monitor System/Virtual Machine
(CMS/VM) and with IBM's "real time transaction processing" add-ons, CICS, Customer
Information Control System, and ACP/TPF, the airline/financial system that began in the1970s and still runs many large Global Distribution Systems (GDS) and credit card systems
today.
It was also possible to use solely the macro processing capabilities of an assembler to generate
code written in completely different languages, for example, to generate a version of a programin Cobol using a pure macro assembler program containing lines of Cobol code inside
assembly time operators instructing the assembler to generate arbitrary code.
Macro parameter substitution is strictly by name: at macro processing time, the value of a
parameter is textually substituted for its name. The most famous class of bugs resulting was theuse of a parameter that itself was an expression and not a simple name when the macro writer
expected a name. In the macro: foo: macro a load a*b the intention was that the caller
would provide the name of a variable, and the "global" variable or constant b would be used tomultiply "a". If foo is called with the parameter a-c, an unexpected macro expansion occurs.
Linker:
Linker, a computer program that takes one or more objectsgenerated by a compiler and
combines them into a single executable programo ld, the linker included in Unix
o GNU linker, the GNU Project's implementation of the Unix command ld
o Dynamic linker, the part of an operating system that loads and links the shared
libraries for an executableo
Loaders
In computing, a loader is the part of an operating system that is responsible for loading
programs, one of the essential stages in the process of starting a program. Loading a program
involves reading the contents of executable file, the file containing the program text, intomemory, and then carrying out other required preparatory tasks to prepare the executable for
running. Once loading is complete, the operating system starts the program by passing control
to the loaded program code.
All operating systems that support program loading have loaders, apart from systems wherecode executes directly from ROM or in the case of highly specialized computer systems that
only have a fixed set of specialised programs.
In many operating systems the loader is permanently resident in memories, although some
operating systems that support virtual memory may allow the loader to be located in a regionof memory that ispageable.
http://en.wikipedia.org/wiki/IBMhttp://en.wikipedia.org/wiki/IBMhttp://en.wikipedia.org/wiki/CICShttp://en.wikipedia.org/wiki/Airline_Control_Programhttp://en.wikipedia.org/wiki/Transaction_Processing_Facilityhttp://en.wikipedia.org/wiki/Global_Distribution_Systemshttp://en.wikipedia.org/wiki/Linker_(computing)http://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Ld_(Unix)http://en.wikipedia.org/wiki/Ld_(Unix)http://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/GNU_linkerhttp://en.wikipedia.org/wiki/Dynamic_linkerhttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Virtual_memoryhttp://en.wikipedia.org/wiki/Paginghttp://en.wikipedia.org/wiki/IBMhttp://en.wikipedia.org/wiki/CICShttp://en.wikipedia.org/wiki/Airline_Control_Programhttp://en.wikipedia.org/wiki/Transaction_Processing_Facilityhttp://en.wikipedia.org/wiki/Global_Distribution_Systemshttp://en.wikipedia.org/wiki/Linker_(computing)http://en.wikipedia.org/wiki/Object_filehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Ld_(Unix)http://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/GNU_linkerhttp://en.wikipedia.org/wiki/Dynamic_linkerhttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Virtual_memoryhttp://en.wikipedia.org/wiki/Paging -
8/3/2019 COMS241+Unit+I+Additional+Reference
6/11
In the case of operating systems that support virtual memory, the loader may not actually copy
the contents of executable files into memory, but rather may simply declare to the virtual
memory subsystem that there is a mapping between a region of memory allocated to containthe running program's code and the contents of the associated executable file. (See memory-
mapped file.) The virtual memory subsystem is then made aware that pages with that region of
memory need to be filled on demand if and when program execution actually hits those areasof unfilled memory. This may mean parts of a program's code are not actually copied into
memory until they are actually used, and unused code may never be loaded into memory at all.
Responsibilities
In Unix, the loader is the handler for the system call execve().[1] The Unix loader's tasks
include:
1. validation (permissions, memory requirements etc.);
2. copying the program image from the disk into main memory;
3. copying the command-line arguments on the stack;4. initializing registers (e.g., the stack pointer);
5. jumping to the program entry point (_start).
Relocating loaders
Some computers needrelocating loaders, which adjust addresses (pointers) in the executable to
compensate for variations in the address at which loading starts. The computers which needrelocating loaders are those in which pointers are absolute addresses rather than offsets from
the program's base address. One well-known example is IBM's System/360 mainframes and
their descendants, including the System z9 series.
Dynamic linkers
Dynamic linking loaders are another type of loader that load and linkshared libraries (like .dllfiles) to already loaded running programs.
Compiler
A compiler is a computer program (or set of programs) that transforms source code written ina computer language (the source language) into another computer language (the targetlanguage, often having a binary form known as object code). The most common reason for
wanting to transform source code is to create an executableprogram.
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 or machine
code). A program that translates from a low level language to a higher level one is a
http://en.wikipedia.org/wiki/Memory-mapped_filehttp://en.wikipedia.org/wiki/Memory-mapped_filehttp://en.wikipedia.org/wiki/Memory-mapped_filehttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Callback_(computer_science)http://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/Loader_(computing)#cite_note-0http://en.wikipedia.org/wiki/Main_memoryhttp://en.wikipedia.org/wiki/Command-line_argumenthttp://en.wikipedia.org/wiki/Call_stackhttp://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/Relocation_(computer_science)http://en.wikipedia.org/wiki/Relocation_(computer_science)http://en.wikipedia.org/wiki/Base_addresshttp://en.wikipedia.org/wiki/System/360http://en.wikipedia.org/wiki/System_z9http://en.wikipedia.org/wiki/Dynamic_linkerhttp://en.wikipedia.org/wiki/Shared_librarieshttp://en.wikipedia.org/wiki/Dynamic_link_libraryhttp://en.wikipedia.org/wiki/Dynamic_link_libraryhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Memory-mapped_filehttp://en.wikipedia.org/wiki/Memory-mapped_filehttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Callback_(computer_science)http://en.wikipedia.org/wiki/System_callhttp://en.wikipedia.org/wiki/Loader_(computing)#cite_note-0http://en.wikipedia.org/wiki/Main_memoryhttp://en.wikipedia.org/wiki/Command-line_argumenthttp://en.wikipedia.org/wiki/Call_stackhttp://en.wikipedia.org/wiki/Processor_registerhttp://en.wikipedia.org/wiki/Relocation_(computer_science)http://en.wikipedia.org/wiki/Base_addresshttp://en.wikipedia.org/wiki/System/360http://en.wikipedia.org/wiki/System_z9http://en.wikipedia.org/wiki/Dynamic_linkerhttp://en.wikipedia.org/wiki/Shared_librarieshttp://en.wikipedia.org/wiki/Dynamic_link_libraryhttp://en.wikipedia.org/wiki/Dynamic_link_libraryhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Source_codehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Object_codehttp://en.wikipedia.org/wiki/Executablehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/High-level_programming_languagehttp://en.wikipedia.org/wiki/Assembly_languagehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Machine_code -
8/3/2019 COMS241+Unit+I+Additional+Reference
7/11
decompiler. A program that translates between high-level languages is usually called alanguage translator,source to source translator, orlanguage converter. A languagerewriter
is usually a program that translates the form of expressions without a change of language.
A compiler is likely to perform many or all of the following operations: lexical analysis,
preprocessing,parsing, semantic analysis, code generation, and code optimization.
Program faults caused by incorrect compiler behavior can be very difficult to track down andwork around and compiler implementors invest a lot of time ensuring the correctness of theirsoftware.
The term compiler-compileris sometimes used to refer to aparser generator, a tool often used
to help create the lexerandparser.
Compilers in education
Compiler construction and compiler optimization are taught at universities and schools as part
of the computer science curriculum. Such courses are usually supplemented with the
implementation of a compiler for an educational programming language. A well-documentedexample isNiklaus Wirth's PL/0 compiler, which Wirth used to teach compiler construction in
the 1970s.[3] In spite of its simplicity, the PL/0 compiler introduced several influential concepts
to the field:
1. Program development by stepwise refinement (also the title of a 1971 paper by Wirth[4])2. The use of a recursive descent parser
3. The use ofEBNF to specify the syntax of a language
4. A code generatorproducing portableP-code5. The use ofT-diagrams[5] in the formal description of thebootstrapping problem
Compiler output
One classification of compilers is by theplatform on which their generated code executes. This
is known as the target platform.
A native orhostedcompiler is one whose output is intended to directly run on the same type ofcomputer 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 forembedded systems that are not intended to support a software developmentenvironment.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.
http://en.wikipedia.org/wiki/Decompilerhttp://en.wikipedia.org/wiki/Translator_(computing)http://en.wikipedia.org/wiki/Rewritinghttp://en.wikipedia.org/wiki/Rewritinghttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Preprocessinghttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_optimizationhttp://en.wikipedia.org/wiki/Code_optimizationhttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Compiler-compilerhttp://en.wikipedia.org/wiki/Parser_generatorhttp://en.wikipedia.org/wiki/Parser_generatorhttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Parserhttp://en.wikipedia.org/wiki/Compiler_optimizationhttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Educational_programming_languagehttp://en.wikipedia.org/wiki/Educational_programming_languagehttp://en.wikipedia.org/wiki/Niklaus_Wirthhttp://en.wikipedia.org/wiki/Niklaus_Wirthhttp://en.wikipedia.org/wiki/PL/0http://en.wikipedia.org/wiki/Compilers#cite_note-2http://en.wikipedia.org/wiki/Compilers#cite_note-2http://en.wikipedia.org/wiki/Compilers#cite_note-3http://en.wikipedia.org/wiki/Recursive_descent_parserhttp://en.wikipedia.org/wiki/EBNFhttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/P-codehttp://en.wikipedia.org/wiki/P-codehttp://en.wikipedia.org/wiki/T-diagramhttp://en.wikipedia.org/wiki/Compilers#cite_note-4http://en.wikipedia.org/wiki/Compilers#cite_note-4http://en.wikipedia.org/wiki/Bootstrapping_(compilers)http://en.wikipedia.org/wiki/Platform_(computing)http://en.wikipedia.org/wiki/Cross_compilerhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/Virtual_machinehttp://en.wikipedia.org/wiki/Decompilerhttp://en.wikipedia.org/wiki/Translator_(computing)http://en.wikipedia.org/wiki/Rewritinghttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Preprocessinghttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_optimizationhttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Compiler-compilerhttp://en.wikipedia.org/wiki/Parser_generatorhttp://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Parserhttp://en.wikipedia.org/wiki/Compiler_optimizationhttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Educational_programming_languagehttp://en.wikipedia.org/wiki/Niklaus_Wirthhttp://en.wikipedia.org/wiki/PL/0http://en.wikipedia.org/wiki/Compilers#cite_note-2http://en.wikipedia.org/wiki/Compilers#cite_note-3http://en.wikipedia.org/wiki/Recursive_descent_parserhttp://en.wikipedia.org/wiki/EBNFhttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/P-codehttp://en.wikipedia.org/wiki/T-diagramhttp://en.wikipedia.org/wiki/Compilers#cite_note-4http://en.wikipedia.org/wiki/Bootstrapping_(compilers)http://en.wikipedia.org/wiki/Platform_(computing)http://en.wikipedia.org/wiki/Cross_compilerhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Virtual_machine -
8/3/2019 COMS241+Unit+I+Additional+Reference
8/11
Compiler design
A compiler for a relatively simple language written by one person might be a single,
monolithic piece of software. When the source language is large and complex, and high qualityoutput is required the design may be split into a number of relatively independent phases.
Having separate phases means development can be parceled up into small parts and given to
different people. It also becomes much easier to replace a single phase by an improved one, or
to insert new phases later (eg, additional optimizations).
The division of the compilation processes into phases was championed by the Production
Quality Compiler-Compiler Project (PQCC) at Carnegie Mellon University. This project
introduced the termsfront end, middle end, and back end.
All but the smallest of compilers have more than two phases. However, these phases areusually regarded as being part of the front end or the back end. The point at where these twoends meet is always open to debate. The front end is generally considered to be where syntactic
and semantic processing takes place, along with translation to a lower level of representation(than source code).
The middle end is usually designed to perform optimizations on a form other than the source
code or machine code. This source code/machine code independence is intended to enable
generic optimizations to be shared between versions of the compiler supporting differentlanguages and target processors.
The back end takes the output from the middle. It may perform more analysis, transformations
and optimizations that are for a particular computer. Then, it generates code for a particular
processor and OS.
This front-end/middle/back-end approach makes it possible to combine front ends for different
languages with back ends for differentCPUs. Practical examples of this approach are the GNUCompiler Collection, LLVM, and the Amsterdam Compiler Kit, which have multiple front-ends, shared analysis and multiple back-ends.
One-pass versus multi-pass compilers
Classifying compilers by number of passes has its background in the hardware resourcelimitations of computers. Compiling involves performing lots of work and early computers did
not have enough memory to contain one program that did all of this work. So compilers were
split up into smaller programs which each made a pass over the source (or some representation
of it) performing some of the required analysis and translations.
The ability to compile in a single pass is often seen as a benefit because it simplifies the job of
writing a compiler and one pass compilers generally compile faster than multi-pass compilers.
Many languages were designed so that they could be compiled in a single pass (e.g., Pascal).
The disadvantage of compiling in a single pass is that it is not possible to perform many of thesophisticated optimizationsneeded to generate high quality code. It can be difficult to count
exactly how many passes an optimizing compiler makes. For instance, different phases of
http://en.wikipedia.org/wiki/Production_Quality_Compiler-Compiler_Projecthttp://en.wikipedia.org/wiki/Production_Quality_Compiler-Compiler_Projecthttp://en.wikipedia.org/wiki/Carnegie_Mellonhttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/LLVMhttp://en.wikipedia.org/wiki/Amsterdam_Compiler_Kithttp://en.wikipedia.org/wiki/One-pass_compilerhttp://en.wikipedia.org/wiki/Multi-pass_compilerhttp://en.wikipedia.org/wiki/Pascal_(programming_language)http://en.wikipedia.org/wiki/Compiler_optimizationhttp://en.wikipedia.org/wiki/Compiler_optimizationhttp://en.wikipedia.org/wiki/Production_Quality_Compiler-Compiler_Projecthttp://en.wikipedia.org/wiki/Production_Quality_Compiler-Compiler_Projecthttp://en.wikipedia.org/wiki/Carnegie_Mellonhttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/LLVMhttp://en.wikipedia.org/wiki/Amsterdam_Compiler_Kithttp://en.wikipedia.org/wiki/One-pass_compilerhttp://en.wikipedia.org/wiki/Multi-pass_compilerhttp://en.wikipedia.org/wiki/Pascal_(programming_language)http://en.wikipedia.org/wiki/Compiler_optimization -
8/3/2019 COMS241+Unit+I+Additional+Reference
9/11
optimization may analyse one expression many times but only analyse another expression
once.
While the typical multi-pass compiler outputs machine code from its final pass, there areseveral other types:
A "source-to-source compiler" is a type of compiler that takes a high level language as
its input and outputs a high level language. For example, an automatic parallelizingcompiler will frequently take in a high level language program as an input and thentransform the code and annotate it with parallel code annotations (e.g. OpenMP) or
language constructs (e.g. Fortran's DOALL statements).
Stage compilerthat compiles to assembly language of a theoretical machine, like someProlog implementations
o This Prolog machine is also known as the Warren Abstract Machine (or WAM).
Bytecode compilers for Java, Python, and many more are also a subtype of this.
Just-in-time compiler, used by Smalltalk and Java systems, and also by Microsoft .Net's
Common Intermediate Language (CIL)
o Applications are delivered in bytecode, which is compiled to native machine
code just prior to execution.
Front end
The front end analyzes the source code to build an internal representation of the program,called theintermediate representationorIR. It also manages thesymbol table, a data structure
mapping each symbol in the source code to associated information such as location, type and
scope. This is done over several phases, which includes some of the following:
1. Line reconstruction. Languages which strop their keywords or allow arbitrary spaceswithin identifiers require a phase before parsing, which converts the input character
sequence to a canonical form ready for the parser. The top-down, recursive-descent,table-driven parsers used in the 1960s typically read the source one character at a time
and did not require a separate tokenizing phase. Atlas Autocode, and Imp (and someimplementations of Algol and Coral66) are examples of stropped languages whose
compilers would have aLine Reconstruction phase.
2. Lexical analysisbreaks the source code text into small pieces called tokens. Each tokenis a single atomic unit of the language, for instance a keyword, identifier or symbol
name. The token syntax is typically a regular language, so a finite state automaton
constructed from a regular expression can be used to recognize it. This phase is alsocalled lexing or scanning, and the software doing lexical analysis is called a lexical
analyzeror scanner.
3. Preprocessing. Some languages, e.g., C, require a preprocessing phase which supportsmacro substitution and conditional compilation. Typically the preprocessing phase
occurs before syntactic or semantic analysis; e.g. in the case of C, the preprocessor
manipulates lexical tokens rather than syntactic forms. However, some languages such
as Scheme support macro substitutions based on syntactic forms.4. Syntax analysis involvesparsing the token sequence to identify the syntactic structure
of the program. This phase typically builds a parse tree, which replaces the linear
sequence of tokens with a tree structure built according to the rules of a formal
http://en.wikipedia.org/wiki/Source-to-source_compilerhttp://en.wikipedia.org/wiki/Automatic_parallelizationhttp://en.wikipedia.org/wiki/OpenMPhttp://en.wikipedia.org/w/index.php?title=Stage_compiler&action=edit&redlink=1http://en.wikipedia.org/wiki/Prologhttp://en.wikipedia.org/wiki/Warren_Abstract_Machinehttp://en.wikipedia.org/wiki/Python_languagehttp://en.wikipedia.org/wiki/Just-in-time_compilationhttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Intermediate_representationhttp://en.wikipedia.org/wiki/Intermediate_representationhttp://en.wikipedia.org/wiki/Intermediate_representationhttp://en.wikipedia.org/wiki/Symbol_tablehttp://en.wikipedia.org/wiki/Symbol_tablehttp://en.wikipedia.org/wiki/Stroppinghttp://en.wikipedia.org/wiki/Top-down_parsinghttp://en.wikipedia.org/wiki/Top-down_parsinghttp://en.wikipedia.org/wiki/Recursive_descent_parserhttp://en.wikipedia.org/wiki/Atlas_Autocodehttp://en.wikipedia.org/wiki/Edinburgh_IMPhttp://en.wikipedia.org/wiki/Algol60http://en.wikipedia.org/wiki/CORAL66http://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Keyword_(computing)http://en.wikipedia.org/wiki/Keyword_(computing)http://en.wikipedia.org/wiki/Identifierhttp://en.wikipedia.org/wiki/Identifierhttp://en.wikipedia.org/wiki/Symbolhttp://en.wikipedia.org/wiki/Symbolhttp://en.wikipedia.org/wiki/Regular_languagehttp://en.wikipedia.org/wiki/Regular_languagehttp://en.wikipedia.org/wiki/Finite_state_automatonhttp://en.wikipedia.org/wiki/Finite_state_automatonhttp://en.wikipedia.org/wiki/Regular_expressionhttp://en.wikipedia.org/wiki/Lexical_analyzerhttp://en.wikipedia.org/wiki/Lexical_analyzerhttp://en.wikipedia.org/wiki/Preprocessorhttp://en.wikipedia.org/wiki/Preprocessorhttp://en.wikipedia.org/wiki/C_(programming_language)http://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Scheme_(programming_language)http://en.wikipedia.org/wiki/Syntax_analysishttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Parse_treehttp://en.wikipedia.org/wiki/Formal_grammarhttp://en.wikipedia.org/wiki/Source-to-source_compilerhttp://en.wikipedia.org/wiki/Automatic_parallelizationhttp://en.wikipedia.org/wiki/OpenMPhttp://en.wikipedia.org/w/index.php?title=Stage_compiler&action=edit&redlink=1http://en.wikipedia.org/wiki/Prologhttp://en.wikipedia.org/wiki/Warren_Abstract_Machinehttp://en.wikipedia.org/wiki/Python_languagehttp://en.wikipedia.org/wiki/Just-in-time_compilationhttp://en.wikipedia.org/wiki/Common_Intermediate_Languagehttp://en.wikipedia.org/wiki/Intermediate_representationhttp://en.wikipedia.org/wiki/Symbol_tablehttp://en.wikipedia.org/wiki/Stroppinghttp://en.wikipedia.org/wiki/Top-down_parsinghttp://en.wikipedia.org/wiki/Recursive_descent_parserhttp://en.wikipedia.org/wiki/Atlas_Autocodehttp://en.wikipedia.org/wiki/Edinburgh_IMPhttp://en.wikipedia.org/wiki/Algol60http://en.wikipedia.org/wiki/CORAL66http://en.wikipedia.org/wiki/Lexical_analysishttp://en.wikipedia.org/wiki/Keyword_(computing)http://en.wikipedia.org/wiki/Identifierhttp://en.wikipedia.org/wiki/Symbolhttp://en.wikipedia.org/wiki/Symbolhttp://en.wikipedia.org/wiki/Regular_languagehttp://en.wikipedia.org/wiki/Finite_state_automatonhttp://en.wikipedia.org/wiki/Regular_expressionhttp://en.wikipedia.org/wiki/Lexical_analyzerhttp://en.wikipedia.org/wiki/Lexical_analyzerhttp://en.wikipedia.org/wiki/Preprocessorhttp://en.wikipedia.org/wiki/C_(programming_language)http://en.wikipedia.org/wiki/Macro_(computer_science)http://en.wikipedia.org/wiki/Scheme_(programming_language)http://en.wikipedia.org/wiki/Syntax_analysishttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Parse_treehttp://en.wikipedia.org/wiki/Formal_grammar -
8/3/2019 COMS241+Unit+I+Additional+Reference
10/11
grammar which define the language's syntax. The parse tree is often analyzed,
augmented, and transformed by later phases in the compiler.
5. Semantic analysis is the phase in which the compiler adds semantic information to theparse tree and builds the symbol table. This phase performs semantic checks such as
type checking (checking for type errors), orobject binding (associating variable and
function references with their definitions), or definite assignment (requiring all localvariables to be initialized before use), rejecting incorrect programs or issuing warnings.
Semantic analysis usually requires a complete parse tree, meaning that this phaselogically follows the parsingphase, and logically precedes the code generation phase,though it is often possible to fold multiple phases into one pass over the code in a
compiler implementation.
Back end
The term back end is sometimes confused with code generator because of the overlapped
functionality of generating assembly code. Some literature uses middle endto distinguish the
generic analysis and optimization phases in the back end from the machine-dependent code
generators.
The main phases of the back end include the following:
1. Analysis: This is the gathering of program information from the intermediate
representation derived from the input. Typical analyses are data flow analysisto build
use-define chains,dependence analysis,alias analysis,pointer analysis, escape analysisetc. Accurate analysis is the basis for any compiler optimization. The call graph and
control flow graphare usually also built during the analysis phase.
2. Optimization: the intermediate language representation is transformed into functionallyequivalent but faster (or smaller) forms. Popular optimizations are inline expansion,
dead code elimination,constant propagation,loop transformation,register allocation or
even automatic parallelization.3. Code generation: the transformed intermediate language is translated into the output
language, usually the native machine language of the system. This involves resource
and storage decisions, such as deciding which variables to fit into registers and memory
and the selection and scheduling of appropriate machine instructions along with theirassociated addressing modes (see alsoSethi-Ullman algorithm).
Compiler analysis is the prerequisite for any compiler optimization, and they tightly work
together. For example, dependence analysis is crucial forloop transformation.
Due to the extra time and space needed for compiler analysis and optimizations, some
compilers skip them by default. Users have to use compilation options to explicitly tell thecompiler which optimizations should be enabled.
Compiler correctness
Compiler correctness is the branch of software engineering that deals with trying to show that acompiler behaves according to its language specification[citation needed]. Techniques include
http://en.wikipedia.org/wiki/Formal_grammarhttp://en.wikipedia.org/wiki/Formal_grammarhttp://en.wikipedia.org/wiki/Parse_treehttp://en.wikipedia.org/wiki/Type_checkinghttp://en.wikipedia.org/wiki/Object_bindinghttp://en.wikipedia.org/wiki/Object_bindinghttp://en.wikipedia.org/wiki/Object_bindinghttp://en.wikipedia.org/wiki/Definite_assignment_analysishttp://en.wikipedia.org/wiki/Definite_assignment_analysishttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Compiler_analysishttp://en.wikipedia.org/wiki/Data_flow_analysishttp://en.wikipedia.org/wiki/Data_flow_analysishttp://en.wikipedia.org/wiki/Use-define_chainhttp://en.wikipedia.org/wiki/Dependence_analysishttp://en.wikipedia.org/wiki/Dependence_analysishttp://en.wikipedia.org/wiki/Dependence_analysishttp://en.wikipedia.org/wiki/Alias_analysishttp://en.wikipedia.org/wiki/Pointer_analysishttp://en.wikipedia.org/wiki/Escape_analysishttp://en.wikipedia.org/wiki/Call_graphhttp://en.wikipedia.org/wiki/Control_flow_graphhttp://en.wikipedia.org/wiki/Control_flow_graphhttp://en.wikipedia.org/wiki/Compiler_optimizationhttp://en.wikipedia.org/wiki/Inline_expansionhttp://en.wikipedia.org/wiki/Dead_code_eliminationhttp://en.wikipedia.org/wiki/Constant_propagationhttp://en.wikipedia.org/wiki/Constant_propagationhttp://en.wikipedia.org/wiki/Constant_propagationhttp://en.wikipedia.org/wiki/Loop_transformationhttp://en.wikipedia.org/wiki/Loop_transformationhttp://en.wikipedia.org/wiki/Register_allocationhttp://en.wikipedia.org/wiki/Automatic_parallelizationhttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Machine_languagehttp://en.wikipedia.org/wiki/Sethi-Ullman_algorithmhttp://en.wikipedia.org/wiki/Sethi-Ullman_algorithmhttp://en.wikipedia.org/wiki/Dependence_analysishttp://en.wikipedia.org/wiki/Loop_transformationhttp://en.wikipedia.org/wiki/Loop_transformationhttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttp://en.wikipedia.org/wiki/Formal_grammarhttp://en.wikipedia.org/wiki/Parse_treehttp://en.wikipedia.org/wiki/Type_checkinghttp://en.wikipedia.org/wiki/Object_bindinghttp://en.wikipedia.org/wiki/Definite_assignment_analysishttp://en.wikipedia.org/wiki/Parsinghttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Compiler_analysishttp://en.wikipedia.org/wiki/Data_flow_analysishttp://en.wikipedia.org/wiki/Use-define_chainhttp://en.wikipedia.org/wiki/Dependence_analysishttp://en.wikipedia.org/wiki/Alias_analysishttp://en.wikipedia.org/wiki/Pointer_analysishttp://en.wikipedia.org/wiki/Escape_analysishttp://en.wikipedia.org/wiki/Call_graphhttp://en.wikipedia.org/wiki/Control_flow_graphhttp://en.wikipedia.org/wiki/Compiler_optimizationhttp://en.wikipedia.org/wiki/Inline_expansionhttp://en.wikipedia.org/wiki/Dead_code_eliminationhttp://en.wikipedia.org/wiki/Constant_propagationhttp://en.wikipedia.org/wiki/Loop_transformationhttp://en.wikipedia.org/wiki/Register_allocationhttp://en.wikipedia.org/wiki/Automatic_parallelizationhttp://en.wikipedia.org/wiki/Code_generation_(compiler)http://en.wikipedia.org/wiki/Machine_languagehttp://en.wikipedia.org/wiki/Sethi-Ullman_algorithmhttp://en.wikipedia.org/wiki/Dependence_analysishttp://en.wikipedia.org/wiki/Loop_transformationhttp://en.wikipedia.org/wiki/Compiler_correctnesshttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Wikipedia:Citation_needed -
8/3/2019 COMS241+Unit+I+Additional+Reference
11/11
developing the compiler using formal methods and using rigorous testing (often called
compiler validation) on an existing compiler.
Compiled versus Interpreted languages
Higher-level programming languages are generally divided for convenience into compiledlanguages and interpreted languages. However, in practice there is rarely anything about a
language that requires it to be exclusively compiled, or exclusively interpreted; although it ispossible to design languages that may be inherently interpretive. The categorization usuallyreflects the most popular or widespread implementations of a language for instance, BASIC
is sometimes called an interpreted language, and C a compiled one, despite the existence of
BASIC compilers and C interpreters.
Modern trends toward just-in-time compilation and bytecode interpretation at times blur thetraditional categorizations of compilers and interpreters.
Debugger
A debugger or debugging tool is a computer program that is used to test and debug other
programs (the "target" program). The code to be examined might alternatively be running on
aninstruction set simulator(ISS), a technique that allows great power in its ability to halt whenspecific conditions are encountered but which will typically be somewhat slower than
executing the code directly on the appropriate (or the same) processor. Some debuggers offer
two modes of operation - full or partial simulation, to limit this impact.
When the program "crashes" or reaches a preset condition, the debugger typically shows theposition in the original code if it is a source-level debugger orsymbolic debugger, commonly
now seen in integrated development environments. If it is a low-level debugger or a machine-
language debugger it shows the line in the disassembly (unless it also has online access to theoriginal source code and can display the appropriate section of code from the assembly or
compilation).(A "crash" happens when the program cannot normally continue because of a
programming bug. For example, perhaps the program tried to use an instruction not available
on the current version of the CPU or attempted access to unavailable orprotectedmemory.)
Typically, debuggers also offer more sophisticated functions such as running a program step by
step (single-stepping or program animation), stopping (breaking) (pausing the program to
examine the current state) at some event or specified instruction by means of a breakpoint, andtracking the values of some variables. Some debuggers have the ability to modify the state of
the program while it is running, rather than merely to observe it. It may also be possible to
continue execution at a different location in the program to bypass a crash or logical error.
http://en.wikipedia.org/wiki/Formal_methodshttp://en.wikipedia.org/wiki/Compiled_languagehttp://en.wikipedia.org/wiki/Compiled_languagehttp://en.wikipedia.org/wiki/Interpreted_languagehttp://en.wikipedia.org/wiki/Just-in-time_compilationhttp://en.wikipedia.org/wiki/Just-in-time_compilationhttp://en.wikipedia.org/wiki/Bytecodehttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Debughttp://en.wikipedia.org/wiki/Instruction_Set_Simulatorhttp://en.wikipedia.org/wiki/Instruction_Set_Simulatorhttp://en.wikipedia.org/wiki/Instruction_Set_Simulatorhttp://en.wikipedia.org/wiki/Instruction_Set_Simulatorhttp://en.wikipedia.org/wiki/Integrated_development_environmenthttp://en.wikipedia.org/wiki/Disassemblyhttp://en.wikipedia.org/wiki/Crash_(computing)http://en.wikipedia.org/wiki/Software_bughttp://en.wikipedia.org/wiki/Software_bughttp://en.wikipedia.org/wiki/Central_Processing_Unithttp://en.wikipedia.org/wiki/Memory_protectionhttp://en.wikipedia.org/wiki/Memory_protectionhttp://en.wikipedia.org/wiki/Memory_protectionhttp://en.wikipedia.org/wiki/Memory_(computers)http://en.wikipedia.org/wiki/Memory_(computers)http://en.wikipedia.org/wiki/Stepping_(debugging)http://en.wikipedia.org/wiki/Stepping_(debugging)http://en.wikipedia.org/wiki/Program_animationhttp://en.wikipedia.org/wiki/Breakpointhttp://en.wikipedia.org/wiki/Formal_methodshttp://en.wikipedia.org/wiki/Compiled_languagehttp://en.wikipedia.org/wiki/Compiled_languagehttp://en.wikipedia.org/wiki/Interpreted_languagehttp://en.wikipedia.org/wiki/Just-in-time_compilationhttp://en.wikipedia.org/wiki/Bytecodehttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Debughttp://en.wikipedia.org/wiki/Instruction_Set_Simulatorhttp://en.wikipedia.org/wiki/Integrated_development_environmenthttp://en.wikipedia.org/wiki/Disassemblyhttp://en.wikipedia.org/wiki/Crash_(computing)http://en.wikipedia.org/wiki/Software_bughttp://en.wikipedia.org/wiki/Central_Processing_Unithttp://en.wikipedia.org/wiki/Memory_protectionhttp://en.wikipedia.org/wiki/Memory_(computers)http://en.wikipedia.org/wiki/Stepping_(debugging)http://en.wikipedia.org/wiki/Stepping_(debugging)http://en.wikipedia.org/wiki/Program_animationhttp://en.wikipedia.org/wiki/Breakpoint