|
|
Books > Computing & IT > Computer programming > Compilers & interpreters
Become familiar with the LLVM infrastructure and start using LLVM
libraries to design a compiler About This Book * Learn to use the
LLVM libraries to emit intermediate representation (IR) from
high-level language * Build your own optimization pass for better
code generation * Understand AST generation and use it in a
meaningful way Who This Book Is For This book is intended for those
who already know some of the concepts of compilers and want to
quickly get familiar with the LLVM infrastructure and the rich set
of libraries that it provides. What You Will Learn * Get an
introduction to LLVM modular design and LLVM tools * Convert
frontend code to LLVM IR * Implement advanced LLVM IR paradigms *
Understand the LLVM IR Optimization Pass Manager infrastructure and
write an optimization pass * Absorb LLVM IR transformations *
Understand the steps involved in converting LLVM IR to Selection
DAG * Implement a custom target using the LLVM infrastructure * Get
a grasp of C's frontend clang, an AST dump, and static analysis In
Detail LLVM is currently the point of interest for many firms, and
has a very active open source community. It provides us with a
compiler infrastructure that can be used to write a compiler for a
language. It provides us with a set of reusable libraries that can
be used to optimize code, and a target-independent code generator
to generate code for different backends. It also provides us with a
lot of other utility tools that can be easily integrated into
compiler projects. This book details how you can use the LLVM
compiler infrastructure libraries effectively, and will enable you
to design your own custom compiler with LLVM in a snap. We start
with the basics, where you'll get to know all about LLVM. We then
cover how you can use LLVM library calls to emit intermediate
representation (IR) of simple and complex high-level language
paradigms. Moving on, we show you how to implement optimizations at
different levels, write an optimization pass, generate code that is
independent of a target, and then map the code generated to a
backend. The book also walks you through CLANG, IR to IR
transformations, advanced IR block transformations, and target
machines. By the end of this book, you'll be able to easily utilize
the LLVM libraries in your own projects. Style and approach This
book deals with topics sequentially, increasing the difficulty
level in a step-by-step approach. Each topic is explained with a
detailed example, and screenshots are included to help you
understand the examples.
Implementing a programming language means bridging the gap from the
programmer's high-level thinking to the machine's zeros and ones.
If this is done in an efficient and reliable way, programmers can
concentrate on the actual problems they have to solve, rather than
on the details of machines. But understanding the whole chain from
languages to machines is still an essential part of the training of
any serious programmer. It will result in a more competent
programmer, who will moreover be able to develop new languages. A
new language is often the best way to solve a problem, and less
difficult than it may sound. This book follows a theory-based
practical approach, where theoretical models serve as blueprint for
actual coding. The reader is guided to build compilers and
interpreters in a well-understood and scalable way. The solutions
are moreover portable to different implementation languages. Much
of the actual code is automatically generated from a grammar of the
language, by using the BNF Converter tool. The rest can be written
in Haskell or Java, for which the book gives detailed guidance, but
with some adaptation also in C, C]+, C#, or OCaml, which are
supported by the BNF Converter. The main focus of the book is on
standard imperative and functional languages: a subset of C++ and a
subset of Haskell are the source languages, and Java Virtual
Machine is the main target. Simple Intel x86 native code
compilation is shown to complete the chain from language to
machine. The last chapter leaves the standard paths and explores
the space of language design ranging from minimal Turing-complete
languages to human-computer interaction in natural language.
This exciting and practical book for compiler construction combines
history and development of several early programming languages
together with sufficient theory to develop a compiler for an
extensive language. The book reflects the author's views that
compiler construction can best be learned by the actual
implementation of a compiler. A source language, equivalent to
early translating languages, is developed. An object language
consisting entirely of numbers is also developed. The student will
learn to write programs in the developed source and object
language. Using the language C++, the author gently leads the
student through the steps which are necessary to complete a working
compiler in a one-semester effort. Extensive exercises at the end
of each chapter keep the student's focus on the big project - the
implementation of a working compiler.
Long-awaited revision to a unique guide that covers both compilers
and interpreters Revised, updated, and now focusing on Java instead
of C++, this long-awaited, latest edition of this popular book
teaches programmers and software engineering students how to write
compilers and interpreters using Java. You?ll write compilers and
interpreters as case studies, generating general assembly code for
a Java Virtual Machine that takes advantage of the Java Collections
Framework to shorten and simplify the code. In addition, coverage
includes Java Collections Framework, UML modeling, object-oriented
programming with design patterns, working with XML intermediate
code, and more.
|
You may like...
Black And Female
Tsitsi Dangarembga
Paperback
(1)
R320
R286
Discovery Miles 2 860
Hot Water
Nadine Dirks
Paperback
R280
R259
Discovery Miles 2 590
|