Sprache as a round-trip tool

80 views Asked by At

Can Sprache be used as a round-trip tool? I understand that with it I can build a parser that can extract information from a given text. But I can reuse the same (simple*) pattern I came up for parsing also to generate text from Information?

Let me give you an example: I implement a parser which is capable of extracting the information "abc" from the text "[abc]". Now it would be handy if I could simply provide the value "abc" and it would know how to produce the resulting text "[abc]". Thus I would have a round-trip tool to go from text to information and back to text.

*) limited to known number of appearances of symbols (i.e. no .AtLeastOnce() etc.)

0

There are 0 answers