1

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.)

David
  • 2,426
  • 3
  • 24
  • 36
  • 1
    There is nothing within Sprache that can do this. You would have to build a library on top of Sprache to do this. For simple cases like quotations or surrounding with square brackets it is perfectly possible. – Tahir Hassan Jul 09 '18 at 12:36

0 Answers0