Hi r0ller, > Le 6 mai 2019 à 21:13, r0ller <r0l...@freemail.hu> a écrit : > > Hi Akim, > > [...] > A : B C > {<!-- --> > const node_info& main_node=sparser->get_node_info($1); > const node_info& dependent_node=sparser->get_node_info($2); > sparser->add_feature_to_leaf(main_node,"main_verb"); > std::string parent_symbol="A";//<--Here the symbol is hardcoded > logger::singleton()==NULL?(void)0:logger::singleton()->log(0,parent_symbol+"->"+main_node.symbol+" > "+dependent_node.symbol); > $$=sparser->combine_nodes(parent_symbol,main_node,dependent_node); > } > > D : E F > {<!-- --> > const node_info& main_node=sparser->get_node_info($1); > const node_info& dependent_node=sparser->get_node_info($2); > sparser->add_feature_to_leaf(main_node,"main_verb"); > std::string parent_symbol="D";//<--Here the symbol is hardcoded > logger::singleton()==NULL?(void)0:logger::singleton()->log(0,parent_symbol+"->"+main_node.symbol+" > "+dependent_node.symbol); > $$=sparser->combine_nodes(parent_symbol,main_node,dependent_node); > }
I believe we already discussed about this, but I don't understand why your API for logging looks this way. You should use a free standing function that encapsulates all this 'singleton()' sequence you repeat. But back to the point: you are *generating* the grammar, so I do not understand why *you* don't generate the name directly. Actually, I guess most of your action can synthesized from data stored in your data base, in addition to the symbol names. > This means, that one would need to save these two "snippets" in two different > files, say snippet1 and snippet2 and put the two file names in the action > fields of the corresponding db records. I don't understand why you don't put the actions in the db itself, but that's your choice. Still, you can perfectly introduce your own syntax for your external files, and process them before pasting them. Say > std::string parent_symbol="%LHS_NAME%"; > These examples you can find in the tech guide towards the end of section > 'Generating syntactic rules and machine learning': > https://github.com/r0ller/alice/wiki/Technical-Guide-and-Documentation#Option-2-3 > > and the other one towards the end of section 'Tagging': > https://github.com/r0ller/alice/wiki/Technical-Guide-and-Documentation#Tagging > > Though, as I changed it today after Hans's suggestion, you'll now find the > same implementation at those two places. Don't do that. I clearly stated that it is not guaranteed to work. Also, am I understanding that you don't actually felt the need for the feature in practice, but only for teaching something? Cheers! _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison