#ifndef __NASAL_VM_H__ #define __NASAL_VM_H__ class var { private: int type; std::string name; double number; std::string str; std::list var_list; std::list var_hash; abstract_syntax_tree function; public: var() { type=0; name=""; number=0; str=""; function.set_clear(); } var(const var& p) { type=p.type; name=p.name; number=p.number; str=p.str; function=p.function; } var& operator=(const var& p) { type=p.type; name=p.name; number=p.number; str=p.str; function=p.function; return *this; } void print_information() { std::cout<<"[ type: ";print_token(type);std::cout<<" ]"; std::cout<<"[ name: "<>[Runtime-error] function type cannot be printed."< p) { var_list=p; return; } void append_list(var p) { var_list.push_back(p); return; } void set_hash(std::list p) { var_hash=p; return; } void append_hash(var p) { var_hash.push_back(p); return; } int get_type() { return type; } std::string get_name() { return name; } double get_number() { return number; } std::string get_string() { return str; } abstract_syntax_tree get_function() { return function; } std::list get_list() { return var_list; } std::list get_hash() { return var_hash; } }; class var_scope_manager { private: std::list > scope_list; var error_var; public: var_scope_manager() { scope_list.clear(); std::string str="__nas_strc_lang_error_ret"; error_var.set_name(str); error_var.set_type(__null_type); return; } void set_clear() { scope_list.clear(); return; } var& search_var(std::string str) { std::list>::iterator i=scope_list.end(); --i; for(;;--i) { for(std::list::iterator j=i->begin();j!=i->end();++j) if(j->get_name()==str) return *j; if(i==scope_list.begin()) break; } std::cout<>[Runtime-error] could not find the var '"<>[Runtime-error] empty scope list."<>::iterator i=scope_list.end(); --i; for(std::list::iterator j=i->begin();j!=i->end();++j) { if(j->get_name()==new_var.get_name()) { std::cout<>[Runtime-error] redeclaration of var '"<push_back(new_var); return; } void add_new_scope() { std::list new_list; scope_list.push_back(new_list); return; } void pop_last_scope() { if(!scope_list.empty()) scope_list.pop_back(); else std::cout<>[Runtime-error] scope poped empty thing."<>[Runtime] process begins."<>[Runtime] process exited after "<>[Runtime] runtime got the ast-root: "<<((void *)&tree)<<"->"<<((void *)&root)<<"."<