summaryrefslogtreecommitdiff
path: root/grammars/logic/LogicResEng.gf
blob: 94866bf051320cf2867b9f18353d2f00ced2d546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
resource LogicResEng = {

param Num = sg | pl  ;

oper 
  
  ss  : Str -> {s : Str} = \s -> {s = s} ;

  nomReg : Str -> Num => Str = \s -> table {sg => s ; pl => s + "s"} ;

  indef : Str = pre {"a" ; "an" / strs {"a" ; "e" ; "i" ; "o"}} ;

  LinElem : Type = {s : Str} ;
  LinProp : Type = {s : Str} ;

  adj1 : Str -> LinElem -> LinProp = 
    \adj,x -> ss (x.s ++ "is" ++ adj) ;
  adj2 : Str -> LinElem -> LinElem -> LinProp = 
    \adj,x,y -> ss (x.s ++ "is" ++ adj ++ y.s) ;

  fun1 : Str -> LinElem -> LinElem = 
    \f,x -> ss ("the" ++ f ++ "of" ++ x.s) ;
  fun2 : Str -> LinElem -> LinElem -> LinElem = 
    \f,x,y -> ss ("the" ++ f ++ "of" ++ x.s ++ "and" ++ y.s) ;


} ;