Goose  empathy.cpp at [73972ef6be]

File bs/empathy.cpp artifact e0604ab85a part of check-in 73972ef6be


#include "ir/ir.h"
#include "sema/sema.h"
#include "lex/lexer.h"

using namespace std;
using namespace empathy;
using namespace empathy::util;

int main( int argc, char** argv )
{
    // Just a dumping place for simple test code for now.
    auto filename = make_shared< string >( "em/lib/empathy.em" );

    ifstream sourcefile( filename->c_str() );
    if( !sourcefile.good() )
    {
        cout << "can't open '" << *filename << "'\n";
        return EXIT_FAILURE;
    }

    // Simple lexer test
    Lexer lex( sourcefile, filename );

    while( !lex.eos() )
    {
        auto tok = lex.consume();
        if( !tok )
            break;

        cout << tok->location() << "  " << *tok << endl;
    }

    return EXIT_SUCCESS;
}