I implemented something similar in my previous job based on functionality I saw in an application (non-4GL) I was exposed to before that.
It was to help keyboard users enter dates.
Basically if you were in a dateedit field you could a small (1 or 2 characters), press a function key, and have that interpreted into a date.
The expressions were something simple like ...
0 = today
1,2,...,31 = that day of the current month and year
+1 = tomorrow
+2,+3,... = that many days after today
-1 = yesterday
-2,-3,... = that many days before today
... and rarely used complex stuff like ...
+1[wmy] = add that many weeks, months, years to todays date
-1[wmy] = subtract that many weeks, months, years to todays date
<[wmy] = first day of the current week, month, year
>[wmy] = last day of the current week, month, year
and then it hooked into the accounts system so that
<[pqhf] = first day of the current period, quarter, half-year, financial year
>[pqhf] = last day of the current period, quarter, half-year, financial year
as well as other functionality for expressions like 20th following month, as well as only taking working days into consideration
... anyway to implement this in 4GL it was something like
ON ACTION datewizard
CALL FGL_DIALOG_SETBUFFER(datewizard(FGL_DIALOG_GETBUFFER()))
... and
FUNCTION datewizard(s)
DEFINE s STRING
CASE
WHEN s = "0" LET s = TODAY
...
OTHERWISE
-- leave s unchanged if unable to process
RETURN s
END FUNCTION
... and note that if you are using UNBUFFERED you have to set the validate attribute of the action to "no" e.g.
<ActionDefault name="datewizard" acceleratorName="F8" defaultView="auto" validate="no" />
... from memory I added as a global action so I didn't have to explicitly code into every single dialog