diff --git a/version3.0/main.cpp b/version3.0/main.cpp index 52eabba..e08d29c 100644 --- a/version3.0/main.cpp +++ b/version3.0/main.cpp @@ -13,12 +13,13 @@ void help() { std::cout<<">> [\"file\"] input a file."<> [clear ] clear the screen."<> [del ] clear the source code."<> [del ] clear the input filename."<> [rs ] print source code."<> [lex ] use lexer to turn code into tokens."<> [ast ] do parsing and check the abstract syntax tree."<> [run ] run code."<> [run ] run abstract syntax tree."<> [exec ] generate byte code."<> [erun ] run byte code."<> [logo ] print logo of nasal ."<> [exit ] quit nasal interpreter."<> [file] cannot open file \""< string_list; std::vector symbol_list; int error; - void die(std::string); void init(); void output_int(unsigned int,std::ofstream&); - void generate_root(nasal_ast&,std::ofstream&); - void generate_number_list(std::ofstream&); - void generate_string_list(std::ofstream&); - void generate_symbol_list(std::ofstream&); + void output_root(nasal_ast&,std::ofstream&); + unsigned int input_int(std::ifstream&); + void input_root(nasal_ast&,std::ifstream&); public: nasal_codegen(); - void main_progress(std::string,nasal_ast&); -}; - -class nasal_bytecode_runtime -{ -private: -public: + int get_error(); + void output_exec(std::string,nasal_ast&); + void load_exec(std::string,nasal_ast&); }; nasal_codegen::nasal_codegen() @@ -46,11 +32,9 @@ nasal_codegen::nasal_codegen() return; } -void nasal_codegen::die(std::string info) +int nasal_codegen::get_error() { - ++error; - std::cout<<">> [code] "<& ref_vec=root.get_children(); int root_children_size=ref_vec.size(); - for(int i=0;iinit(); std::ofstream fout(filename,std::ios::binary); if(fout.fail()) { + ++error; std::cout<<">> [code] cannot generate file \""<> [code] file format error: without ast_begin."<> [code] file format error: without ast_end."<> [code] cannot open file\""<> [code] \""<