Contents    Page-10    Prev    Next    Page+10    Index   

Example Semantics for a Semantic Grammar

Suppose we want to use the semantic grammar given earlier to access a relational database containing information about ships. For simplicity, let us assume a single SHIP relation-as follows:

NAME TYP OWN LAT LONG SPD LNG
Kitty Hawk CV US 10o00'N 50o27'E 35 1200
Eclair SS France 20o00'N 05o30'E 15 50

Consider the query: What is the length of the fastest French sub in the Med?

This query is parsed by the top-level production


<S> --> What is <ship-property> of <ship>? 
which is conveniently structured in terms of:
  1. The data values to be retrieved: <ship-property>
  2. The data records (tuples) from which to retrieve the data: <ship>.
In each case, the values are additive and can be synthesized from the parse tree, as shown below.