Subject: Re: Multi files

From: Zheng Gengbing <[email-masked]>
Date: Tue, 11 Jun 1996 08:33:26 +0800 (EAT)

On Mon, 10 Jun 1996, Guansong Zhang wrote:

> On Jun 10,  4:51pm, Zheng Gengbing wrote:
> > Subject: Re: Multi files
> > On Fri, 7 Jun 1996, Guansong Zhang wrote:
> >
> > > On Jun 7,  8:51pm, Zheng Gengbing wrote:
> > > > Subject: Re: VPATH in new 1.56
> > > >
> > > >
> > > > 	Version 1.57 is ready now. This version have these features:
> > > >
> > > > 	2. files in /include /basicop are changed to prepare to support
> > > > 	   multifiles . In fact , now separate compilation is begin to
> > > >            be partly supported.
> > >
> > >
> > > I don't understand what do you mean by this. Could you please explain a
> little
> > > more?
> > >
> >
> >
> > 	Sorry , I had no time to explain in details .
> >
> > 	We are now trying to improve hpfsc to surpport multi files .
> >
> > 	To do such separate compilation , we need do a lot of change :
> >
> > 	1. delay some semantic checkings until link time .
> >
> > 	2. do global check after link .
> >
> > 	3. modify program structure to allow multifiles, especially main
> > 	   control part .
> >
> > 	4. produce .mod files according to the modules defined in a source
> > 	   file .
> >
> > 	5. merge dep files togather to produce a whole dep .
> >
> > 	now these flags are supported by hpfsc :
> > 	-m :     .mod files are produced .
> >
> > 	-o :     the name of the output dep file after link .
> >
> > 	-c :     separate compilation without link.
> >
> >
> > 	The difficulty is how .mod files are orgnized , so that other source
> > file which use the module can obtain the information , and make so many
> > pointers in AST consistent.
> >
> >
> >
> > Gengbin
> >
> >
> >-- End of excerpt from Zheng Gengbing
> 
> 
> I still have question. Suppose a .dep file was combined from several .dep files
> by hpfsc. Then this .dep file should be a complete program?
>

	The final  object file is a complete program . The source file
which is separately complied may be a incomplete dep.

> I mean is it possible for future seperate compiling? .dep is only something
> like .o to one extent, right? It is not final node program if we are doing
> compiler work. I don't know how you design this issue.
>

	Let me give a example. There are two files:
t1.f : 
  program t1
  use modA
  end

t2.f:
  module modA
  end

	let me give the sequence of the compile step ,
        1. hpf2dep t1.f  t2.f    ---
        2. hpfsc -m -c t2.dep
        3. hpfsc -o a.out   t1.dep t2.dep

	well , three flags -c -m -o are used here.
	when -m in the second step , a new file 'modA.mod' is generated to 
contain the information in module modA . -c make the hpfsc not do the 
link yet.
	while in the third step , after separate semantic checking of 
t1.dep and t2.dep , hpfsc will do the link . In link time , hpfsc will
do a global checking , and combine t1.dep and t2.dep togather , which will
produce a complete file . Using unparser you find this . 
	When separately compile t1.dep t2.dep ( sematic checking) , new t1.dep
and t2.dep is produced (as before). Please note , when cheking t1.dep , hpfsc
will decide if whether load modA.mod or not . When it decide to load it ,
hpfsc will contain the information in .mod files in the symbol table of 
its , and modified(append) its type table and llnd table as well.
So , now the dep file is not  complete, it contain none of the bfnd in 
the module it used (in this case modA).

	After link , a combined dep (I will call it as project )is 
generated , the default name now is a.dep.out (use the convention of a.out),
unless you give a output name in -o .
	
	Since  we have not merge hpf2dep and hpfsc togather , some abnormal 
problem arise .  In the example above , hpfsc cannot know which dep have 
already done the semantic checking , so as not to do again and only conduct 
the link.

> Guansong
> 
> P.S. I also do not know how you are going to deal with module part. Suppose we
> have a.f b.f both use module m, and m is in m.f
> 
> Is it possible for us to do combining like this:
> 
> m.dep and a.dep  to a+.dep
> m.dep and b.dep  to b+.dep
> 
> then a+.dep and b+.dep  to final.dep
> 
> Or, just m.dep a.dep and b.dep to final.dep
> 
> Then in the above two methods, do we get the same result?
> 
> 

***************************************************************************
*     Zheng Gengbin                 *                                     *
*                                   *                                     *
*  Dept. of Computer Science        *  Phone:  86-10-2585088              *
*         & Technology              *  Email:                             *
*                                   *      [email-masked]   *
*  Peking University P.R.China      *  Mail:                              *
*                                   *      Room 1077 ,Building 47,        *
*                                   *      Peking University, P.R.China   *
***************************************************************************