I recently finished a project in which I created line lists, and I was wondering how to do this.
The line generation was context sensitive to determine if it was acceptable (it was a sequence of games in the game, so you had to know what the last game was)
The way I did this was with a function that was passed by the context parameter and the term, and if it was acceptable, it would recursively continue if it were not completed (since no further line could be acceptable.) The function also received the "length" parameter to make sure that it is completed in the end.
basically it generates every possible line accepted by the language (of a certain length).
Now I got it to work, even pretty good and clean, but I was wondering if there is a better way to do this. In particular, will the "state machine" monad work well in creating context-sensitive grammar? or something like that at least? The problem seems to be simple in running something like parsec, are there any other structures that are effective at manipulating languages?
Any thoughts would be appreciated.
Snark source
share