Goose  Artifact [e0604ab85a]

Artifact e0604ab85ad9f6217572825c48015f72ae2d8459c2f42e9c7902505f9bd23afd:

  • File bs/empathy.cpp — part of check-in [73972ef6be] at 2019-01-18 16:19:38 on branch trunk — Parser: implemented the Pratt parser skeleton. (user: achavasse size: 735)

#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;
}