CST 8152 Compilers Midterm #1 Review Questions
What is a compiler? an interpreter?
Where does compilation fit in the steps that make up Language Processing?
- What is the output of each step of the process?
What is the front end of a compiler? the back end?
Name and describe the function of each of the three parts of the compiler front end.
- What is the output of each of the three parts?
- Give C Language examples of errors that would be detected in each part.
Name and describe the basic functions of the compiler back end.
Define these terms: lexeme, token, parsing, parse tree
Why is syntax analysis usually recursive, where lexical analysis is not?
What are the meanings of the Regular Expression operators *, +, and ? ?
Given a description of a set of strings, write a Regular Expression that matches those strings.
- e.g. strings of letters ending in a or bcd
- e.g. strings of digits containing a 3 before a 5
- e.g. unsigned integer constant, unsigned floating constant
Given a Regular Expression, give examples of strings matched by the expression.
What is a Finite State Machine (FSM)?
What restrictions are placed on a FSM to make it a Deterministic Finite Automaton (DFA)?
Given a Regular Expression, write the DFA that recognizes it (or vice-versa).
Given a DFA, write its corresponding Transition Table (or vice-versa).
Write a C Language NextState() function that implements a given Transition Table.
Write a while() loop that uses the NextState() function to implement a DFA.
Given a Grammar, construct a Parse Tree that shows how a sentence in the language is recognized.
Given a Grammar, and a Scanner that returned the next Token, derive the simple C Language functions for a recursive descent parser that would recognize each of the production rules in the grammar.
- e.g. expression(), factor(), term()