From b5bb4fc2b5b1d7e8ce17eb87722ba11e46a2ab2b Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 29 Apr 2004 04:03:19 +0000 Subject: [PATCH] multimodality exx --- examples/letter/Letter.gfcm | 6 ++--- grammars/prelude/HTML.gf | 8 +++++++ grammars/prelude/Latex.gf | 12 ++++++++++ grammars/timetable/TimetableEng.gf | 7 +++--- grammars/timetable/TimetableHTML.gf | 26 ++++++++++---------- grammars/timetable/TimetableLatex.gf | 28 ++++++++++++++++++++++ grammars/timetable/click.gf | 36 ++++++++++++++++++++++++++++ 7 files changed, 104 insertions(+), 19 deletions(-) create mode 100644 grammars/prelude/HTML.gf create mode 100644 grammars/prelude/Latex.gf create mode 100644 grammars/timetable/TimetableLatex.gf create mode 100644 grammars/timetable/click.gf diff --git a/examples/letter/Letter.gfcm b/examples/letter/Letter.gfcm index 377141d44..45f7c59c6 100644 --- a/examples/letter/Letter.gfcm +++ b/examples/letter/Letter.gfcm @@ -107,8 +107,8 @@ lin FormalEnding : Letter.Ending = \ Author @ 0 -> {s = table ResFra.Num {(ResFr lin GoBankrupt : Letter.Sentence = \ NounPhrase @ 0 -> {s = table ResFra.DepNum {(ResFra.depnum)(ResFra.cnum (ResFra.sg)) (ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> NounPhrase @ 0.s ++ (table ResFra.Num {(ResFra.sg)=> "a" ;(ResFra.pl)=> "ont" }! (NounPhrase @ 0.n)++ ("fait" ++ "banqueroute")) }}}}} ;"NounPhrase_0 a fait banqueroute" ; lincat Heading = {s : Str ;n : ResFra.Num ;g : ResFra.Gen }= {s = str @ 0 ;n = ;g = } ;"Heading" ; lin HelloRec : Letter.Heading = \ Recipient @ 0 -> {s = "Bonjour" ++ Recipient @ 0.s ;n = Recipient @ 0.n ;g = Recipient @ 0.g } ;"Bonjour Recipient_0" ; -lin Honour : Letter.Mode = \ -> {s = table ResFra.DepNum {(ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "avons" ++ ("l\'honneur" ++ "de" ++ ("vous" ++ "informer" ++ "que")) } ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "avons" ++ ("l\'honneur" ++ "de" ++ ("t\'informer" ++ "que")) }}} ;(ResFra.depnum)=> table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "avons" ++ ("l\'honneur" ++ "de" ++ ("vous" ++ "informer" ++ "que")) } ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "j\'ai" ++ ("l\'honneur" ++ "de" ++ ("t\'informer" ++ "que")) }}} ;(ResFra.cnum (ResFra.sg)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "j\'ai" ++ ("l\'honneur" ++ "de" ++ ("vous" ++ "informer" ++ "que")) } ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "j\'ai" ++ ("l\'honneur" ++ "de" ++ ("t\'informer" ++ "que")) }}}}} ;"j\\\'ai (l\\\'honneur de)t\\\'informer que" ; -lin ILoveYou : Letter.Sentence = \ -> {s = table ResFra.DepNum {(ResFra.cnum (ResFra.sg)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ ("vous" ++ "aime")} ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "t\'aime" }}} ;(ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ ("vous" ++ "aimons")} ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "t\'aimons" }}} ;(ResFra.depnum)=> table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "t\'aime" } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ ("vous" ++ "aimons")}}}}} ;"je t\\\'aime" ; +lin Honour : Letter.Mode = \ -> {s = table ResFra.DepNum {(ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "avons" ++ ("l\'honneur" ++ "de" ++ ("vous" ++ "informer" ++ "que")) } ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "avons" ++ ("l\'honneur" ++ "de" ++ ("t\'informer" ++ "que")) }}} ;(ResFra.depnum)=> table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "avons" ++ ("l\'honneur" ++ "de" ++ ("vous" ++ "informer" ++ "que")) } ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "j\'ai" ++ ("l\'honneur" ++ "de" ++ ("t\'informer" ++ "que")) }}} ;(ResFra.cnum (ResFra.sg)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "j\'ai" ++ ("l\'honneur" ++ "de" ++ ("vous" ++ "informer" ++ "que")) } ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "j\'ai" ++ ("l\'honneur" ++ "de" ++ ("t\'informer" ++ "que")) }}}}} ;"j\'ai (l\'honneur de)t\'informer que" ; +lin ILoveYou : Letter.Sentence = \ -> {s = table ResFra.DepNum {(ResFra.cnum (ResFra.sg)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ ("vous" ++ "aime")} ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "t\'aime" }}} ;(ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ ("vous" ++ "aimons")} ;(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "t\'aimons" }}} ;(ResFra.depnum)=> table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "t\'aime" } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ ("vous" ++ "aimons")}}}}} ;"je t\'aime" ; lin InformalEnding : Letter.Ending = \ Author @ 0 -> {s = table ResFra.Num {(ResFra.pl)=> table ResFra.Gen {(ResFra.fem)=> "Amicalement" ++ "

" ++ Author @ 0.s ! ! ;(ResFra.masc)=> "Amicalement" ++ "

" ++ Author @ 0.s ! ! } ;(ResFra.sg)=> table ResFra.Gen {(ResFra.fem)=> "Amicalement" ++ "

" ++ Author @ 0.s ! ! ;(ResFra.masc)=> "Amicalement" ++ "

" ++ Author @ 0.s ! ! }} ;n = Author @ 0.n ;g = Author @ 0.g } ;"(Amicalement

)Author_0" ; lin JustHello : Letter.Heading = \ Recipient @ 0 -> {s = "Bonjour" ;n = Recipient @ 0.n ;g = Recipient @ 0.g } ;"Bonjour" ; lincat Letter = {s : Str }= {s = str @ 0 } ;"Letter" ; @@ -128,7 +128,7 @@ lincat Position = {s : (ResFra.Num => (ResFra.Gen => Str)) }= {s = table ResFra. lin President : Letter.Author = \ -> {s = table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "le" ++ "président" }} ;n = > ;g = > } ;"le président" ; lin ProjectManager : Letter.Position = \ -> {s = table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "chef" ++ ("de" ++ "projet")} ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "chefs" ++ ("de" ++ "projets")}}} ;"chef de projet" ; lincat Recipient = {s : Str ;n : ResFra.Num ;g : ResFra.Gen }= {s = str @ 0 ;n = ;g = } ;"Recipient" ; -lin Regret : Letter.Mode = \ -> {s = table ResFra.DepNum {(ResFra.depnum)=> table ResFra.DepGen {(ResFra.depgen)=> table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) ;(ResFra.masc)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) ;(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.masc)) => table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) }}} ;(ResFra.cnum (ResFra.sg)) => table ResFra.DepGen {(ResFra.depgen)=> table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) ;(ResFra.masc)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.masc)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) }}} ;(ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)=> table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) ;(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.masc)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }}}}} ;"(je suis)désolée d\\\'informer que" ; +lin Regret : Letter.Mode = \ -> {s = table ResFra.DepNum {(ResFra.depnum)=> table ResFra.DepGen {(ResFra.depgen)=> table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) ;(ResFra.masc)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) ;(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.masc)) => table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) }}} ;(ResFra.cnum (ResFra.sg)) => table ResFra.DepGen {(ResFra.depgen)=> table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) ;(ResFra.masc)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.masc)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolé" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "je" ++ "suis" ++ ("désolée" ++ ("d\'informer" ++ "que")) }}} ;(ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)=> table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) ;(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolées" ++ ("d\'informer" ++ "que")) }} ;(ResFra.cgen (ResFra.masc)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "nous" ++ "sommes" ++ ("désolés" ++ ("d\'informer" ++ "que")) }}}}} ;"(je suis)désolée d\'informer que" ; lin Senior : Letter.Position = \ -> {s = table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "responsable" ++ "scientifique" } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> "responsables" ++ "scientifiques" }}} ;"responsable scientifique" ; lincat Sentence = {s : (ResFra.DepNum => (ResFra.DepGen => (ResFra.Num => (ResFra.Gen => Str)))) }= {s = table ResFra.DepNum {(ResFra.depnum)(ResFra.cnum (ResFra.sg)) (ResFra.cnum (ResFra.pl)) => table ResFra.DepGen {(ResFra.depgen)(ResFra.cgen (ResFra.masc)) (ResFra.cgen (ResFra.fem)) => table ResFra.Num {(ResFra.sg)(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)(ResFra.fem)=> str @ 0 }}}}} ;"Sentence" ; lin Spouse : Letter.Author = \ -> {s = table ResFra.Num {(ResFra.sg)=> table ResFra.Gen {(ResFra.masc)=> "ta" ++ "femme" ;(ResFra.fem)=> "ton" ++ "mari" } ;(ResFra.pl)=> table ResFra.Gen {(ResFra.masc)=> "vos" ++ "femmes" ;(ResFra.fem)=> "vos" ++ "maris" }} ;n = ;g = } ;"ta femme" ; diff --git a/grammars/prelude/HTML.gf b/grammars/prelude/HTML.gf new file mode 100644 index 000000000..b469b582c --- /dev/null +++ b/grammars/prelude/HTML.gf @@ -0,0 +1,8 @@ +resource HTML = open Prelude in { + oper + tag : Str -> Str = \t -> "<" + t + ">" ; + endtag : Str -> Str = \t -> tag ("/" + t) ; + intag : Str -> Str -> Str = \t,s -> tag t ++ s ++ endtag t ; + intagAttr : Str -> Str -> Str -> Str = + \t,a,s -> ("<" + t) ++ (a + ">") ++ s ++ endtag t ; +} diff --git a/grammars/prelude/Latex.gf b/grammars/prelude/Latex.gf new file mode 100644 index 000000000..2fd2f9ec8 --- /dev/null +++ b/grammars/prelude/Latex.gf @@ -0,0 +1,12 @@ +resource Latex = open Prelude in { + oper + command : Str -> Str = \c -> "\\" + c ; + fun1 : Str -> Str -> Str = \f,x -> "\\" + f + "{" ++ x ++ "}" ; + fun2 : Str -> Str -> Str -> Str = + \f,x,y -> "\\" + f + "{" ++ x ++ "}{" ++ y ++ "}" ; + begin : Str -> Str = \e -> "\\begin{" + e + "}" ; + end : Str -> Str = \e -> "\\end{" + e + "}" ; + inEnv : Str -> Str -> Str = \e,s -> begin e ++ s ++ end e ; +} + + diff --git a/grammars/timetable/TimetableEng.gf b/grammars/timetable/TimetableEng.gf index 2800ce010..498f96975 100644 --- a/grammars/timetable/TimetableEng.gf +++ b/grammars/timetable/TimetableEng.gf @@ -3,9 +3,10 @@ concrete TimetableEng of Timetable = open Prelude in { lin - MkTable cs ts = ss (["trains on the line from"] ++ cs.s ++ ":" ++ ts.s) ; + MkTable cs ts = + ss (["The following trains run on the line from"] ++ cs.s ++ "." ++ ts.s) ; NilTrain _ = ss [] ; - ConsTrain cs n t ts = ss (n.s ++ ":" ++ t.s ++ ";") ; + ConsTrain cs n t ts = ss (n.s ++ ":" ++ t.s ++ "." ++ ts.s) ; OneCity c = c ; ConsCity c cs = ss (c.s ++ "to" ++ cs.s) ; @@ -16,7 +17,7 @@ concrete TimetableEng of Timetable = open Prelude in { CityTrain c s cs t = ss (c.s ++ s.s ++ "," ++ t.s) ; T i = prefixSS "at" i ; - N n = prefixSS "train" n ; + N n = prefixSS "Train" n ; C s = s ; } diff --git a/grammars/timetable/TimetableHTML.gf b/grammars/timetable/TimetableHTML.gf index 41b7c39a0..0fec2a1ab 100644 --- a/grammars/timetable/TimetableHTML.gf +++ b/grammars/timetable/TimetableHTML.gf @@ -1,24 +1,24 @@ --# -path=.:../prelude -concrete TimetableHTML of Timetable = open Prelude in { +concrete TimetableHTML of Timetable = open Prelude, HTML in { lin MkTable cs ts = - ss ("" ++ ""++ cs.s ++ ++ ts.s ++ "
") ; + ss (intagAttr "table" + "border=ON" (intag "tr" (intag "td" [] ++ cs.s) ++ ts.s)) ; NilTrain _ = ss [] ; - ConsTrain cs n t ts = - ss ("" ++ n.s ++ t.s ++ "") ; - OneCity c = ss ("" ++ c ++ "") ; - ConsCity c cs = ss (c.s ++ "to" ++ cs.s) ; + ConsTrain cs n t ts = ss (intag "tr" (intag "td" n.s ++ t.s) ++ ts.s) ; + OneCity c = ss (intag "td" c.s) ; + ConsCity c cs = ss (intag "td" c.s ++ cs.s) ; - StopTime t = t ; - NoStop = ss ["no stop"] ; + StopTime t = ss (intag "td" t.s) ; + NoStop = ss (intag "td" "-") ; - LocTrain c s = cc2 c s ; - CityTrain c s cs t = ss (c.s ++ s.s ++ "," ++ t.s) ; + LocTrain c s = s ; + CityTrain c s cs t = ss (s.s ++ t.s) ; - T i = prefixSS "at" i ; - N n = prefixSS "train" n ; - C s = s ; + T i = i ; + N n = ss (intag "b" n.s) ; + C s = ss (intag "b" s.s) ; } diff --git a/grammars/timetable/TimetableLatex.gf b/grammars/timetable/TimetableLatex.gf new file mode 100644 index 000000000..f0d4f0939 --- /dev/null +++ b/grammars/timetable/TimetableLatex.gf @@ -0,0 +1,28 @@ +--# -path=.:../prelude + +concrete TimetableLatex of Timetable = open Prelude, Latex in { + + lincat + CityList = {s,s2 : Str} ; -- s2 encodes table width + + lin + MkTable cs ts = + ss ("\\documentstyle{article}" ++ inEnv "document" ( + (inEnv "tabular" ("{" ++ cs.s2 ++ "}" ++ "&" ++ cs.s ++ + command "hline" ++ ts.s)))) ; + NilTrain _ = ss [] ; + ConsTrain cs n t ts = ss (n.s ++ "&" ++ t.s ++ "\\\\" ++ ts.s) ; + OneCity c = {s = c.s ++ "\\\\" ; s2 = "l|l"} ; + ConsCity c cs = {s = c.s ++ "&" ++ cs.s ; s2 = "l|" ++ cs.s2} ; + + StopTime t = t ; + NoStop = ss "---" ; + + LocTrain c s = s ; + CityTrain c s cs t = ss (s.s ++ "&" ++ t.s) ; + + T i = i ; + N n = n ; --- ss (fun1 "textbf" n.s) ; + C s = s ; --- ss (fun1 "textbf" s.s) ; + +} diff --git a/grammars/timetable/click.gf b/grammars/timetable/click.gf new file mode 100644 index 000000000..d752fb027 --- /dev/null +++ b/grammars/timetable/click.gf @@ -0,0 +1,36 @@ +cat + Request ; + Place ; + Position ; + +fun + GoTo : Place -> Request ; + GoFromTo : Place -> Place -> Request ; + + Named : String -> Place ; + Pointed : Position -> Place ; + + Pos : Int -> Int -> Position ; + +lincat + Request, Place = {s,s2 : Str} ; + +lin + GoTo x = { + s = ["I want to go to"] ++ x.s ; + s2 = x.s2 + } ; + GoFromTo x y = { + s = ["I want to go from"] ++ x.s ++ "to" ++ y.s ; + s2 = x.s2 ++ "," ++ y.s2 + } ; + + Named c = { + s = c.s ; + s2 = [] + } ; + Pointed p = { + s = "here" ; + s2 = p.s + } ; + Pos x y = {s = "(" ++ x.s ++ "," ++ y.s ++ ")"} ;