module - translating a Prolog module into "raw" Prolog
------ 

Files in this directory:

module.nl    - ptn code to translate a ".mod" file into a ".nl" file
module_gr.gr - the DCG for a simple modules language
test1.mod    - a sample module
test2.mod    - a sample module


To Run
------

% ../../ptn				% load ptn

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

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

3?- consult(module).			% consult module translator
Consulting module.nl.
true.

4?- module(test1).			% perform translation on file test1.mod
true.					% new file test1.nl created

5?- module(test2).  			% translate test2.mod => test2.nl
true.					

			% Inspect the files test1.nl and test2.nl

Some Explanation
----------------
This example of the use of PTN, is one where a 'higher-level' flavour
of Prolog (i.e. one with modules) is translated into "raw" Prolog.

Despite modules being mentioned in the ISO Proposed Standard, 
it is unlikely that all module supporting Prologs will be of
that format.

The module file here is somewhat simplistic - for demonstration purposes
there are two directives at the beginning of a ".mod" file

:- module <ModuleName>.
:- local <Name>/<Arity>. <Name2>/<Arity2>. .....

followed by clauses which may or may not be in the list of locals.


It is the locals that are to be translated, the <Name> being changed
into <ModuleName>$<Name>.

The new Prolog file has the suffix ".nl"

{Liz Haywood May 1994}

