Ticket #10 (new enhancement)

Opened 9 years ago

New linearization algorithm for metavariables

Reported by: PeterLjunglof Owned by:
Priority: major Version:
Keywords: Cc:


Parsing with metavariables is no big problem. Suppose:

fun play : Song -> Artist -> Action;
lin play x y = {s = "play" ++ variants{"a" ++ "song"; x.s} ++ variants{[]; "by" ++ y.s}};

Then "play like a virgin" will parse into (play virgin ?), and we can handle the metavar in the analysis. But suppose that we want to give feedback by repeating the input:

fun feedback : Action -> Feedback;
lin feedback x = {s = ["so, you want to"] ++ x.s};

Then the linearization of (feedback (play virgin ?)) will be all the following:

  1. so, you want to play a song
  2. so, you want to play a song by ?
  3. so, you want to play like a virgin
  4. so, you want to play like a virgin by ?

But it's really only nr (3) we want. How can we achieve this, without having to divide the rule in four different?

Nr (2) and (4) can be removed like this: Disallow all linearizations which have "?" in the output.

Nr (1) can be removed like this: All instantiated argument strings MUST be used in the linearization. (If they are present in the RHS of course).

These two choices could e.g., be flags to the linearization algorithm.

Note: See TracTickets for help on using tickets.