diff --git a/lib/resource/time/Time.gf b/lib/resource/time/Time.gf new file mode 100644 index 000000000..4be257573 --- /dev/null +++ b/lib/resource/time/Time.gf @@ -0,0 +1,54 @@ +abstract Time = Numeral ** { + +-- Time grammar Abstract syntax. Modified by AR from Karin Cavallin. + +cat + +Date ; +Hour ; +Minute ; +Weekday ; + +fun + +-- The variants: "two twenty", "twenty past two", "twenty to two" + +DayDate : Weekday -> Date ; +DayTimeDate : Weekday -> Time -> Date ; + +FormalTime : Hour -> Minute -> Time ; +PastTime : Hour -> Minute -> Time ; +ToTime : Hour -> Minute -> Time ; +ExactTime : Hour -> Time ; + +-- These range from 1 to 99 and are thus overgenerating. + +NumHour : Sub100 -> Hour ; +NumMinute : Sub100 -> Minute ; + +fun +monday : Weekday ; +tuesday : Weekday ; +wednesday : Weekday ; +thursday : Weekday ; +friday : Weekday ; +saturday : Weekday ; +sunday : Weekday ; + +{- +Add: + +years + +dates: the x:th of y + +relative weeks: next week, last week, in x weeks, x weeks ago + +relative days: today, tomorrow, yesterday, the day before yesterday, +the day after tomorrow, in x days, x days ago + +relative time: in x minutes, in x hours + +-} + +} ; diff --git a/lib/resource/time/TimeEng.gf b/lib/resource/time/TimeEng.gf new file mode 100644 index 000000000..bd2863664 --- /dev/null +++ b/lib/resource/time/TimeEng.gf @@ -0,0 +1,32 @@ +--# -path=.:present +concrete TimeEng of Time = NumeralEng ** + open Prelude, CatEng, ParadigmsEng, ResEng in { + +lincat +Date = SS ; +Weekday = N ; +Hour = SS ; +Minute = SS ; +Time = SS ; + +lin +DayDate day = ss (day.s ! singular ! nominative) ; +DayTimeDate day time = ss (day.s ! singular ! nominative ++ "at" ++ time.s) ; + +FormalTime = infixSS ["hundred and"] ; +PastTime h m = ss (m.s ++ "past" ++ h.s) ; +ToTime h m = ss (m.s ++ "to" ++ h.s) ; +ExactTime h = ss (h.s ++ "sharp") ; + +NumHour n = {s = n.s ! NCard} ; +NumMinute n = {s = n.s ! NCard} ; + +monday = mkN "Monday" ; +tuesday = mkN "Tuesday" ; +wednesday = mkN "Wednesday" ; +thursday = mkN "Thursday" ; +friday = mkN "Friday" ; +saturday = mkN "Saturday" ; +sunday = mkN "Sunday" ; + +} ;