编译原理
自制编译器 豆瓣
ふつうのコンパイラをつくろう
作者: [日] 青木峰郎 译者: 严圣逸 / 绝云 人民邮电出版社 2016 - 6
本书将带领读者从头开始制作一门语言的编译器。笔者特意为本书设计了CЬ语言,CЬ可以说是C语言的子集,实现了包括指针运算等在内的C语言的主要部分。本书所实现的编译器就是C Ь语言的编译器, 是实实在在的编译器,而非有诸多限制的玩具。另外,除编译器之外,本书对以编译器为中心的编程语言的运行环境,即编译器、汇编器、链接器、硬件、运行时环境等都有所提及,介绍了程序运行的所有环节。
自制编程语言 豆瓣
プログラミング言語を作る
作者: [日] 前桥和弥 译者: 刘卓 / 徐谦 人民邮电出版社 2013 - 11
本书手把手地教读者用C语言制作两种编程语言:crowbar与Diksam。crowbar是运行分析树的无类型语言,Diksam是运行字节码的静态类型语言。这两种语言都具备四则运算、变量、条件分支、循环、函数定义、垃圾回收等功能,最终版则可以支持面向对象、异常处理等高级机制。所有源代码都提供下载,读者可以一边对照书中的说明一边调试源代码。这个过程对理解程序的运行机制十分有帮助。
本书适合有一定基础的程序员和编程语言爱好者阅读。
Language Implementation Patterns 豆瓣
作者: Terence Parr Pragmatic Bookshelf 2010 - 1
Knowing how to create domain-specific languages (DSLs) can give you a huge productivity boost. Instead of writing code in a general-purpose programming language, you can first build a custom language tailored to make you efficient in a particular domain. The key is understanding the common patterns found across language implementations. "Language Design Patterns" identifies and condenses the most common design patterns, providing sample implementations of each. The pattern implementations use Java, but the patterns themselves are completely general. Some of the implementations use the well-known ANTLR parser generator, so readers will find this book an excellent source of ANTLR examples as well. But this book will benefit anyone interested in implementing languages, regardless of their tool of choice. Other language implementation books focus on compilers, which you rarely need in your daily life. Instead, "Language Design Patterns" shows you patterns you can use for all kinds of language applications. You'll learn to create configuration file readers, data readers, model-driven code generators, source-to-source translators, source analyzers, and interpreters. Each chapter groups related design patterns and, in each pattern, you'll get hands-on experience by building a complete sample implementation. By the time you finish the book, you'll know how to solve most common language implementation problems.
Writing An Interpreter In Go 豆瓣
作者: Thorsten Ball Thorsten Ball 2017 - 2
In this book we will create a programming language together. We'll start with 0 lines of code and end up with a fully working interpreter for the Monkey* programming language.
Step by step. From tokens to output. All code shown and included. Fully tested.
Buy this book to learn:
How to build an interpreter for a C-like programming language from scratch
What a lexer, a parser and an Abstract Syntax Tree (AST) are and how to build your own
What closures are and how and why they work
What the Pratt parsing technique and a recursive descent parser is
What others talk about when they talk about built-in data structures
What REPL stands for and how to build one
Why this book?
This is the book I wanted to have a year ago. This is the book I couldn't find. I wrote this book for you and me. So why should you buy it? What's different about it, compared to other interpreter or compiler literature?
Working code is the focus. Code is not just found in the appendix. Code is the main focus of this book.
It's small! It has around 200 pages of which a great deal are readable, syntax-highlighted, working code.
The code presented in the book is easy to understand, easy to extend, easy to maintain.
No 3rd party libraries! You're not left wondering: "But how does tool X do that?" We won't use a tool X. We only use the Go standard library and write everything ourselves.
Tests! The interpreter we build in the book is fully tested! Sometimes in TDD style, sometimes with the tests written after. You can easily run the tests to experiment with the interpreter and make changes.
Why this book?
This book is for you if you...
learn by building, love to look under the hood
love programming and to program for the sake of learning and joy!
are interested in how your favorite, interpreted programming language works
never took a compiler course in college
want to get started with interpreters or compilers…
... but don't want to work through a theory-heavy, 800 pages, 4 pounds compiler book as a beginner
kept screaming "show me the code!" when reading about interpreters and compilers
always wanted to say: "Holy shit, I built a programming language!"
自己动手写Java虚拟机 豆瓣
作者: 张秀宏 2016 - 6
Java虚拟机非常复杂,要想真正理解它的工作原理,最好的方式就是自己动手编写一个!
本书是继《深入理解Java虚拟机》之后的又一经典著作,它一方面遵循《Java虚拟机规范》,一方面又独辟蹊径,不仅能让Java虚拟机的学习变得更加简单和有趣,而且能让你对Java虚拟机的原理认识更深入和更深刻!
本书摒弃了传统的以解读枯燥的Java虚拟机规范文档和分析繁琐的Java虚拟机源代码的方式来讲解Java虚拟机,取而代之的是,以实践的方式,引导读者如何从零开始构建和实现一个Java虚拟机,整个过程不仅能让读者做到对Java虚拟机知其然而且知其所以然,还能屏蔽大量不必要的繁琐细节,体会到实现过程中的成就感,让学习过程更加轻松、愉悦和高效。更重要的是,这种方式能引导读者更深入地认识和掌握Java虚拟机的工作原理。