summaryrefslogtreecommitdiff
path: root/grammars
diff options
context:
space:
mode:
authoraarne <unknown>2004-04-29 04:03:19 +0000
committeraarne <unknown>2004-04-29 04:03:19 +0000
commitb5bb4fc2b5b1d7e8ce17eb87722ba11e46a2ab2b (patch)
treed96f0012126c7c7a929fe1c0b4b600155672f8fa /grammars
parent6993118eab6699182738ffcbddf03731ec41e1db (diff)
multimodality exx
Diffstat (limited to 'grammars')
-rw-r--r--grammars/prelude/HTML.gf8
-rw-r--r--grammars/prelude/Latex.gf12
-rw-r--r--grammars/timetable/TimetableEng.gf7
-rw-r--r--grammars/timetable/TimetableHTML.gf26
-rw-r--r--grammars/timetable/TimetableLatex.gf28
-rw-r--r--grammars/timetable/click.gf36
6 files changed, 101 insertions, 16 deletions
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 ("<table>" ++ "<tr><td></td>"++ cs.s ++ </tr> ++ ts.s ++ "</table>") ;
+ ss (intagAttr "table"
+ "border=ON" (intag "tr" (intag "td" [] ++ cs.s) ++ ts.s)) ;
NilTrain _ = ss [] ;
- ConsTrain cs n t ts =
- ss ("<tr>" ++ n.s ++ t.s ++ "</tr>") ;
- OneCity c = ss ("<td>" ++ c ++ "</td>") ;
- 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 ++ ")"} ;