/************************************************************************
 * grammer - src/main.c
 * Copyright (C) 2002 Marcello Barnaba <vjt@openssl.it>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 1, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * main program structure . . .
 */

#define MAIN
#include "struct.h"
#include "io.h"
#include "parse.h"
#include "convert.h"
#include "manip.h"

__inline void banner(void)
{
    outf("grammer v"VERSION " (C) 2002 Marcello Barnaba <vjt@openssl.it>.\n");
}

__inline void print_grammar(Grammar *G)
{
    outf("Grammar syntax verify:\n");

    outf("Grammar is syntaxically %scorrect\n",
	    verify_grammar(G) ? "" : "in");
    
    outf("\nGrammar dump:\nG = ( X, V, S, P )\n");
    print_list(G->X, 'X');
    print_list(G->V, 'V');

    outf("Start symbol: %s\n", print_part(G->S));

    print_prod(G->P);
}

int main(int argc, char **argv)
{
    Grammar *G = NULL;

    in = stdin;
    out = stdout;
    
    banner();
    G = acquire_grammar();

    print_grammar(G);

    free_grammar(G);

    return 0;
}

