Compiler Design

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Chomsky Hiearchy

- All Grammars - Context Sensitive - Context Free - Regular

Identifying Keywords

- Create Transition Diagrams for each word - Install reserved words initially in the symbol table

Analysis

- Lexical - Syntax - Semantic

Synthesis

- Target Code Generation - Target Code Optimisation

LL(K) Grammars

- eliminate ambiguities - eliminates left recursion - performs left factoring

Syntax Directed Definitions

A CFG where: - Grammar symbols are a set of attributes - Production rulles have an associated set of semantic rules for computing attribute values

Dependency Graph

A directed Graph G - (N,E) - includes nodes for each attribute in the tree - a directed edge exists between two vertices when you need X.c to compute A.b

Symbol Table

A mapping from a name to what it refers to. It's used during the analysis phase. You continuously scope the symbol table with information about what is in the scope.

Compiler

A program that transforms a program in one language to an equivalent program in another language.

Semantic Analysis

Checks semantic consistency

Syntax Analysis

Creates the syntax tree

Left Factoring

Defer prefix decisions until later. A -> aB, bB, cB.. xB becomes A -> UB U -> a|b|c|d|..

Interpreter

Directly executes the operations specified in the source, specified by inputs supplied by the user.

Disambiguating Rules

Impose precedence of certain rules. (i.e: * is greater than +).

Lexical Analysis

Reads the character streams

Top Down Parsing

Recursive Descent Parsing. The tree is constructed Top-Down, Left-Right.

Predictive Parsing

Recursive Descent with some predictions. - No backtracking!

Synthesis

Target Code Generation

Left Recursion

This is when for some non-terminal A and some string a, A^+ => Aa.

Synthesized

Value is determined by children and itself - evaluate in some bottom up order

Inherited

Value is determined by parents, siblings, and itself. - evaluate in some top down order

Ambiguous Grammars

When there exists more than one parse tree for the same string. You will need additional rules to make it clearer.


Ensembles d'études connexes

Global Climate Change Final Exam

View Set

Saunders NCLEX Ch 19 Perioperative Questions

View Set

Starting out with C++ From control Structures through Objects Ninth Edition - Chapter 1 - 4, Midterm test

View Set

Lung Cancer and Thoracic Surgery

View Set

american history (US imperialism)

View Set

Biology Chapter 1 Quiz: Exploring Life and Science

View Set