Download Language development case study (Pdf, 133 pages)

Transcript
Contents
1 Translation tools
1.1 The spectrum of language translators and the limitations of single pass translators
1.2 Intermediate forms, and translation to virtual machine code
1.3 The mini family
1
2 The minicalc language: a simple calculator with declared variables
2.1 minicalc features
2.2 minicalc limitations
2.3 A grammar for minicalc
2.3.1 Specifying expressions
2.4 Hints on selecting operator priority and associativity
2.5 A minicalc syntax checker
7
7
8
8
10
14
14
3 An interpreter for minicalc
3.1 Declaring symbol tables
3.2 Using synthesized attributes
3.3 Expression evaluation
3.4 Accessing the symbol table
17
17
20
20
21
4 The minicond language: interpretation with conditionals
4.1 A grammar for minicond
4.2 Adding conditional operators
4.3 Using inherited attributes
4.4 Using semantic rules
4.5 Adding conditional execution
4.5.1 Semantic actions for conditional execution
4.6 Next steps
23
23
27
27
28
29
31
31
5 The Mini Virtual Machine (MVM)
5.1 MVM memory
5.2 MVM instruction execution
5.3 MVM addressing modes
5.4 MVM instructions
5.4.1 Instruction set capabilities
5.4.2 Address mode encoding
5.5 Example MVM instructions
33
34
35
36
37
37
37
38
1
3
4