Compiler Design | Bootstrapping
Total Page:16
File Type:pdf, Size:1020Kb
What is Bootstrap and Bootstrap Loader? Bootstrap: To start a computer by loading its OPERATING SYSTEM from disk storage into memory. The name alludes to the seeming absurdity of trying to lift oneself off the floor by pulling on one's own bootstraps - since it is the operating system that enables a computer to read disks, then loading itself from disk would seem to be a similar impossibility. This paradox is resolved by the presence of a small program called the BOOTSTRAP LOADER, which resides permanently in the computer (stored in a ROM chip) and contains just sufficient code to read the rest of the operating system from disk. This process is informally called 'booting' or 'booting up' the computer. The term was first used in computing to describe the process whereby a loader program, whose job it is to get other pieces of software into a machine, is itself loaded. This task was made possible by a very simple loader, wired into the hardware that was just adequate to load a more extensive loader program, which then loaded everything else. Bootstrapping commonly used now to denote bringing a computer to an operational state-that is, a state in which it accepts user commands-from either an unpowered state, or a powered but unresponsive state. Booting a pc, for example, from an unpowered state-a cold boot-is initiated simply by switching the PC on-a one-touch operation that initiates a great deal of hardware testing and loading of software. Booting from a powered state-a warm boot-is usually initiated by pressing one or more keys or a button on the computer casing. It is normally done only to recover from a condition in which the computer is not behaving properly, for example, a "frozen" screen and unresponsive keyboard. A warm boot is also called a reboot or restart. Bootstrap Loader: More formally called an Initial Program Loader (IPL), a small section of executable code, permanently stored in a ROM chip within the computer, whose sole function is to load into memory from DISK just that small part of a computer's OPERATING SYSTEM needed to load the remainder of the operating system. Compiler Design | Bootstrapping Bootstrapping is a process in which simple language is used to translate more complicated program which in turn may handle for more complicated program. This complicated program can further handle even more complicated program and so on. Writing a compiler for any high level language is a complicated process. It takes lot of time to write a compiler from scratch. Hence simple language is used to generate target code in some stages. To clearly understand the Bootstrapping technique consider a following scenario. Suppose we want to write a cross compiler for new language X. The implementation language of this compiler is say Y and the target code being generated is in language Z. That is, we create XYZ. Now if existing compiler Y runs on machine M and generates code for M then it is denoted as YMM. Now if we run XYZ using YMM then we get a compiler XMZ. That means a compiler for source language X that generates a target code in language Z and which runs on machine M. Following diagram illustrates the above scenario. Example: We can create compiler of many different forms. Now we will generate. Compiler which takes C language and generates an assembly language as an output with the availability of a machine of assembly language. Step-1: First we write a compiler for a small of C in assembly language. Step-2: Then using with small subset of C i.e. C0, for the source language c the compiler is written. Step-3: Finally we compile the second compiler. Using compiler 1 the compiler 2 is compiled. Step-4: Thus we get a compiler written in ASM which compiles C and generates code in ASM. .