Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2021-02-01 17:40:29
Size: 56
Editor: zbjxb
Comment:
Revision 3 as of 2021-02-01 17:46:32
Size: 1213
Editor: zbjxb
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
在这里详述 compiler/Let's build a compiler/ch1。 申明不会采用典型教科书上关于编译器的教学顺序,比如:
 o An introductory chapter describing what a compiler is.

 o A chapter or two on syntax equations, using Backus-Naur Form
   (BNF).

 o A chapter or two on lexical scanning, with emphasis on
   deterministic and non-deterministic finite automata.

 o Several chapters on parsing theory, beginning with top-down
   recursive descent, and ending with LALR parsers.

 o A chapter on intermediate languages, with emphasis on P-code
   and similar reverse polish representations.

 o Many chapters on alternative ways to handle subroutines and
   parameter passing, type declarations, and such.

 o A chapter toward the end on code generation, usually for some
   imaginary CPU with a simple instruction set. Most readers
   (and in fact, most college classes) never make it this far.

 o A final chapter or two on optimization. This chapter often
   goes unread, too.

作者不会遵照这些,而是带着你直接上手写一个能工作的编译器,采用他的方式:
 1. KISS原则
  * 所有的Identifier用single character来代替,不考虑空格(即词法规定不允许用户写空格)

申明不会采用典型教科书上关于编译器的教学顺序,比如:

  • o An introductory chapter describing what a compiler is. o A chapter or two on syntax equations, using Backus-Naur Form
    • (BNF).
    o A chapter or two on lexical scanning, with emphasis on
    • deterministic and non-deterministic finite automata.
    o Several chapters on parsing theory, beginning with top-down
    • recursive descent, and ending with LALR parsers.
    o A chapter on intermediate languages, with emphasis on P-code
    • and similar reverse polish representations.
    o Many chapters on alternative ways to handle subroutines and
    • parameter passing, type declarations, and such.
    o A chapter toward the end on code generation, usually for some
    • imaginary CPU with a simple instruction set. Most readers (and in fact, most college classes) never make it this far.
    o A final chapter or two on optimization. This chapter often
    • goes unread, too.

作者不会遵照这些,而是带着你直接上手写一个能工作的编译器,采用他的方式:

  1. KISS原则
    • 所有的Identifier用single character来代替,不考虑空格(即词法规定不允许用户写空格)

compiler/Let's build a compiler/ch1 (last edited 2021-02-18 02:59:19 by zbjxb)