Implementing Programming Languages: An Introduction to Compilers and Interpreters

Implementing Programming Languages: An Introduction to Compilers and Interpreters

简介:

实现一种编程语言意味着弥合从程序员的高级思维到机器的零和一的差距。如果以高效可靠的方式做到这一点,程序员就可以专注于他们必须解决的实际问题,而不是机器的细节。但是,了解从语言到机器的整个链条仍然是任何认真的程序员培训的重要组成部分。这将导致一个更有能力的程序员,谁也将能够开发新的语言。一种新语言通常是解决问题的最佳方法,而且难度比听起来要小。本书遵循基于理论的实践方法,其中理论模型作为实际编码的蓝图。读者被引导以易于理解和可扩展的方式构建编译器和解释器。此外,该解决方案可移植到不同的实现语言。通过使用BNF转换器工具,大部分实际代码是从语言的语法自动生成的。其余部分可以用Haskell或Java编写,本书对此提供了详细的指导,但在BNF转换器支持的C,C,C # 或OCaml中也有一些改编。本书的主要重点是标准命令式和函数式语言: C的子集和Haskell的子集是源语言,java虚拟机是主要目标。简单的英特尔x86本机代码编译显示完成从语言到机器的链。最后一章离开了标准路径,并探讨了语言设计的空间,从最小的图灵完备语言到自然语言中的人机交互。

英文简介:

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.

书名
Implementing Programming Languages: An Introduction to Compilers and Interpreters
译名
实现编程语言:编译器和解释器简介
语言
英语
年份
2012
页数
133页
大小
714.08 kB
标签
  • 编译器
  • 下载
    pdf iconImplementing Programming Languages: An Introduction to Compilers and Interpreters.pdf
    密码
    65536

    最后更新:2025-04-12 23:54:39

    ←Basics of Compiler Design

    →Compiler Design in C