Contents    Page-10    Prev    Next    Page+10    Index   

Restaurant Database Grammar


(defgrammar
  (s -> ((command) (a/an)? (qual)? (resttype)?
         (restword) (qualb)? (loc)?)
        (makequery (combine (retrieve 'restaurant)
                            (retrieve 'streetno)
                            (retrieve 'street)
                            (retrieve 'rating)
                            $3 $4 $6 $7)))
  (s -> (where can (i/you) (get) (qual)?
               (resttype)? food ? (loc)?)
        (makequery (combine (retrieve 'restaurant)
                            (retrieve 'streetno)
                            (retrieve 'street)
                            (retrieve 'rating)
                            $5 $6 $8)))
  (command  ->  (what is) t)
  (qual     ->  ((quality))
                      (restrictb '>= 'rating $1))
  (qualb    ->  (rated above (number))
                      (restrictb '>= 'rating $3))
  (resttype ->  ((kindfood))
                      (restrict 'foodtype $1))
  (loc      ->  (in (city))  (restrict 'city $2))  )