Quantcast
Channel: Lionel Montrieux » lmontrieux
Viewing all articles
Browse latest Browse all 23

BiFlux-mode: an Emacs major mode for BiFlux

$
0
0

I have recently been playing around with BiFlux, a language to express bidirectional transformations of XML documents developed at NII, Japan. The language is great, because it is a much simpler alternative to GRoundTram, also from NII. But what are bidirectional transformations, I hear you ask?

Well, conveniently, there is a Wikipedia page on the subject on bidirectional transformations. Granted, it isn’t the most detailed page on Wikipedia, but contributions are, I suppose, more than welcome. And it still gives a pretty good idea of what a bidirectional transformation is. In particular, the following paragraph about lens languages is key to understanding what BiFlux does:

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.

[Wikipedia]

So, in short, BiFlux allows you to write “put” in a language that looks a lot like SQL, and to have “get” generated for free. This means that, under certain circumstances, one can easily generate a bidirectional transformation between two XML DTDs.

It happens that my favourite text editor is Emacs (what else, really?). As there was no support for BiFlux in Emacs, I decided to create a major mode for it, to help myself and others when writing code for BiFlux. I like Emacs a lot, but I have never written a major mode – or anything really – in Emacs Lisp before. I am a complete Emacs Lisp rookie, and I’m learning as I go.

Currently, the mode supports some level of syntax highlighting, which already makes my life easier, and that’s about it. In the near future, I’d like to complete the syntax highlighting, and to add commands for compiling the bidirectional transformations.

The code for biflux-mode is available on github, under the Apache 2 license. Any help is more than welcome, as I am nowhere near an Emacs Lisp expert. I will probably post more about biflux-mode as it gets new features.


Viewing all articles
Browse latest Browse all 23

Latest Images

Trending Articles





Latest Images