Karin C's example

This commit is contained in:
aarne
2004-09-16 14:47:18 +00:00
parent 7769d0fb00
commit ecc132dccf
55 changed files with 2212 additions and 4 deletions

View File

@@ -0,0 +1,50 @@
-- File name Shared/general.Prolog.gf
include
general.Abs.gf ;
flags lexer=codelit ; unlexer=codelit ; startcat=DMoveList ;
oper
app : Str -> Str -> Str =
\pred -> \arg ->
pred ++ "(" ++ arg ++ ")" ;
appHakeOne : Str -> Str =
\arg ->
"["++ arg ++ "]" ;
lin
dmoves dm = {s = appHakeOne dm.s };
dmoves1 dm = {s = dm.s };
dmoves2 dm dms = {s = dm.s ++ "," ++ dms.s };
lin
answer p = {s = app "answer" p.s};
--request a = {s = app "request" a.s };
--- Answers
propans a = {s = a.s} ;
negpropans a = {s = app "not" a.s} ;
shortans a = {s = a.s} ;
negShortAns a = {s = a.s} ;
negprop n p = {s = n.s ++ p.s} ;
pattern
neg = [] ;
pattern
----Short answers
yes = "yes" ;
no = "no";
english = "english" ; ----???
swedish = "swedish" ; ----???
lin
indShortAns a = {s = a.s} ;
not n = {s = n.s} ;
--avsluta??
--börja om
top = { s = "top"} ;

View File

@@ -0,0 +1,51 @@
abstract general = {
cat
Action ;
DMove ;
DMoves ;
DMoveList ;
Ind ;
Prop ;
fun
--- DMove
dmoves : DMoves -> DMoveList ;
dmoves1 : DMove -> DMoves ;
dmoves2 : DMove -> DMoves -> DMove ;
-- File name User/general.Abs.gf
cat
Answer ;
ShortAns ;
NegShortAns ;
NegProp ;
Neg ;
fun
answer : Answer -> DMove ;
--request : Action -> DMove ;
--- Answers
propans : Prop -> Answer ;
negpropans : NegProp -> Answer ;
shortans : ShortAns -> Answer ;
negShortAns : NegShortAns -> Answer ;
negprop : Neg -> Prop -> NegProp ;
neg : Neg ;
--Short answers
swedish : ShortAns ;
english : ShortAns ;
yes : ShortAns ;
no : NegShortAns ;
indShortAns : Ind -> ShortAns ;
not : ShortAns -> NegShortAns ;
--avsluta??
--börja om
top : Action ;
}

View File

@@ -0,0 +1,43 @@
-- File name Shared/general.Prolog.gf
concrete generalProlog of general = open prologResource in {
flags lexer=codelit ; unlexer=codelit ; startcat=DMoveList ;
lin
dmoves dm = {s = appHakeOne dm.s };
dmoves1 dm = {s = dm.s };
dmoves2 dm dms = {s = dm.s ++ "," ++ dms.s };
lin
answer p = {s = app "answer" p.s};
--request a = {s = app "request" a.s };
--- Answers
propans a = {s = a.s} ;
negpropans a = {s = app "not" a.s} ;
shortans a = {s = a.s} ;
negShortAns a = {s = a.s} ;
negprop n p = {s = n.s ++ p.s} ;
pattern
neg = [] ;
pattern
----Short answers
yes = "yes" ;
no = "no";
english = "english" ; ----???
swedish = "swedish" ; ----???
lin
indShortAns a = {s = a.s} ;
not n = {s = n.s} ;
--avsluta??
--börja om
top = { s = "top"} ;
}

View File

