Work Note 2, DM546, Spring 2018
Lecture February 6
Background material: Appel Chapter 3.
Syntax analysis (parsing).
Exercises February 9
With regards to literature and material on C, flex, etc., see the
Appel 2.1 a-f.
Discuss the C programming style introduced in Appel, Chapter 1.
Make changes in Program 1.5 corresponding to the addition of the
following rules to Grammar 1.3:
- Exp -> string
- Exp -> sqrt ( Exp )
- Stm -> if ( Exp ) then Stm
Read about Flex. Make an overview of the additional possibilities
for specifying regular expressions which are available in the tool
compared with what was discussed at the lecture.
What does the following regular expressions match?
Make and test the following three Flex scanners:
Make texts politically correct. Replace "idiot" with
"intellectually challenged person", etc.
Remove all whitespace and produce lines in lengths of 80 characters.
Remove all tags from an HTML document.
For those who do not speak HTML fluently, HTML is just regular
text with some extra interpreted constructions.
A "tag" consists of a "less than" symbol followed by some text
and closed by a "greater than" symbol
(you can view the source of this page to see an example).