Quoting skaller <[EMAIL PROTECTED]>: > On Sat, 2007-07-14 at 21:12 +0200, Emmanuel Onzon wrote: > >> Each action that is added by the user is numbered increasingly, >> and instead of just returning an s-expression it also returns >> its number. >> Then you can write a merge function that selects the AST that is >> coupled with the highest number, this ensures that you keep the >> tree that was built by the most recent action. > > But I'd need to write it for every non-terminal, including > user defined ones .. hmm .. it's the same function for all > of them of course.
Contrary to what is written in the manual the generic merge functions can destructure and use according to their types the values they are passed as arguments (i.e. they don't have to be polymorphic as long as they are assigned to non terminals that return values of the same type). Which means that you can write one merge function as described previously and then using %merge you assign it to several non terminals that return an s-expression and the number of the action. I will update the manual. With the current version of dypgen, the new non terminals are assigned the global merge function and it is not possible to make this different. In fact, the merge functions should not be associated to each non terminal but rather to each constructor of the type obj. And then when a new non terminal is added its merge function would be automatically the merge function of its associated constructor. I'll see if I can do that. Emmanuel ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language