summaryrefslogtreecommitdiff
path: root/examples/tutorial/semantics/Base.gf
blob: 4586c3106555a5585fc6ae4c08012c22bcf161f0 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- abstract syntax of a query language

abstract Base = {

cat
  S ; 
  NP ; 
  PN ;
  CN ; 
  AP ; 
  A2 ; 
  Conj ;
fun 

-- sentence syntax
  PredAP  : NP -> AP -> S ;

  ComplA2 : A2 -> NP -> AP ;

  ModCN   : AP -> CN -> CN ;

  ConjAP  : Conj -> AP -> AP -> AP ;
  ConjNP  : Conj -> NP -> NP -> NP ;

  UsePN   : PN -> NP ;
  Every   : CN -> NP ;
  Some    : CN -> NP ;

  And, Or : Conj ;  

-- lexicon

  UseInt  : Int -> PN ;

  Number : CN ;
  Even, Odd, Prime : AP ;
  Equal, Greater, Smaller, Divisible  : A2 ;

  Sum, Product, GCD : ListPN -> PN ;

-- adding questions

cat
  Question ;
  Answer ;
  ListPN ;
fun
  WhatIs   : PN -> Question ;
  WhichAre : CN -> AP -> Question ;
  QuestS   : S -> Question ;

  Yes   : Answer ;
  No    : Answer ;
  Value : NP -> Answer ;

  None  : NP ;
  Many  : ListPN -> NP ;
  BasePN : PN -> PN -> ListPN ;
  ConsPN : PN -> ListPN -> ListPN ; 
}