mbeddr
Reviewed July 25, 2019mbeddr is a projectional editor and IDE for embedded programming in C. It's best known for its focus on a text-editing-like feel. It also features mixed direct manipulation interfaces, state machines, units, requirements, varients, and more. It is built with and can be extended via JetBrains MPS. It is one of the oldest and most-developed projectional editors, documented in a number of academic papers on its many innovative design choices.
Product Feel
- π Editing is mostly fluid, with a ~3 hour learning curve
- π Interesting, innovative features
- π It doesnβt feel cohesive: interesting experiments tacked on
Basic Usage
The above video shows editing a few mathematical expressions in mbeddr. It demonstrates:
- creating a new variable name via referencing it
- fluidly changing expressions like it's text-editing
- wrapping an expression in parenthesis (after failing to get it to group properly without them) for use in a ternary expression
- context-aware copy-and-paste, which gives appropriate out-of-scope errors
- renaming taking effect everywhere
Freeform-ish editing
The mbeddr text-like editing experience is so good that you forget you're editing an AST. In other words, there are a lot of tree manipulations happening under the hood as you edit the code as text. The following video is narrated by one of the creators of mbeddr, and shows him adding and removing keyword arguments in arbitrary orders (not only outside-in like traditional projectional editors). This allows even the simple pleasure of typing mathematical expressions linearly, a rarity for projectional editors. It accomplishes this by] automatically rebalancing its AST to maintain the expected PEMDAS order of operations of math expressions. Additionaly, it allows you to parenthesize an expression naturally via its "unbalanced parenthesis" node. It allows you to place a left-parenthesis first and then later navigate over to place the right-parenthesis, just like you would in text!
Mixed notational interfaces
mbeddr includes a number of rich-text and visual components and notations, such as math equations, tables, and flowcharts. They allow for both mouse-based direct manipulation and keyboard navigation. They even allow users to build their own notational interfaces to extend the tool.
Decision tables
In the following video I create a visual decision table by typing decta
and navigate it by keyboard to fill it in. I then use the context menu to create a vertically-aligned fraction, which I copy and paste into the decision table. I even put a decision table inside the decision table!
I wasn't able to get it to work, but apparently (as in this video and the following photo) decision tables can automatically verified as long as the equations are linear.
State machines
State machines are fully supported in mbeddr with both a textual and graphical representation. Clicking a node in the graphical state machine highlights the relevant code. State machines are also automatically verifiable with a built-in model checker, highlighting unhandled or impossible states or transitions.
Units
mbeddr supports unit type annotations, which are a lightway way to prevent a whole class of logical bugs. In the following video, I manipulate the units of various number types, demonstrating that compound units such as mph
can be built out of expressions of their component types dividing a m
by an h
. I also show how we can explicitly convert from kph
to mph
.
Requirements
mbeddr supports keeping track of product requirements directly within the mbeddr IDE, linked directly to relevant expressions in the code. It allows for searching for implementation expressions in the code by requirements, and showing/hiding requirements throughout the code. The requirements themselves can embed arbitrary mbedder expressions, which can then be referenced in the code, allowing a product manager to express logic in a decision table, for example, that could then be embedded right into the code.
Variants
Variants are useful for pre-processing programs to be compiled in a variety of ways. They are like macros or feature flags. mbeddr supports them with a specialized, colorized UI, and static checking to prevent incompatible flag combinations.