Question
Involves completing C program formatter written in Java. That program terminates when it encounters if, for, even as, or do statements. It must be modified to include code to format following statements in the fashion shown below-
if_statement ::=
if (expression)
statement
[else
statement]
for_statement ::=
for ([expression]; [expression]; [expression])
statement
while_statement ::=
while (expression)
statement
do_statement ::=
do
statement
while (expression);
Be sure to notice that supplied program already handles compound statements, which are delimited by braces, so the code that you add have to not treat compound statements as a special case.