change makefile
This commit is contained in:
parent
785572634b
commit
7417d5e635
6
makefile
6
makefile
|
@ -1,7 +1,9 @@
|
|||
.PHONY=test
|
||||
nasal:main.cpp nasal_ast.h nasal_err.h nasal_builtin.h nasal_opt.h nasal_codegen.h nasal_gc.h nasal_import.h nasal_lexer.h nasal_parse.h nasal_vm.h nasal_dbg.h nasal.h
|
||||
nasal:main.cpp nasal_ast.h nasal_err.h nasal_builtin.h nasal_opt.h nasal_codegen.h\
|
||||
nasal_gc.h nasal_import.h nasal_lexer.h nasal_parse.h nasal_vm.h nasal_dbg.h nasal.h
|
||||
clang++ -std=c++11 -O3 main.cpp -o nasal -fno-exceptions -ldl -Wshadow -Wall
|
||||
nasal.exe:main.cpp nasal_ast.h nasal_err.h nasal_builtin.h nasal_opt.h nasal_codegen.h nasal_gc.h nasal_import.h nasal_lexer.h nasal_parse.h nasal_vm.h nasal_dbg.h nasal.h
|
||||
nasal.exe:main.cpp nasal_ast.h nasal_err.h nasal_builtin.h nasal_opt.h nasal_codegen.h\
|
||||
nasal_gc.h nasal_import.h nasal_lexer.h nasal_parse.h nasal_vm.h nasal_dbg.h nasal.h
|
||||
g++ -std=c++11 -O3 main.cpp -o nasal.exe -fno-exceptions -Wshadow -Wall -static
|
||||
test:nasal
|
||||
@ ./nasal -op -e test/ascii-art.nas
|
||||
|
|
|
@ -201,7 +201,7 @@ private:
|
|||
// local : max 32768 upvalues 65536 values
|
||||
std::list<std::unordered_map<std::string,int>> local;
|
||||
|
||||
// func end stack, reserved for print
|
||||
// func end stack, reserved for code print
|
||||
std::stack<uint32_t> fbstk;
|
||||
std::stack<uint32_t> festk;
|
||||
|
||||
|
@ -896,14 +896,14 @@ void nasal_codegen::forindex_gen(const nasal_ast& ast)
|
|||
gen(op_cnt,0,ast[1].line());
|
||||
int ptr=code.size();
|
||||
gen(op_findex,0,ast.line());
|
||||
if(ast[0].type()==ast_iter)
|
||||
if(ast[0].type()==ast_iter) // define a new iterator
|
||||
{
|
||||
const std::string& str=ast[0][0].str();
|
||||
local.empty()?
|
||||
gen(op_loadg,global_find(str),ast[0][0].line()):
|
||||
gen(op_loadl,local_find(str),ast[0][0].line());
|
||||
}
|
||||
else
|
||||
else // use exist variable as the iterator
|
||||
{
|
||||
mcall(ast[0]);
|
||||
if(code.back().op==op_mcallg)
|
||||
|
@ -930,14 +930,14 @@ void nasal_codegen::foreach_gen(const nasal_ast& ast)
|
|||
gen(op_cnt,0,ast.line());
|
||||
int ptr=code.size();
|
||||
gen(op_feach,0,ast.line());
|
||||
if(ast[0].type()==ast_iter)
|
||||
if(ast[0].type()==ast_iter) // define a new iterator
|
||||
{
|
||||
const std::string& str=ast[0][0].str();
|
||||
local.empty()?
|
||||
gen(op_loadg,global_find(str),ast[0][0].line()):
|
||||
gen(op_loadl,local_find(str),ast[0][0].line());
|
||||
}
|
||||
else
|
||||
else // use exist variable as the iterator
|
||||
{
|
||||
mcall(ast[0]);
|
||||
if(code.back().op==op_mcallg)
|
||||
|
|
|
@ -196,13 +196,13 @@ void nasal_vm::bytecodeinfo(const char* header,const uint32_t p)
|
|||
printf("0x%x",c.num);break;
|
||||
case op_callb:
|
||||
printf("0x%x <%s@0x%lx>",c.num,builtin[c.num].name,(uint64_t)builtin[c.num].func);break;
|
||||
case op_upval: case op_mupval: case op_loadu:
|
||||
printf(" (0x%x[0x%x])",(c.num>>16)&0xffff,c.num&0xffff);break;
|
||||
case op_happ: case op_pstr:
|
||||
case op_lnkc:
|
||||
case op_callh: case op_mcallh:
|
||||
case op_para: case op_defpara:case op_dynpara:
|
||||
printf("0x%x (\"%s\")",c.num,rawstr(str_table[c.num]).c_str());break;
|
||||
case op_upval: case op_mupval: case op_loadu:
|
||||
printf(" (0x%x[0x%x])",(c.num>>16)&0xffff,c.num&0xffff);break;
|
||||
default:printf("0x%x",c.num);break;
|
||||
}
|
||||
printf(" (%s:%d)\n",files[c.fidx].c_str(),c.line);
|
||||
|
|
Loading…
Reference in New Issue