Size: 1403
Comment:
|
Size: 1399
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 30: | Line 30: |
* 自顶向下、递归下降的情形,作者认为这是唯一一种支持手写编译器的技术选型 UE4 | * 自顶向下、递归下降的情形,作者认为这是唯一一种支持手写编译器的技术选型 |
申明不会采用典型教科书上关于编译器的教学顺序,比如:
- o An introductory chapter describing what a compiler is. o A chapter or two on syntax equations, using Backus-Naur Form
- (BNF).
- deterministic and non-deterministic finite automata.
- recursive descent, and ending with LALR parsers.
- and similar reverse polish representations.
- parameter passing, type declarations, and such.
- imaginary CPU with a simple instruction set. Most readers (and in fact, most college classes) never make it this far.
- goes unread, too.
作者不会遵照这些,而是带着你直接上手写一个能工作的编译器,采用他的方式:
- KISS原则
- 所有的Identifier用single character来代替,不考虑空格(即词法规定不允许用户写空格)
- 只讨论一种情形的解析:top-down、recursive descent parsing
- 自顶向下、递归下降的情形,作者认为这是唯一一种支持手写编译器的技术选型