I am new to language design and DSLs and would need some advice on how to design a DSL for specifying legal duty periods for airline personnel. The aviation industry is heavily regulated and maximum duty time rules are enforced to ensure public safety.
For example, duty period rules could include:
- 60 duty hours in any 7 consecutive days;
- 110 duty hours in any 14 consecutive days;
- 190 duty hours in any 28 consecutive days, spread as evenly as practicable throughout that period.
In a similar way, pilots must abide by flight duty period (FDP) limitations such as:
- 100 hours of flight time in any 28 consecutive days
- 900 hours of flight time in any calendar year;
- 1,000 hours of flight time in any 12 consecutive calendar months.
In addition to maximum duty and flight time limitations, rest period rules need to be also enforced, such as:
“The minimum rest period provided before undertaking an FDP starting at home base shall be at least as long as the preceding duty period, or 12 hours, whichever is greater”
To complicate matters, each (European) airline usually has its own set of rules and regulations resulting from union agreements.
Hardcoding the aforementioned rules is not practical because the rest and duty period rules might change from one airline to another.
Therefore, one option would be to define a DSL language enabling the airline operator to specify the rules (basically valid duty periods and mandatory rest/holidays).
I would need some advice on how to design such a language. I realize my question is quite vague and generic but having pointers on how to start would be great.