1
2
3
4
5
6
7
8
9
10
11
12
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
+
|
#include "compiler.h"
#include "builtins/builtins.h"
#include "builtins/helpers.h"
#include "sema/sema.h"
#include "execute/execute.h"
#include "llvm/Support/TargetSelect.h"
using namespace empathy;
using namespace empathy::util;
using namespace empathy::ir;
Compiler::Compiler( int argc, char** argv ) :
m_pEnv( make_shared< sema::Env >() )
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
+
+
+
+
+
+
|
} );
builtins::RegisterBuiltinFunc< void ( string ) >( *m_pEnv, "Print"_sid,
[]( const string& str )
{
cout << str << endl;
} );
llvm::InitializeAllTargetInfos();
llvm::InitializeAllTargets();
llvm::InitializeAllTargetMCs();
llvm::InitializeAllAsmParsers();
llvm::InitializeAllAsmPrinters();
}
uint64_t Compiler::execute( istream& source, const ptr< string >& filename )
{
sema::Context c( m_pEnv, builtins::RootIdentity(), GetValueType< uint64_t >() );
auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( source, filename ), c );
|