Mimir Policy Language for VS Code
Syntax colouring for .mimir files, the irrigation policy language of the Mímir project
(SE-314 Software Construction, NUST SEECS). A policy is a list of rules that suggest how much
to water a field each day:
# The paper's two baselines, written as rules
RULE "Half dry, fill it up" WHEN dryness >= 50 % THEN water TO full
RULE "Daily top-up" WHEN elapsed >= 24 h THEN water used
RULE "Rain on the way" WHEN forecast >= 10 mm THEN hold
RULE "Sensor check" WHEN NOT moisture BETWEEN 0 AND 0.6
THEN failsafe, warn "soil sensor out of range" PRIORITY 1
What gets coloured
| Part |
Words |
Dark+ colour |
| Structure keywords |
RULE WHEN THEN TO PRIORITY |
purple |
| Logic |
AND OR NOT BETWEEN |
blue |
| Rule titles |
"Half dry, fill it up" |
teal |
| Actions |
water hold failsafe warn |
yellow |
| Field readings |
soil moisture full wilting demand forecast dryness room used elapsed stage |
light blue |
| Crop stages |
seedling growing flowering ripening |
bright blue |
| Numbers and units |
50 %, 5 mm, 24 h |
green |
| Warning text |
"runoff risk" |
orange |
| Comments |
# ... |
dark green |
| Characters the language does not allow |
@ |
red |
A word the language does not know, such as humidity, stays uncoloured: a quick hint that the
policy checker will reject the rule.
The colours come from your theme, so the extension works in light and dark themes alike.
Ctrl+/ toggles a # comment, and ( and " close themselves.
Install
Search Mimir Policy Language in the Extensions view and click Install, or run:
code --install-extension mimir-abdullah.mimir-policy-language
Then open any .mimir file.
Release notes
- 1.0.1: store page describes the language and how to install from the Marketplace.
- 1.0.0: first release.