# MsGenny _**Low effort labeling. Auto declarations**_ mscgen already is a simple, concise, well readable language. Write-ability leaves room for improvement, though. The _MsGenny_ language is our attempt to fill that room. It does away with some of MscGen's more fancy features in favor of low effort labeling and automatic entity declarations. This enables you to set up a sequence chart _very_ fast. See below for a complete comparison chart. To have our cake and eat it too we made the mscgen*js [online interpreter][4] translate between the two with the flick of a switch. The interpreter also contains a complete [tutorial][5] on \_MsGenny*. ## Example ```msgenny a -> b : ab(); a => c : automatically declares entities used in arcs; c =>> c : process(1); b <<= c : Has all mscgen arc types... ; b note b: ...notes + boxes ...; |||; --- : Labels usually don't need enclosing quotes; --- : "except when they contain , or ;"; ...; ``` this renders as ![MsGenny sample](https://raw.github.com/sverweij/mscgen_js/master/wikum/msgennysample.png) ([open this chart in the online interpreter](https://sverweij.github.io/mscgen_js/index.html?utm_source=wikum.genny&lang=msgenny&msc=a%20-%3E%20b%20%3A%20ab%28%29%3B%0Aa%20%3D%3E%20c%20%3A%20automatically%20declares%20entities%20used%20in%20arcs%3B%0Ac%20%3D%3E%3E%20c%20%3A%20process%281%29%3B%0Ab%20%3C%3C%3D%20c%20%3A%20Has%20all%20mscgen%20arc%20types...%20%3B%0Ab%20note%20b%3A%20...notes%20%2B%20boxes%20...%3B%0A|||%3B%0A---%20%3A%20Labels%20usually%20don%27t%20need%20enclosing%20quotes%3B%0A---%20%3A%20%22except%20when%20they%20contain%20%2C%20or%20%3B%22%3B%0A...%3B)) The equivalent mscgen program would have looked like this: ```mscgen msc { a, b, c; a -> b [label="ab()"]; a => c [label="automatically declares entities used in arcs"]; c =>> c [label="process(1)"]; b <<= c [label="Has all mscgen arc types... "]; b note b [label="...notes + boxes ..."]; |||; --- [label="Labels usually don't need enclosing quotes"]; --- [label="except when they contain , or ;"]; ...; } ``` ([open in the mscgen_js online interpreter](https://sverweij.github.io/mscgen_js/index.html?utm_source=wikum.genny&lang=mscgen&msc=msc%20{%0A%20%20a%2C%20b%2C%20c%3B%0A%0A%20%20a%20-%3E%20b%20[label%3D%22ab%28%29%22]%3B%0A%20%20a%20%3D%3E%20c%20[label%3D%22automatically%20declares%20entities%20used%20in%20arcs%22]%3B%0A%20%20c%20%3D%3E%3E%20c%20[label%3D%22process%281%29%22]%3B%0A%20%20b%20%3C%3C%3D%20c%20[label%3D%22Has%20all%20mscgen%20arc%20types...%20%22]%3B%0A%20%20b%20note%20b%20[label%3D%22...notes%20%2B%20boxes%20...%22]%3B%0A%20%20|||%3B%0A%20%20---%20[label%3D%22Labels%20usually%20don%27t%20need%20enclosing%20quotes%22]%3B%0A%20%20---%20[label%3D%22except%20when%20they%20contain%20%2C%20or%20%3B%22]%3B%0A%20%20...%3B%0A})) ## Usage scenarios We often find ourselves starting a sequence chart in _MsGenny_, and, when we're done, converting it to _MscGen_ (one click in the on line interpreter). After that we either finish it with coloring or directly save the source to the documentation. When in a hurry we directly use the rendered output from _MsGenny_. ## A note on quotes Just like in _MscGen_, in _MsGenny_ labels need to be surrounded by quotes. To simplify entry, however, in most cases _MsGenny_ allows you to skip the quotes. It only needs quotes when a label contains a comma or a semicolon: ```msgenny a => b : "hello b"; # works a => b : hello b; # works a => b : "hello; b"; # works a => b : hello; b; # doesn't work; confuses the parser to think the arc line stops after hello a => b : "hello, b"; # works a => b : hello, b; # doesn't work; confuses the parser to think the arc stops after hello ``` ## Formal syntax The formal syntax is described in a [parsing expression grammar][1]. This grammar is used to generate the MsGenny parser as well. ## Feature comparison As mentioned above the [online interpreter][4] converts between _MscGen_ and _MsGenny_, but the [command line interface][2] also does: ```sh # Translate MsGenny => MscGen mscgen_js -T mscgen -i yourchart.msgenny -o yourchart.mscgen # Translate MscGen => MsGenny mscgen_js -T msgenny -i yourchart.mscgen -o yourchart.msgenny ```
featureMscGenMsGenny
explicit entity declaration mandatory supported
implicit entity declaration not supported supported
Characters allowed in unquoted entity names A-Z0-9 Every unicode character, except;,"=-><:*{} and spaces ( \t\n\r)
Characters allowed in quoted entity names Every unicode character same as MscGen
labels on entities entity_name [label="this is the label"] entity_name : this is the label
labels on arcs, notes, boxes a =>> b [label="this is the label"]; a =>> b : this is the label;
explicit declaration of start and end of the program A mscgen program must start with msc { and must be ended by a } Needed nor supported
arc types a lot same as MscGen
notes, boxes, empty arcs supported same as MscGen
parallel calls use a comma between arcs: a=>b, a=>c; same as MscGen
broadcasts Use an asterisk as to or from: a=>*; same as MscGen
options hscale, arcgradient, width, wordwraparcs same as mscgen, plus "wordwrapentities", "wordwrapboxes" and "watermark" (which work as in xù)
comments # single line-style, // C++ type single line-style and /* multi line */-style same as MscGen
entity names alphanumericalstrings, "quoted strings" and 481 numbers same as MscGen
colors lines, text, background on entities, arcs and notes not supported
coloring all arcs departing from an entity declare by using the arc* property variants on the entity, e.g. arclinecolor="blue" not supported
id, url, idurl supported not supported
inline expressions (loop, alt, opt, neg, ...) not supported supported as it is in xù,
[1]: ../src/script/parse/peg/msgennyparser.peggy [2]: ../src/script/cli/README.md [4]: https://sverweij.github.io/mscgen_js/?utm_source=wikum.genny [5]: https://sverweij.github.io/mscgen_js/tutorial.html?utm_source=wikum.genny