Next: Exercise 4 Up: The Assignment Previous: Exercise 2

## Exercise 3

French car number plates satisfy the following rules.
• A number plate consists of a sequence of digits, followed by a sequence of capital letters, followed by a sequence of digits.
• The second sequence of digits has exactly two digits, and each of them could be zero.
• The first sequence of digits has 2, 3 or 4 digits and the first digit of this sequence cannot be zero.
• The sequence of letters has 2 or 3 letters.
• The letters I and O are never used.
• The letters U and V are never used together.
• The words SS and QQ cannot be a factor of the sequence of letters.
• If the sequence of letters has 3 letters then the first sequence of digits has 2 or 3 digits.
Construct with lex a lexical analyzer that will decide whether a car number plate is a valid french number plate. Here's a set number plates to test your program (some are valid french number plates, some are not)
```1234 BB 22
123 HH 02
12345 QR 02
1234 SS 12
1234 ZZZ 03
1234 AA 123
AVD 23 111 2
123 UV 12
13 UVA 56
1 AB 12
123 IA 12
123 AO 32
```

Next: Exercise 4 Up: The Assignment Previous: Exercise 2
Marc Moreno Maza
2004-12-01