00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TREEBUILDER_H_
00019 #define TREEBUILDER_H_
00020
00021 #include "sym/Sym.h"
00022 #include "LanguageTable.h"
00023
00024 class TreeBuilder {
00025 const LanguageTable& table;
00026
00027
00028 double vcprob;
00029
00030 Sym make_terminal() const;
00031 public:
00032
00033 TreeBuilder(const LanguageTable& t) : table(t), vcprob(0.9) {};
00034 TreeBuilder(const LanguageTable& t, double vc) : table(t), vcprob(vc) {};
00035
00036 void set_var_vs_const_probability(double p) { vcprob = p; }
00037
00038 Sym build_tree(unsigned max_depth, bool grow) const;
00039
00040 void build_tree(Sym& tree, unsigned max_depth, bool grow) const { tree = build_tree(max_depth, grow); }
00041
00042 };
00043
00044 #endif
00045