in reply to
Reversible parsing (with Parse::RecDescent?)
I'm only vaguely familiar with parse::recdescent, but I'll try to give some general hints.
* Is it necessarily possible to reverse the data through the grammar to get the command line?
No. At least, for most grammars there are multiple variations of code that will end up as the same syntax tree / data structure. IOW if the original input is unambiguous, you should be able to reverse it into something equivalent but not necessarily character-for-character the same. If the input is ambiguous you'll have more problems.
* or is this only possible for special grammars?
I think in theory it would be possible to re-generate equivalent source data for any parse tree, given unambiguous grammar and input, but I'm not sure that parse::recdescent makes it easy (or even possible) to do that given only the grammar and the output data.
Looking at your code it doesn't seem *that* difficult to come up with something to handle your cases, though you may have to deal with some duplication of grammar rules.