The English Calculator

Due in Thursday 26th October
Write a program that reads arithmetic questions in English and prints the answers in English. It should work for all positive integers with 9 or fewer digits, and produce properly grammatical output.


Examples...

Input from user: What is twenty six times thirty four
produces output: twenty six times thirty four is eight hundred and eighty four
Input from user: What is six and six
produces output: six plus six is twelve

Of course you may use the number saying function developed in the previous homework to produce the output. All you need to worry about is the input side of the assignment. You may use any material presented in class in any way you see fit.

This assignment introduces Parsing, an exceptionally valuable technique. It does take a little time to come to terms with everything the first time you see it, so make sure you don't wait until the last moment before starting. Very few professional programmers know how to do parsing properly. This is a skill that (if mastered) can really impress potential employers. For this reason, there is plenty of extra credit available for people who do fancy extras. You might like to think of extending the program's ability to understand English beyond mere arithmetic questions, or you might like to make the program into a translator, so that it can answer such questions as:

Input from user: What is the French for one hundred and ninety nine
produces output: cent quatre vingt dix neuf
Input from user: quantum facit octo et sex
produces output: octo et sex faciunt quattuordecim

Warning: Do not expend time on the extra credit until you have got the main assignment done properly.