Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
aconvert.grammar.cpp 673 B
#include <iostream>
#include <cstdlib>

#include <GrammarFactory.h>
#include <AlibException.h>
#include <sax/SaxInterface.h>

#include "GrammarPrinter.h"


#define VERSION "0.0.1"
#define USAGE "aconvert.grammar [inputfile]"

using namespace grammar;
using namespace sax;
using namespace alib;

int main(int argc, char** argv)
{
    try
    {
        string input( istreambuf_iterator<char>( cin ), ( istreambuf_iterator<char>( ) ) );

        UnknownGrammar g = GrammarFactory::fromString( input );

        GrammarPrinter printer( cout );
        printer.print( g );
    }
    catch( AlibException & e )
    {
        cout << e.what( ) << endl;
        return 0;
    }
}