Changeset 1533 for trunk/manuals

Show
Ignore:
Timestamp:
09/27/04 15:03:37 (4 years ago)
Author:
pmoura
Message:

Improved section on definite clause grammars on the user manual.

Location:
trunk/manuals
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/manuals/index.html

    r1515 r1533  
    3838 
    3939<div class="footer"> 
    40 <p><span class="bleft"><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span><span class="bright">Last updated on: September 23, 2004</span></p> 
     40<p><span class="bleft"><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span><span class="bright">Last updated on: September 27, 2004</span></p> 
    4141</div> 
    4242 
  • trunk/manuals/userman/index.html

    r1529 r1533  
    266266 
    267267<div class="footer"> 
    268 <p><span class="bleft"><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span><span class="bright">Last updated on: September 23, 2004</span></p> 
     268<p><span class="bleft"><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span><span class="bright">Last updated on: September 27, 2004</span></p> 
    269269</div> 
    270270</body> 
  • trunk/manuals/userman/predicates.html

    r1529 r1533  
    456456</pre> 
    457457<p> 
    458 In the body of a grammar rule, we can call rules that are inherited from ancestor objects (or imported categories) or contained in other objects. This is accomplished by using non-terminals as messages. Using a non-terminal as a message to self allows us to call grammar rules in categories and ancestor objects. To call grammar rules encapsulated in other objects, we use a non-terminal as a message to those objects. Along with the message sending operators (<code>::/1</code> and <code>::/2</code>), we may also use other control constructs such as <code>\+/1</code>, <code>!/0</code>, <code>;/2</code>, <code>->/2</code>, and <code>{}/1</code> in the body of a grammar. In addition, grammar rules may contain metacalls (a variable taking the place of a non-terminal), which are translated to calls of the built-in method <code>phrase/3</code>.  
     458In the body of a grammar rule, we can call rules that are inherited from ancestor objects, imported from categories, or contained in other objects. This is accomplished by using non-terminals as messages. Using a non-terminal as a message to self allows us to call grammar rules in categories and ancestor objects. To call grammar rules encapsulated in other objects, we use a non-terminal as a message to those objects. Consider the following example, containing grammar rules for parsing natural language sentences: 
     459</p> 
     460<pre> 
     461    :- object(sentence, 
     462        imports(determiners, nouns, verbs)). 
     463 
     464        :- public(parse/2). 
     465 
     466        parse(List, true) :- 
     467            phrase(sentence, List). 
     468        parse(_, false). 
     469 
     470        sentence --> noun_phrase, verb_phrase. 
     471 
     472        noun_phrase --> ::determiner, ::noun. 
     473        noun_phrase --> ::noun. 
     474 
     475        verb_phrase --> ::verb. 
     476        verb_phrase --> ::verb, noun_phrase. 
     477 
     478    :- end_object. 
     479</pre> 
     480<p> 
     481The object imported categories would contain the necessary grammar rules for parsing determiners, nouns, and verbs. For example: 
     482</p> 
     483<pre> 
     484    :- category(determiners). 
     485 
     486        :- private(determiner/2). 
     487 
     488        determiner --> [the]. 
     489        determiner --> [a]. 
     490 
     491    :- end_category. 
     492</pre> 
     493<p> 
     494Along with the message sending operators (<code>::/1</code> and <code>::/2</code>), we may also use other control constructs such as <code>\+/1</code>, <code>!/0</code>, <code>;/2</code>, <code>->/2</code>, and <code>{}/1</code> in the body of a grammar. In addition, grammar rules may contain metacalls (a variable taking the place of a non-terminal), which are translated to calls of the built-in method <code>phrase/3</code>.  
    459495</p> 
    460496<p> 
     
    671707 
    672708<div class="footer"> 
    673 <p><span class="bleft"><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span><span class="bright">Last updated on: September 23, 2004</span></p> 
     709<p><span class="bleft"><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span><span class="bright">Last updated on: September 27, 2004</span></p> 
    674710</div> 
    675711</body>