LIESL: The Line-oriented Imperative English Scheduling Language

LIESL is a language for describing scheduled events. It goes beyond file formats like crontab and iCalendar by also being easy for humans to read, and somewhat easy for humans to write. If you speak English, you can understand a schedule written in LIESL without any prior knowledge.

Schedules

LIESL schedules are meant to sound a like instructions for a genial old secretary. They all begin with the phrase "Liesl," and end with the phrase "Thanks, hon", on lines by themselves. At the expense of being a little twee, this allows you to leave comments outside a schedule, or embed the schedule in another document.

Note to self: find out how old snow tires are.

Liesl,

Change snow tires every year in November on the first Saturday.

Thanks, hon
	
Commands are placed on separate lines. Punctuation and braces are intentionally kept to a minimum. Extra spaces, upper/lower case, most punctuation and word endings are ignored. The exception is that all numbers have to be written with numerals (1st, 22, 7...) rather than spelled out (first, twenty-two, seven...).

One-time Events

Basic one-time events have:

Dinner party from April 23.
Welding class from May 19 at 7pm.
Stop at doughnut shop from May 7 at 6:00pm to May 7 at 8:30 pm.
Open house from May 24, 2016, at 8:30am.
	
"Datetime" is any phrase that describes a specific date and time. There are a lot of ways to do this. If the program doesn't understand parts of the start or end datetimes, it will fill them in with defaults. The default start date is the current day. The default start time is 8:00am. The default end datetime is one hour after the start datetime.

Recurring Events

Recurrence frequency

In addition to their start and end datetime, recurring events have a frequency. This begins with the word every and can be one of year, month, week, or day.

Staff meeting every week, from 3/27/16 at 2:00pm to 3/27/16 at 3:00pm.

In a recurrent event, "start" and "end" define the start and end of the first occurrence. Every occurrence after that has the same start and end time, but occurs on a different date. In the above example, the event will be scheduled from 2:00-3:00pm every Friday, since the first occurrence falls on a Friday (May 27).

Recurring events can, optionally, have any of the following:

Occurrence clauses

You can also add one or more "occurence clauses" to limit when the event can occur. Each clause contains, in order: Some examples:

Staff meeting every week on the 5th day of the week.
Call Ron every month on the 1st and 20th day of the month.
Clean parts bin every day, on the 1st and 3rd week of the month, on the 1st and 5th day of the week.
		
You don't always have to write the smaller and larger unit if they are implicit. For example, you can say "on Friday" instead of "on the 6th day of the week":
Staff meeting every week on Fridays.	
Here's a more realistic example: US election day. This occurs on the first Tuesday following a Thursday. So it can't occur on the first day of the month, but has to occur during the first eight.
Election day every 4 years, in November, on the 2-8th day of the month, on Tuesday.

Macros

If you have several events that all begin and/or end with the same words, you can use a macro to simplify them. Put a colon at the end of the phrase you want repeated, and indent all the phrases to which it should be added with a tab.

Prefixes

The following command:


"Private lives" at the Criterion from:
	June 7 at 8pm
	June 8 at 7:30pm
		
Expands to:

"Private lives" at the Criterion from June 7 at 8pm
"Private lives" at the Criterion from June 8 at 7:30pm
		

Suffixes

If the first line of the macro begins with an ellipsis (...), it will be added to the end of the following phrases instead of the beginning.

For example:


...from June 7 at 8pm:
	"Private lives" at the Criterion 
	"The Lives of Others" at Reel Pizza
		
Expands to:

"Private lives" at the Criterion from June 7 at 8pm
"Goodbye Lenin" at Reel Pizza from June 7 at 8pm
		

Circumfixes

If the first line of the macro contains a comma, everything before the comma will be added to the beginning of the subsequent lines, and everything after the comma will be added to the end. If there's more than one comma, the first comma is used to split the prefix and suffix.

For example:


Get a birthday present for, every year:
	Rob from June 7
	Miranda from April 18
		
Expands to:

Get a birthday present for Rob from June 7 every year
Get a birthday present for Miranda from April 18 every year
		

Combinations

You can even nest macros to combine several "layers" of prefixes and suffixes.

For example:


"Goodbye Lenin" at Reel Pizza from:
	...at 8pm:
		June 7
		June 9
	
	...at 7:30pm:
		June 14
		June 15


		
Expands to:

"Goodbye Lenin" at Reel Pizza from June 7 at 8pm
"Goodbye Lenin" at Reel Pizza from June 9 at 8pm
"Goodbye Lenin" at Reel Pizza from June 14 at 7:30pm
"Goodbye Lenin" at Reel Pizza from June 15 at 7:30pm
		

Includes

You can include other schedules by writing "include url" inside a schedule. The program will read the document at the url (up to a megabyte) and add any events it finds in paragraphs that begin with "Liesl" and end with "Thanks, hon". Macros do not carry over into included schedules.

Liesl,

Spring training from Feb. 28, 2016.

Include "http://spaghettilogic.org/schedules/redsox2016.html"

Thanks, hon