Dana Vrajitoru
C311 Programming Languages

Homework 10

Due Date: Thursday, November 19, 2009.

Reference. The Lisp implementation of the first grammar shown in class : grammar1.el.

Ex. 1. a Write a regular grammar to recognize a comment in a C++ program. A comment starts with /* and ends with */ and anything else in between can be ignored. We won't consider the case of nested comments. Draw the finite state machine for this grammar.

b. Draw a table for the finite state machine in the slides, found in the slide marked Example following the slide titled NFA to DFA. The machine is the one at the bottom of the slide containing the state VW. Consider that the arrow going from VW to end is marked by anything else than an a or a b.

c. Consider the regular grammar in the slides that recognizes a real number. Draw a finite state machine for it.

Ex. 2. Considering the finite state machine refered in Ex. 1 b, write the equivalent regular grammar and a Lisp program recognizing lists composed of symbols that are accepted by the grammar / automaton. Show some examples of lists recognized/not recognized by the grammar.

Send the file(s) by email as attachment(s). You can turn in the written part you on paper.