26.12.2013 Views

A computational grammar and lexicon for Maltese

A computational grammar and lexicon for Maltese

A computational grammar and lexicon for Maltese

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Abstract syntax<br />

At the language-independent level we want to model semantically the kinds of comments we<br />

wish to make about food. Note how the names of categories <strong>and</strong> functions are only given in<br />

English <strong>for</strong> ease of underst<strong>and</strong>ing; they are merely identifiers <strong>and</strong> could be named anything.<br />

We start by defining the kinds of food in our <strong>grammar</strong> (Cheese <strong>and</strong> Fish) <strong>and</strong> the qualities they<br />

may have (Expensive <strong>and</strong> Delicious). The Very function exists <strong>for</strong> intensifying qualities, <strong>and</strong><br />

This <strong>and</strong> That are functions which produce a demonstrative from a kind of food. Finally, the<br />

Pred (predication) function joins an Item <strong>and</strong> a Quality to give us a statement. Note that Comment<br />

is the top-level category in the <strong>grammar</strong>.<br />

abstract Foods = {<br />

flags<br />

startcat = Comment ;<br />

cat<br />

Comment ; Item ; Kind ; Quality ;<br />

fun<br />

Cheese, Fish : Kind ;<br />

Expensive, Delicious : Quality ;<br />

Very : Quality -> Quality ;<br />

This, These : Kind -> Item ;<br />

Pred : Item -> Quality -> Comment ;<br />

}<br />

Given this abstract <strong>grammar</strong>, we can construct a some abstract syntax trees which use these<br />

functions (illustrated in figure 1.2):<br />

Pred (This Fish) Delicious<br />

Pred (These Cheese) (Very Expensive)<br />

Pred : Comment<br />

Pred : Comment<br />

This : Item<br />

Delicious : Quality<br />

These : Item<br />

Very : Quality<br />

Fish : Kind<br />

Cheese : Kind<br />

Expensive : Quality<br />

Figure 1.2: Abstract syntax trees <strong>for</strong> the Foods <strong>grammar</strong><br />

English concrete syntax<br />

Now we want to describe how such trees can be linearised into our first language, English.<br />

We do this by writing a concrete <strong>grammar</strong> which contains lincat definitions <strong>for</strong> each of our<br />

10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!