Write a filter for this text so that the output always has exactly one space between words, and the standard typographical conventions are observed for punctuation - i.e. no space before a punctuation symbol, and one space after one, except for "." which is followed by two spaces. In addition, print a list of all proper nouns at the end (a proper noun can be taken as any word that starts with a capital letter, but does not immediately follow a full-stop.)
STAT -> '{' STATSEQ '}'
STAT -> if '(' EXPR ')' STAT
STAT -> while '(' EXPR ')' STAT
STAT -> IDENT '=' EXPR ';'
STATSEQ -> STAT
| STAT STATSEQ
Assume that an EXPR is just a non-empty sequence of digits, and an
IDENT is a non-empty sequence of letters.Your task is to translate this into (really bad) LISP using the following rules:
| Translate from | to (in LISP) |
| if '(' EXPR ')' STAT | '(' COND '(' EXPR ')' '(' STAT ')' ')' |
| while '(' EXPR ')' STAT | '(' DO '(' ')' '( EXPR ')' '(' STAT ')' |
| IDENT '=' EXPR ';' | '(' SETQ IDENT '(' EXPR ')' ')' |
| '{'STAT1 STAT2 ... '}' | '(' STAT1 STAT2 ... ')' |