Can use a planner. Here are explanations on the planner presented in the book Natural Language Processing in Lisp by Gazdar and Mellish, Addison Wesley, 1989. The following code can be used in the specific case of the Gazdar and Mellish's planner.
Similar code needs to be written for different applications.
Once we have decided what is the input and formatted it to a convenient form, we need to decide what the output of the lexical chooser will be. In our case, we take examples of sentences corresponding to the data we receive in input, and write a Surge input specification corresponding to each sentence. This FUG is slightly different from the syntactic grammars we have already studied because it takes as input a semantic representation. We use a different cset to control recursion. This allows the lexical chooser to indicate for each node how to go down to the next level.