xvi Programming Language Processors in Java in Java Draw USS Code 128 in Java xvi Programming Language Processors in Java

xvi Programming Language Processors in Java generate, create barcode 128 none for java projects QR Codes corners!) The reader o code-128c for Java f this textbook will need a good knowledge of syntax, and ideally some knowledge of semantics; these topics are briefly reviewed in 1 for the benefit of readers who might lack such knowledge. Familiarity with BNF and EBNF (which are commonly used in language specifications) is essential, because in 4 we show how to exploit them in syntactic analysis. No knowledge of formal semantics is assumed.

The reader should be comfortable with some elementary concepts from discrete mathematics - sets and recursive functions - as these help to sharpen understanding of, for example, parsing algorithms. Discrete mathematics is essential for a deeper understanding of compiler theory; however, only a minimum of compiler theory is presented in this book. This book and its companions attempt to cover all the most important aspects of a large subject.

Where necessary, depth has been sacrificed for breadth. Thus the really serious student will need to follow up with more advanced studies. Each book has an extensive bibliography, and each chapter closes with pointers to further reading on the topics covered by the chapter.

. Acknowledgments Most of the methods de j2se Code 128B scribed in this textbook have long since passed into compiler folklore, and are almost impossible to attribute to individuals. Instead, we shall mention people who have particularly influenced us personally. For providing a stimulating environment in which to think about programming language issues, we are grateful to colleagues in the Department of Computing Science at the University of Glasgow, in particular Malcolm Atkinson, Muffy Calder, Quintin Cutts, Peter Dickman, Bill Findlay, John Hughes, John Launchbury, Hermano Moura, John Patterson, Simon Peyton Jones, Fermin Reig, Phil Trinder, and Phil Wadler.

We have also been strongly influenced, in many different ways, by the work of Peter Buneman, Luca Cardelli, Edsger Dijkstra, Jim Gosling, Susan Graham, Tony Hoare, Jean Ichbiah, Mehdi Jazayeri, Robin Milner, Peter Mosses, Atsushi Ohori, Bob Tennent, Jim Welsh, and Niklaus Wirth. We wish to thank the reviewers for reading and providing valuable comments on an earlier draft of this book. Numerous cohorts of undergraduate students taking the Programming Languages 3 module at the University of Glasgow made an involuntary but essential contribution by class-testing the Triangle language processor, as have three cohorts of students taking the Compilers module at the Robert Gordon University.

We are particularly grateful to Tony Hoare, editor of the Prentice Hall International Series in Computer Science, for his encouragement and advice, freely and generously offered when these books were still at the planning stage. If this book is more than just another compiler textbook, that is partly due to his suggestion to emphasize the connections between compilation, interpretation, and semantics. Glasgow and Aberdeen July, 1999 D.

A.W. D.


CHAPTER ONE Introduction In this introductory c hapter we start by reviewing the distinction between low-level and high-level programming languages. We then see what is meant by a programming language processor, and look at examples from different programming systems. We review the specification of the syntax and semantics of programming languages.

Finally, we look at Triangle, a programming language that will be used as a case study throughout this book.. Levels of programming language Programming languages are the basic tools of all programmers. A programming language is a formal notation for expressing algorithms. Now, an algorithm is an abstract concept, and has an existence independent of any particular notation in which it might be expressed.

Without a notation, however, we cannot express an algorithm, nor communicate it to others, nor reason about its correctness. Practicing programmers, of course, are concerned not only with expressing and analyzing algorithms, but also with constructing software that instructs machines to perform useful tasks. For this purpose programmers need facilities to enter, edit, translate, and interpret programs on machines.

Tools that perform these tasks are called programming language processors, and are the subject of this book. Machines are driven by programs expressed in machine code (or muchine language). A machine-code program is a sequence of instructions, where each instruction is just a bit string that is interpreted by the machine to perform some defined operation.

Typical machine-code instructions perform primitive operations like the following: Load an item of data from memory address 366. Add two numbers held in registers 1 and 2. Jump to instruction 13 if the result of the previous operation was zero.

In the very early days of computing, programs were written directly in machine code. The above instructions might be written, respectively, as follows:.
Copyright © . All rights reserved.