Cooper_Engineering_a_Compiler(Second Edition) (Rice), страница 8

PDF-файл Cooper_Engineering_a_Compiler(Second Edition) (Rice), страница 8 Конструирование компиляторов (52981): Другое - 7 семестрCooper_Engineering_a_Compiler(Second Edition) (Rice) - PDF, страница 8 (52981) - СтудИзба2019-09-18СтудИзба
Rice1874

Описание файла

Файл "Cooper_Engineering_a_Compiler(Second Edition)" внутри архива находится в следующих папках: Rice, Купер и Торчсон - перевод. PDF-файл из архива "Rice", который расположен в категории "". Всё это находится в предмете "конструирование компиляторов" из 7 семестр, которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .

Просмотр PDF-файла онлайн

Текст 8 страницы из PDF

Nate McFadden guided this edition from its inception throughits publication with patience and good humor. Penny Anderson provided administrative andorganizational support that was critical to finishing the second edition. To all these people goour heartfelt thanks.This page intentionally left blankChapter1Overview of CompilationnCHAPTER OVERVIEWCompilers are computer programs that translate a program written in onelanguage into a program written in another language. At the same time, acompiler is a large software system, with many internal components andalgorithms and complex interactions between them. Thus, the study of compiler construction is an introduction to techniques for the translation andimprovement of programs, and a practical exercise in software engineering.This chapter provides a conceptual overview of all the major components ofa modern compiler.Keywords: Compiler, Interpreter, Automatic Translation1.1 INTRODUCTIONThe role of the computer in daily life grows each year.

With the rise of theInternet, computers and the software that runs on them provide communications, news, entertainment, and security. Embedded computers have changedthe ways that we build automobiles, airplanes, telephones, televisions, andradios. Computation has created entirely new categories of activity, fromvideo games to social networks. Supercomputers predict daily weather andthe course of violent storms. Embedded computers synchronize traffic lightsand deliver e-mail to your pocket.All of these computer applications rely on software computer programsthat build virtual tools on top of the low-level abstractions provided by theunderlying hardware.

Almost all of that software is translated by a toolcalled a compiler. A compiler is simply a computer program that translates other computer programs to prepare them for execution. This bookpresents the fundamental techniques of automatic translation that are usedEngineering a Compiler. DOI: 10.1016/B978-0-12-088478-0.00001-3c 2012, Elsevier Inc. All rights reserved.Copyright Compilera computer program that translates othercomputer programs12 CHAPTER 1 Overview of Compilationto build compilers. It describes many of the challenges that arise in compilerconstruction and the algorithms that compiler writers use to address them.Conceptual RoadmapA compiler is a tool that translates software written in one language intoanother language. To translate text from one language to another, the toolmust understand both the form, or syntax, and content, or meaning, of theinput language. It needs to understand the rules that govern syntax and meaning in the output language.

Finally, it needs a scheme for mapping contentfrom the source language to the target language.The structure of a typical compiler derives from these simple observations.The compiler has a front end to deal with the source language. It has a backend to deal with the target language. Connecting the front end and the backend, it has a formal structure for representing the program in an intermediate form whose meaning is largely independent of either language.

Toimprove the translation, a compiler often includes an optimizer that analyzesand rewrites that intermediate form.OverviewComputer programs are simply sequences of abstract operations written ina programming language—a formal language designed for expressing computation. Programming languages have rigid properties and meanings—asopposed to natural languages, such as Chinese or Portuguese.

Programminglanguages are designed for expressiveness, conciseness, and clarity. Naturallanguages allow ambiguity. Programming languages are designed to avoidambiguity; an ambiguous program has no meaning. Programming languagesare designed to specify computations—to record the sequence of actions thatperform some task or produce some results.Programming languages are, in general, designed to allow humans to expresscomputations as sequences of operations.

