include/s_tree.h
void show_form(tree_nd *root)
{
    if (!root)
        return;

    if (!root->l && !root->r)
    {
        printf("%s", root->tok);
        return;
    }
    
    if (!strcmp(root->tok, "-"))
    {
        printf("%s", root->tok);
    }
    
    if (root->l)
    {
        bool verify = (root->l->l && root->l->r
                     && (strcmp(root->tok, root->l->tok) || !strcmp(root->tok, ">")
                     || ALL_PAR)) ? 1: 0;

        if (verify)
            putchar('(');
        
        show_form(root->l);

        if (verify)
            putchar(')');
    }

    if (strstr("&#>", root->tok))
    {
        putchar(' ');
        printf("%s", root->tok);
        putchar(' ');
    }

    if (root->r)
    {
        bool verify = (root->r->l && root->r->r && (strcmp(root->tok, root->r->tok)
                     || ALL_PAR)) ? 1 : 0;
        if (verify)
            putchar('(');

        show_form(root->r);

        if (verify)
            putchar(')');
    }
}
/*
    A modified "in order" funtion.
    Used for printing the parentesized formula from the syntax tree
*/
A modified "in order" funtion.
Used for printing the parentesized formula from the syntax tree
A modified " in order " funtion . Used for printing the parentesized formula from the syntax tree
void show_form(tree_nd *root)
{
    if (!root)
        return;
    if (!root->l && !root->r)
    {
        printf("%s", root->tok);
        return;
    }
    if (!strcmp(root->tok, "-"))
    {
        printf("%s", root->tok);
    }
    if (root->l)
    {
        bool verify = (root->l->l && root->l->r
                     && (strcmp(root->tok, root->l->tok) || !strcmp(root->tok, ">")
                     || ALL_PAR)) ? 1: 0;
        if (verify)
            putchar('(');
        show_form(root->l);
        if (verify)
            putchar(')');
    }
    if (strstr("&#>", root->tok))
    {
        putchar(' ');
        printf("%s", root->tok);
        putchar(' ');
    }
    if (root->r)
    {
        bool verify = (root->r->l && root->r->r && (strcmp(root->tok, root->r->tok)
                     || ALL_PAR)) ? 1 : 0;
        if (verify)
            putchar('(');
        show_form(root->r);
        if (verify)
            putchar(')');
    }
}
void show_form ( tree_nd * root ) { if ( ! root ) return ; if ( ! root -> l && ! root -> r ) { printf ( " " , root -> tok ) ; return ; } if ( ! strcmp ( root -> tok , " " ) ) { printf ( " " , root -> tok ) ; } if ( root -> l ) { bool verify = ( root -> l -> l && root -> l -> r && ( strcmp ( root -> tok , root -> l -> tok ) || ! strcmp ( root -> tok , " " ) || ALL_PAR ) ) ? 1 : 0 ; if ( verify ) putchar ( ' ' ) ; show_form ( root -> l ) ; if ( verify ) putchar ( ' ' ) ; } if ( strstr ( " " , root -> tok ) ) { putchar ( ' ' ) ; printf ( " " , root -> tok ) ; putchar ( ' ' ) ; } if ( root -> r ) { bool verify = ( root -> r -> l && root -> r -> r && ( strcmp ( root -> tok , root -> r -> tok ) || ALL_PAR ) ) ? 1 : 0 ; if ( verify ) putchar ( ' ' ) ; show_form ( root -> r ) ; if ( verify ) putchar ( ' ' ) ; } }
A modified "in order" funtion.
A modified " in order " funtion .