Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
Basics of Compiler Design
Torben Ægidius Mogensen
DIKUUniversity of Copenhagen
 
Publishing address:DIKUUniversity of CopenhagenUniversitetsparken 1DK-2100 CopenhagenDENMARKc
Torben Ægidius Mogensen 2000 – 2007
torbenm@diku.dk
Book homepage:
http://www.diku.dk/˜torbenm/Basics
First published 2000This edition: April 10, 2007
 
Contents
1 Introduction 13
1.1 What is a compiler? . . . . . . . . . . . . . . . . . . . . . . . . . 131.2 The phases of a compiler . . . . . . . . . . . . . . . . . . . . . . 141.3 Interpreters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.4 Why learn about compilers? . . . . . . . . . . . . . . . . . . . . 161.5 The structure of this book . . . . . . . . . . . . . . . . . . . . . . 171.6 To the lecturer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181.7 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . 191.8 Permission to use . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2 Lexical Analysis 21
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.2 Regular expressions . . . . . . . . . . . . . . . . . . . . . . . . . 222.2.1 Shorthands . . . . . . . . . . . . . . . . . . . . . . . . . 242.2.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 252.3 Nondeterministic nite automata . . . . . . . . . . . . . . . . . . 272.4 Converting a regular expression to an NFA . . . . . . . . . . . . . 302.4.1 Optimisations . . . . . . . . . . . . . . . . . . . . . . . . 302.5 Deterministic nite automata . . . . . . . . . . . . . . . . . . . . 322.6 Converting an NFA to a DFA . . . . . . . . . . . . . . . . . . . . 342.6.1 Solving set equations . . . . . . . . . . . . . . . . . . . . 352.6.2 The subset construction . . . . . . . . . . . . . . . . . . . 372.7 Size versus speed . . . . . . . . . . . . . . . . . . . . . . . . . . 402.8 Minimisation of DFAs . . . . . . . . . . . . . . . . . . . . . . . 412.8.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . 422.8.2 Dead states . . . . . . . . . . . . . . . . . . . . . . . . . 452.9 Lexers and lexer generators . . . . . . . . . . . . . . . . . . . . . 462.9.1 Lexer generators . . . . . . . . . . . . . . . . . . . . . . 512.10 Properties of regular languages . . . . . . . . . . . . . . . . . . . 522.10.1 Relative expressive power . . . . . . . . . . . . . . . . . 532.10.2 Limits to expressive power . . . . . . . . . . . . . . . . . 543
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more