19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
return ToValue( BuildExternalFunc( *ft, symbol ) );
} );
RegisterBuiltinFunc< Eager< uint32_t > ( string ) >( e, "ExecuteFile"_sid,
[pEnv]( const string& filename ) -> uint32_t
{
auto pFN = make_shared< string >( filename );
ifstream sourcefile( pFN->c_str() );
if( !sourcefile.good() )
{
cout << "can't open '" << *pFN << "'\n";
return 0;
}
sema::Context c( pEnv.lock(), RootIdentity(), GetValueType< uint32_t >() );
auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( sourcefile, pFN ), c );
parse::Parser p( r );
auto cfg = make_shared< llr::CFG >();
p.setCFG( cfg );
p.setCurrentBB( cfg->entryBB() );
p.parseSequence();
|
<
<
|
|
|
>
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
return ToValue( BuildExternalFunc( *ft, symbol ) );
} );
RegisterBuiltinFunc< Eager< uint32_t > ( string ) >( e, "ExecuteFile"_sid,
[pEnv]( const string& filename ) -> uint32_t
{
ifstream sourcefile( filename.c_str() );
if( !sourcefile.good() )
{
cout << "can't open '" << filename << "'\n";
return 0;
}
sema::Context c( pEnv.lock(), RootIdentity(), GetValueType< uint32_t >() );
auto r = make_shared< parse::Resolver >(
make_shared< lex::Lexer >( sourcefile, filename ), c );
parse::Parser p( r );
auto cfg = make_shared< llr::CFG >();
p.setCFG( cfg );
p.setCurrentBB( cfg->entryBB() );
p.parseSequence();
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
sema::Context c( pEnv.lock(), RootIdentity(), ftype.returnType() );
auto identity = AppendToVectorTerm( InjectDomainIntoIdentity( RootIdentity(), DomainRunTime() ),
TERM( StringId( pEnv.lock()->GetUniqueId() ) ) );
auto func = BuildFunc( c, ftype, identity, params, make_shared< Vector >(), c );
const auto& pFuncLLR = func.llr();
auto pFN = make_shared< string >( filename );
ifstream sourcefile( pFN->c_str() );
if( !sourcefile.good() )
{
pFuncLLR->setInvalid();
cout << "can't open '" << *pFN << "'\n";
return ToValue( func );
}
auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( sourcefile, pFN ), c );
parse::Parser p( r );
auto cfg = make_shared< llr::CFG >();
p.setCFG( cfg );
p.setCurrentBB( cfg->entryBB() );
p.parseSequence();
|
<
<
|
|
|
|
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
sema::Context c( pEnv.lock(), RootIdentity(), ftype.returnType() );
auto identity = AppendToVectorTerm( InjectDomainIntoIdentity( RootIdentity(), DomainRunTime() ),
TERM( StringId( pEnv.lock()->GetUniqueId() ) ) );
auto func = BuildFunc( c, ftype, identity, params, make_shared< Vector >(), c );
const auto& pFuncLLR = func.llr();
ifstream sourcefile( filename.c_str() );
if( !sourcefile.good() )
{
pFuncLLR->setInvalid();
cout << "can't open '" << filename << "'\n";
return ToValue( func );
}
auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( sourcefile, filename ), c );
parse::Parser p( r );
auto cfg = make_shared< llr::CFG >();
p.setCFG( cfg );
p.setCurrentBB( cfg->entryBB() );
p.parseSequence();
|