词条 | Böhm's language |
释义 |
The compilerBöhm's work described the first complete meta-circular compiler. The code for the compiler was remarkably precise, and consisted of only 114 lines of code.[2] Since the language accepted only two kinds of expressions: fully parenthesized or without parenthesis, but with operator precedence, therefore the code of the compiler split into two parts. 59 lines were used to handle formulas with parenthesis, 51 to handle operator precedence expressions and 4 to decide between those two cases.[3] Böhm's parsing technique for expressions had only linear complexity. It generated instructions to a structure similar to a binary tree.[4] The languageBöhm's language consisted of only assignment operations. It had no special constructs like user defined functions, control structures. Variables represented only non-negative integers. To perform a jump one had to write to a special π variable. To perform I/O ? symbol was used.[5] An example program which loads 11-element array from an input would look as follows. A. Set i = 0 (plus the π → G base address 100 for 100 → i the input array a). B → π B. Let a new input a[i] be π' → B given. Increase i by unity, ? → ↓i and stop if i > 10, i+1 → i otherwise repeat B. [(1∩(i∸110))∙Ω]+[(1∸(i∸110))∙B] → π ∩ represents a minimum operator and ∸ logical difference. References1. ^Knuth, p. 36 2. ^Knuth, p. 36 3. ^Knuth, p. 39 4. ^Knuth, p. 40 5. ^Knuth, p. 36-37 Sources
4 : Translation|Computer languages|Computer data|Encodings |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。