Bidirectional transformation

In computer programming, bidirectional transformations (bx) are programs in which a single piece of code can be run in several ways, such that the same data are sometimes considered as input, and sometimes as output. For example, a bx run in the forward direction might transform input I into output O, while the same bx run backward would take as input versions of I and O and produce a new version of I as its output.

Bidirectional model transformations are an important special case in which a model is input to such a program.

Some bidirectional languages are bijective. The bijectivity of a language is a severe restriction of its bidirectionality,[1] because a bijective language is merely relating two different ways to present the very same information.

More general is a lens language, in which there is a distinguished forward direction ("get") that takes a concrete input to an abstract output, discarding some information in the process: the concrete state includes all the information that is in the abstract state, and usually some more. The backward direction ("put") takes a concrete state and an abstract state and computes a new concrete state. Lenses are required to obey certain conditions to ensure sensible behaviour.

The most general case is that of symmetric bidirectional transformations. Here the two states that are related typically share some information, but each also includes some information that is not included in the other.

Usage

Bidirectional transformations can be used to:

  • Maintain the consistency of several sources of information[2]
  • Provide an 'abstract view' to easily manipulate data and write them back to their source

Vocabulary

A bidirectional program which obeys certain round-trip laws is called a lens.

Examples of implementations

  • Boomerang is a programming language which allows writing lenses to process text data formats bidirectionally
  • Augeas is a configuration management library whose lens language is inspired by the Boomerang project
  • biXid is a programming language for processing XML data bidirectionally[3]
  • XSugar allows translation from XML to non-XML formats[4]
gollark: Is there a good bignums library which works in CC? I want to make https://github.com/qntm/base1/blob/master/index.js.
gollark: lollollollol,loLlollollollollollol,LoLlollollollollollol,LoLlollollollollollol,LoLlollollollollollol,LoLlollollollollollol,loLlollollollollollol,LoLlollollollollollol,lOLlollollollollollol, lollollollollollollollOLlollollollollollollolLOllollollollollollollOLLoLLOLlOLlollollolLoLlollollollollollollol:lollollollollollolLollollollollollollollollOl lOLlOLlOL:LOLlOllOllollOLLOLlOLLoLlOL;lOLLoLLOLlOllOLLolLOLloLlOL:LOLlOllOl.lollollol lollollollollollollol:lollollollollollollol#lollollollollollollOl lOLlOLlOL:LOLlOllOllolLOLLOlLOLloLlOLLolLOLloLlOLLoLlOl.lollollol lollollollollollollol:lollollollollollollol;lollollollollollollOl lOLlOLlOL:LOLlOllOllollOLLOllOL:lOL;LOLloLLOLlOllOL:lOL#lOl.lollollol lollollollollollollol:lollollollollollollolLOllollollollollollolloL.loLloLlollollol.lollollollollollollol,lollollollollollollolLoLlollollollollollolLOLlolLOLlOllOL:lOLLOllollollol.lollollollollollollol,lollollollollollollollOllollollollollollollol?lollollollollollolLOLlolLOLlOllOL:lOLLOllOLLoLLOLLOlLOLLOllOLLoLLOLLOllollollolLoLlollollollollollolLOLloLlOL.lOLLOllOL!lollol
gollark: Lol!loL#LOLLoLlOLLolLoLLollollollolLollolloLlolloLlolloLlol lollollol.lollollollollollolloLlolLOLLOlLOLloLlOLLolLOLlOlLOLloLLOLLoLLOLlollollol,Lollollollollollollol, lollollollollollollollOllollollollollol.LolLollollollollollollollol?lollollollollollolloLLoLlollollollollollolloLlOLloLlol#lollollolLoL#lollol lollollollOllOlloLlollollollollolloLLoL lollollollollol loLlollollollollollolLoL#lollollolLollolLolLollOL#lollollol lol loLlolLol lollollol#lollolLol lollollOllollollollOllollollollol.#loLLol lollolLollOLLol lollollollollolLollOLloLlol:;LOL:LollOL#lol:!LOL:Lol;lollol lollollollolLOllollollollollollollolloLlol?lollollollollollollOLLOllOL:LOLlOllOL:LOLLoLLOLloLlOL.lOL;lOLLoLlollollolloLlollOLlollollollollollolLOL.lOL.lOLLoLlOL#lOLloLlollollolloLlollOLlollollollollollolLOLlollOLLollOL.LOLlOlLOLLOllollollollollollollollollollolLolLollollollollollollol,LOllollollollollollol,LOllollollollollollol,LOllollollollollollol,LOllollollollollollol,LOllollollollollollol,loLlollollollollollol,loLlollollollollollol,loLlollol
gollark: One byte input -> two to six bytes of lolcrypt.
gollark: I did. It's just that it gets exponentially more slow for each run, since lolcrypt inflates the size lots.

See also

References

  1. "Archived copy" (PDF). Archived from the original (PDF) on 2011-07-26. Retrieved 2011-02-07.CS1 maint: archived copy as title (link)
  2. http://www.cs.cornell.edu/~jnfoster/papers/grace-report.pdf
  3. "Archived copy" (PDF). Archived from the original (PDF) on 2007-07-02. Retrieved 2011-02-07.CS1 maint: archived copy as title (link)
  4. http://www.brics.dk/xsugar/


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.