Implementing Programming Languages. An Introduction to Compilers and Interpreters (Paperback)

Aarne Ranta

  • 出版商: College Publications
  • 出版日期: 2012-05-09
  • 售價: $990
  • 貴賓價: 9.5$941
  • 語言: 英文
  • 頁數: 224
  • 裝訂: Paperback
  • ISBN: 1848900643
  • ISBN-13: 9781848900646
  • 相關分類: Compiler
  • 海外代購書籍(需單獨結帳)

買這商品的人也買了...

商品描述

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.

商品描述(中文翻譯)

實作一種程式語言意味著將程式設計師的高階思維與機器的零與一之間架起橋樑。如果這個過程能夠以高效且可靠的方式進行,程式設計師就能專注於他們必須解決的實際問題,而不是機器的細節。然而,理解從語言到機器的整個鏈條仍然是任何認真程式設計師訓練中不可或缺的一部分。這將使程式設計師變得更有能力,並且能夠開發新的語言。新的語言往往是解決問題的最佳方式,並且比聽起來更不困難。本書採用基於理論的實踐方法,理論模型作為實際編碼的藍圖。讀者將被引導以良好理解且可擴展的方式構建編譯器和解釋器。此外,這些解決方案也可以移植到不同的實作語言。大部分實際代碼是通過使用 BNF Converter 工具從語言的文法自動生成的。其餘部分可以用 Haskell 或 Java 編寫,書中提供了詳細的指導,但經過一些調整也可以用 C、C++、C# 或 OCaml 編寫,這些語言都受到 BNF Converter 的支持。本書的主要焦點是標準的命令式和函數式語言:C++ 的一個子集和 Haskell 的一個子集是源語言,而 Java 虛擬機是主要目標。簡單的 Intel x86 原生代碼編譯被展示以完成從語言到機器的鏈條。最後一章則偏離標準路徑,探索從最小的圖靈完備語言到自然語言的人機互動的語言設計空間。