%{
#include <stdio.h>
typedef char *CHAR_PTR;
CHAR_PTR temp,temp1;
#define YYSTYPE CHAR_PTR
extern int tab_count;
%}
%token STR

%%

s: 
     | t s
     | '(' {  printf("\n"); tab_count++;puttab(tab_count);printf("( "); 
                  } s  
           ')' {  puttab(tab_count); printf(")\n"); tab_count--;}  s
    ;
t:  STR { printf("%s \n",$1); }

    ;

%%
int tab_count=0;
main()
{     yyparse();
 }
puttab(int i)
{ int j;
  for(j=0;j<i;j++)
   printf("\t");
}
