From dabd2422149b11e896592ead4047885be65aab0c Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Wed, 2 Oct 2019 18:47:23 +0800 Subject: [PATCH] Delete abstract_syntax_tree.h --- version0.16/abstract_syntax_tree.h | 172 ----------------------------- 1 file changed, 172 deletions(-) delete mode 100644 version0.16/abstract_syntax_tree.h diff --git a/version0.16/abstract_syntax_tree.h b/version0.16/abstract_syntax_tree.h deleted file mode 100644 index 58fa067..0000000 --- a/version0.16/abstract_syntax_tree.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef __ABSTRACT_SYNTAX_TREE_H__ -#define __ABSTRACT_SYNTAX_TREE_H__ - -#include "nasal_parser.h" - -class ast_tree_node -{ - protected: - int line; - int type; - std::list children; - double num; - public: - ast_tree_node() - { - line=0; - type=0; - children.clear(); - } - void set_line(int _line) - { - line=_line; - } - void set_type(int _type) - { - type=_type; - } - int return_line() - { - return line; - } - int return_type() - { - return type; - } - int child_num() - { - int cnt=0; - for(std::list::iterator i=children.begin();i!=children.end();++i) - ++cnt; - return cnt; - } - std::list& return_list() - { - return children; - } - void print_all_tree(int tabnum=0) - { - for(int i=0;i::iterator i=children.begin();i!=children.end();++i) - { - i->print_all_tree(tabnum+1); - } - for(int i=0;i::iterator i=children.begin(); - sum=i->run()+(++i)->run(); - return sum; - } - else if(type==__sub_operator) - { - double sum=0; - std::list::iterator i=children.begin(); - sum=i->run()-(++i)->run(); - return sum; - } - else - { - for(std::list::iterator i=children.begin();i!=children.end();++i) - std::cout<run()<=0;--i) - { - num+=acc*((double)(str[i]-'0')); - acc*=10; - } - } - else - { - num=0; - double acc=1; - double aff=0.1; - for(int i=DotPlace+1;i<(int)str.length();++i) - { - num+=aff*((double)(str[i]-'0')); - aff*=0.1; - } - for(int i=DotPlace-1;i>=0;--i) - { - num+=acc*((double)(str[i]-'0')); - acc*=10; - } - } - return; - } -}; -#endif