LANGUAGES def: A *language* is a set of strings of characters (from some alphabet) Characters are: For a human language: alphabetical characters (a, b, c, ...) For a computer (language): codes in some character set (ASCII characters or unicode) LANGUAGE CLASSES Languages can be classified by the kind of grammar needed to recognize them Venn Diagram: |--------------------------------------| | Regular Languages | | | | | | |--------------------------------| | | | Contex-free Languages | | | | | | | | | | | | |--------------------------| | | | | | Context-sensitive | | | | | | Languages | | | | | | | | | | | | | | | | | | |--------------------| | | | | | | | Type 0 Languages | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |--------------------| | | | | | | | | | | | |--------------------------| | | | | | | | |--------------------------------| | | | |--------------------------------------| PHASES OF A COMPILER Programs allowed by a compiler's: |--------------------------------------| | Lexical Analysis (Lexer) | | regular grammar | | | | |--------------------------------| | | | Parser | | | | context-free grammar | | | | | | | | |--------------------------| | | | | | Static Analysis | | | | | | | | | | | | context-sensitive | | | | | | grammar | | | | | | |--------------------| | | | | | | | Runtime checks | | | | | | | | | | | | | | | | type 0 grammar | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |--------------------| | | | | | | | | | | | |--------------------------| | | | | | | | |--------------------------------| | | | |--------------------------------------| 3*4+2 (3*4) + 2 3 * (4+2)