Exceptional language

In communication and teaching it is often easier to describe the most common case first and describe the deviations afterwards. Kind of like the 80/20 rule.

This can also be applied to domain specific languages. In the following example I will develop a domain specific language for describing a weekly schedule. What are the ingredients?

We have the days of the week, times written in 24 hour format hh:mm and we have descriptions (names, titles).

  • Mo, Tu, We, Th, Fr, Sa, Su
  • 00:00-23:59
  • A description

Every line is an individual description.

A specific event can be described such

Sa 06:30--06:45 Coffee time

But if this happens like this on all days it would be:

06:30--06:45 Coffee time

Writing nothing covers all 24 hours of all week days.


This event implicitly exists. By definition, all 24 hours of all days of week are occupied.

If we want to denote complete days, I can just list them:

Sa, Su Weekend

The grammar for this language would be (roughly):

# list_of_days? list_of_timespans? description?
# list_of_days = day (',' list_of_days)*
# list_of_timespans = timespan (',' list_of_timespans)*
# day = 'Mo' / 'Tu' / 'Mi' / 'Th' / 'Fr' / 'Sa' / 'Su'
# timespan = time '--' time
# time = hour ':' minute
# hour = [0-2]? [0-9]
# minute = [0-5]? [0-9]
# description = .*