@@ -0,0 +1,43 @@
concrete generalSwe of general = {
flags lexer=codelit ; unlexer=codelit ; startcat=DMoveList ;
lincat DMove = {s : Str} ;
lin
dmoves dm = {s = dm.s };
dmoves1 dm = {s = dm.s };
dmoves2 dm dms = {s = dm.s ++ "," ++ dms.s };
lin
answer a = {s = a.s } ;
--- Answers
propans a = {s = a.s} ;
negpropans a = {s = a.s} ;
shortans a = {s = a.s} ;
negShortAns a = {s = a.s} ;
negprop n p = {s= n.s ++ p.s} ;
pattern
neg = "inte" ;
pattern
--Short answers
swedish = "svenska" ;
english = "engelska" ;
yes = (variants {"ja" ; "jajamensan" ; "japp"}) ;
no = "nej";
lin
indShortAns a = {s = a.s} ;
not n = {s = n.s} ;
--avsluta??
--börja om
-- variants? från början etc?
top = { s = ["börja om"]} ;
}

View File

@@ -0,0 +1,19 @@
resource prologResource = {
oper
app : Str -> Str -> Str =
\pred -> \arg ->
pred ++ "(" ++ arg ++ ")" ;
appHakeOne : Str -> Str =
\arg ->
"["++ arg ++ "]" ;
oper
--with single quotes
--app2 : Str -> Str -> Str -> Str = \pred -> \argH -> \argM -> pred ++ "(" ++ "'" ++ argH ++ ":" ++ argM ++ "'" ++ ")" ;
--without single quotes
--app2 : Str -> Str -> Str -> Str = \pred -> \argH -> \argM -> pred ++ "(" ++ argH ++ ":" ++ argM ++ ")" ;
app3 : Str -> Str -> Str = \argH -> \argM -> argH ++ ":" ++ argM ;
}

View File

@@ -0,0 +1,29 @@
abstract specific = general, weekday, time, channel ** {
cat
StartTime ;
EndTime ;
ChToStore ;
WdToStore ;
cat
DelAction ;
fun
--- Inds
indTime : Time -> Ind;
indChannel : Channel -> Ind;
indWeekday : Weekday -> Ind;
fun
delAction : DelAction -> Action ;
delete_rec_job : DelAction ;
fun
startTimeToStore : Time -> StartTime ;
endTimeToStore : Time -> EndTime ;
channelToStore : Channel -> ChToStore ;
weekdayToStore : Weekday -> WdToStore ;
vcr_add_rec_job_no_args : Action ; ---- moved from specUser and specSystem
}

View File

@@ -0,0 +1,22 @@
-- File name Shared/specific.Prolog.gf
concrete specificProlog of specific =
generalProlog, weekdayProlog, channelProlog, timeProlog **
open prologResource in {
lin
indTime t = {s = t.s} ;
indChannel c = {s = c.s} ;
indWeekday w = {s = w.s} ;
delete_rec_job = {s = "delete_rec_job"} ;
delAction dact = {s = dact.s };
startTimeToStore st = {s = app "start_time_to_store" st.s } ;
endTimeToStore et = {s = app "stop_time_to_store" et.s } ;
channelToStore ch = {s = app "channel_to_store" ch.s } ;
weekdayToStore wd = {s = app "weekday_to_store" wd.s } ;
vcr_add_rec_job_no_args = {s = ["add_rec_job"]} ; -- hack!!!
}

View File

@@ -0,0 +1,20 @@
--# -path=.:../Time:../Channel:../Weekday
concrete specificSwe of specific = generalSwe, weekdaySwe, timeSwe, channelSwe ** {
lin
indTime t = {s = t.s} ;
indChannel c = {s = c.s} ;
indWeekday w = {s = w.s} ;
delete_rec_job = {s = ["ta bort inspelning"]} ;
delAction dact = {s = dact.s };
startTimeToStore st = {s = "från" ++ st.s } ;
endTimeToStore et = {s = "till" ++ et.s } ;
channelToStore ch = {s = "på" ++ ch.s } ;
weekdayToStore wd = {s = "på" ++ wd.s } ;
vcr_add_rec_job_no_args = {s = ["spela in"]} ; ----
}