Computer processors, hereafterreferred to as processors, microprocessors, or machines, are designed to execute sequences of operations. The operations that a processor implementsare, for the most part, at a much lower level of abstraction than those specified in a programming language. For example, a programming language typically includes a concise way to print some number to a file. That singleprogramming language statement must be translated into literally hundredsof machine operations before it can execute.The tool that performs such translations is called a compiler. The compilertakes as input a program written in some language and produces as its output an equivalent program.

In the classic notion of a compiler, the output1.1 Introduction 3program is expressed in the operations available on some specific processor,often called the target machine. Viewed as a black box, a compiler mightlook like this:SourceProgramCompilerTargetProgramTypical “source” languages might be c, c++, fortran, Java, or ml. The“target” language is usually the instruction set of some processor.Some compilers produce a target program written in a human-oriented programming language rather than the assembly language of some computer.The programs that these compilers produce require further translation beforethey can execute directly on a computer. Many research compilers produceC programs as their output.

Because compilers for C are available on mostcomputers, this makes the target program executable on all those systems,at the cost of an extra compilation for the final target. Compilers that target programming languages rather than the instruction set of a computer areoften called source-to-source translators.Instruction setThe set of operations supported by a processor;the overall design of an instruction set is oftencalled an instruction set architecture or ISA.Many other systems qualify as compilers.

For example, a typesetting program that produces PostScript can be considered a compiler. It takes asinput a specification for how the document should look on the printed pageand it produces as output a PostScript file. PostScript is simply a languagefor describing images. Because the typesetting program takes an executablespecification and produces another executable specification, it is a compiler.The code that turns PostScript into pixels is typically an interpreter, nota compiler. An interpreter takes as input an executable specification andproduces as output the result of executing the specification.SourceProgramInterpreterResultsSome languages, such as Perl, Scheme, and apl, are more often implementedwith interpreters than with compilers.Some languages adopt translation schemes that include both compilationand interpretation. Java is compiled from source code into a form calledbytecode, a compact representation intended to decrease download times forJava applications.

Java applications execute by running the bytecode on thecorresponding Java Virtual Machine (jvm), an interpreter for bytecode. Tocomplicate the picture further, many implementations of the jvm include aVirtual machineA virtual machine is a simulator for someprocessor. It is an interpreter for that machine’sinstruction set.4 CHAPTER 1 Overview of Compilationcompiler that executes at runtime, sometimes called a just-in-time compiler,or jit, that translates heavily used bytecode sequences into native code forthe underlying computer.Interpreters and compilers have much in common. They perform many of thesame tasks. Both analyze the input program and determine whether or not itis a valid program.

Both build an internal model of the structure and meaning of the program. Both determine where to store values during execution.However, interpreting the code to produce a result is quite different fromemitting a translated program that can be executed to produce the result. Thisbook focuses on the problems that arise in building compilers.

However, animplementor of interpreters may find much of the material relevant.Why Study Compiler Construction?A compiler is a large, complex program. Compilers often include hundredsof thousands, if not millions, of lines of code, organized into multiple subsystems and components. The various parts of a compiler interact in complexways. Design decisions made for one part of the compiler have important ramifications for other parts. Thus, the design and implementation ofa compiler is a substantial exercise in software engineering.A good compiler contains a microcosm of computer science.

It makes practical use of greedy algorithms (register allocation), heuristic search techniques(list scheduling), graph algorithms (dead-code elimination), dynamic programming (instruction selection), finite automata and push-down automata(scanning and parsing), and fixed-point algorithms (data-flow analysis). Itdeals with problems such as dynamic allocation, synchronization, naming, locality, memory hierarchy management, and pipeline scheduling.

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Нашёл ошибку?
Или хочешь предложить что-то улучшить на этой странице? Напиши об этом и получи бонус!
Бонус рассчитывается индивидуально в каждом случае и может быть в виде баллов или бесплатной услуги от студизбы.
Предложить исправление
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
5138
Авторов
на СтудИзбе
443
Средний доход
с одного платного файла
Обучение Подробнее