11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

compiler 95as graphics file formats) where there are many alternativesin widespread use, most programs will support multipleformats.PortabilityPortability is the ability to adapt s<strong>of</strong>tware or hardware toa wide variety <strong>of</strong> platforms (that is, computer systems oroperating systems). Developers want their products to beportable so they can adapt to an <strong>of</strong>ten rapidly changingmarketplace. A typical strategy for portability is to choosea language that is in widespread use <strong>and</strong> a compiler thatis certified as meeting the ANSI or other st<strong>and</strong>ard for thelanguage. The program should be written in such a way thatit makes as few assumptions as possible about hardwaredependentmatters such as how data is stored in memory. Itis also sometimes possible to use st<strong>and</strong>ard frameworks thatprovide the same functions in several different operatingsystems such as Windows, Macintosh, <strong>and</strong> UNIX.However, there is a trade<strong>of</strong>f: The more “generic” a programis made in order to be portable, the less optimized itwill be for any given hardware or operating environment.The program will also not be able to take advantage <strong>of</strong> thespecial features <strong>of</strong> a given operating system, which may putit at a competitive disadvantage compared to the “nativeversion” <strong>of</strong> a program. (This is particularly true with Windows,given that operating system’s dominance in personalcomputing.)The Internet has in general been a force for portability.The Java language, in particular, is designed to be platformindependent.A Java program is compiled into an intermediatelanguage called byte code, which is interpreted orcompiled by a “virtual machine” program running on eachplatform. Thus, the same Java program should run in abrowser under Windows, Macintosh, or UNIX (see java).for addition, rather than some binary instruction code). Anassembler is essentially a compiler that needs to make onlyrelatively simple translations, because assembly language isstill at a relatively low level.Moving to higher-level languages with relatively English-likestatements makes programming easier <strong>and</strong> makesprograms easier to read <strong>and</strong> maintain. However, the task<strong>of</strong> translating high-level statements to machine-level codebecomes a more complex multistep process.The Compilation ProcessCompilers are traditionally thought <strong>of</strong> as having a “frontend” that analyzes the source code (high-level languagestatements) <strong>and</strong> a “back end” that generates the appropriatelow-level code. The front end processing begins with lexicalanalysis. The compiler scans the source program looking formatches to valid tokens as defined by the language. A tokenis any word or symbol that has meaning in the language,Further ReadingHakuta, Mitsuari, <strong>and</strong> Masato Ohminami. “A Study <strong>of</strong> S<strong>of</strong>twarePortability Evaluation.” Journal <strong>of</strong> Systems <strong>and</strong> S<strong>of</strong>tware 38(August 1997): 145–154.Robinson, John. “Delivering on St<strong>and</strong>ards: Balancing Portability<strong>and</strong> Performance.” Available online. URL: http://ipdps.cc.gatech.edu/1999/papers/it2.pdf. Accessed August 11, 2007.“S<strong>of</strong>tware Portability Home Page.” Available online. URL: http://www.cs.wvu.edu/~jdm/research/portability/home.html.Accessed June 11, 2007.compilerA compiler is a program that takes as input a programwritten in a source language <strong>and</strong> produces as output anequivalent program written in another (target) language.Usually the input program is in a high-level language suchas C++ <strong>and</strong> the output is in assembly language for the targetmachine (see assembler).Compilers are useful because programming directlyin low-level machine instructions (as had to be done withthe first computers) is tedious <strong>and</strong> prone to errors. Use <strong>of</strong>assembly language helps somewhat by allowing substitution<strong>of</strong> symbols (variable names) for memory locations <strong>and</strong>the use <strong>of</strong> mnemonic names for operations (such as “add”A parse tree showing how an assignment statement in Pascal canbe broken down into its component parts. Here ID st<strong>and</strong>s for a variablename, or identifier. An expression can be broken all the waydown to a single number.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!