grades - translate a text file representing grades into Prolog terms
------

Files in this directory:

demo.nl    - demo file containing code to extract information from text file
grades_gr.gr  - the grammar rules for the text file 
grades.txt    - the text file containing grade information

To Run
------

% ../../ptn				% load ptn

NU-Prolog 1.6.4
1?- gr2nl(grades_gr).			% translate grammar rules
true.					% create ".nl" file - once only

2?- consult(grades_gr).			% consult grammar rules
Consulting grades_gr.nl.		% (ignore warning)	
Warning: descendent/2 redefined
true.					  

3?- consult(demo).			% consult demo program 
Consulting demo.nl.
true.

4?- demo.				% extract and manipulate information
Id       Scores
100  10  3  5  7  6  6  2  10
101  3  4  2  wh  6  4  5  9		% each person's Id and scores
.....
.....

Avs  5  3  2  3  7  6  4  7		% the averages of each set of scores

Id  Average
100  6.125				% each person's Id and Average
101  4.125
...
...


true.

Some Explanation
----------------

This demonstrates how PTN can be used in a non-programming application
to manipulate information set out in a form for which a grammar can
be readily declared.
 
The example is a text file containing grade information, grades.txt.
It is set out in lines, one for each person, each line having the format:

Name:Id:Grade1:Grade2:Grade3...........


demo/0 tokenizes and parses the file according to the grammar in grades_gr.gr
extracts the "lines" from the program parse tree and then uses the information
to present the individual scores, an average of each set of scores
and each person's Id and average.


{Liz haywood May 1994}
