comp.lang.ada
 help / color / mirror / Atom feed
From: Lucretia <lucretia9@lycos.co.uk>
Subject: Re: Implementing an Ada compiler and libraries.
Date: 11 May 2007 15:41:35 -0700
Date: 2007-05-11T15:41:35-07:00	[thread overview]
Message-ID: <1178923295.678315.237810@e65g2000hsc.googlegroups.com> (raw)
In-Reply-To: <wcc4pmjnhgl.fsf@shell01.TheWorld.com>

On May 11, 11:06 pm, Robert A Duff <bobd...@shell01.TheWorld.com>
wrote:
> Lucretia <lucret...@lycos.co.uk> writes:
> > True, but how would a compiler that didn't impose limits (are there
> > any?) manage to find compilation units with'd?
>
> Here's one way:
>
> I presume the way one invokes the compiler is via a "build" tool of some
> sort (something like gnatmake or adabuild).
>
> Keep a data structure that tells which compilation units are in which
> source files.  Whenever the build tool is invoked, it first parses all
> the files that changed since last time, and updates this data structure.
> If any files are new, they need to be parsed.  If any files have been
> deleted, all information about them in the data structure should be
> deleted.  You can store this data structure on disk, if you like.

So, essentially you're saying create a project file which lists which
compilation units are in which files then the build tool will know
where they are?

> At this point, give an error if there are duplicate names (unless the
> user has explicitly requested that one should override the other).
>
> Now you have all the information you need to run the rest of the
> compiler phases (after parsing) on everything in the right order
> (or partially in parallel).
>
> I know this method can be implemented efficiently, because I've done it
> several times (not for Ada compilers, but for other language processing
> tools (Ada and non-Ada)).
>
> >... At least with GNAT it
> > uses package name => filename, so that's easy to implement, but with
> > multiple compilation units per file, it's much more tricky. I've
> > basically thought the only way to partially do it is to compile the
> > source into a parse tree, then traverse it to generate the AST,
>
> Generate the AST from the parse tree?  I normally generate the syntax
> tree directly during parsing.

Well, I was thinking that as you didn't know which compilation units
were in which files, then building a tree without checking, you can
then parse the tree and when you hit a "with" node, you then start
looking for other compilation units.

Just a thought ;D

Thanks,
Luke.




  reply	other threads:[~2007-05-11 22:41 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09 14:37 Implementing an Ada compiler and libraries Lucretia
2007-05-09 16:51 ` Dmitry A. Kazakov
2007-05-09 17:21   ` Lucretia
2007-05-10  7:59     ` Dmitry A. Kazakov
2007-05-10  8:51       ` Duncan Sands
2007-05-10 17:39       ` Lucretia
2007-05-10 18:06         ` Lucretia
2007-05-10 19:30           ` Dmitry A. Kazakov
2007-05-11  7:14           ` Gautier
2007-05-11 17:39             ` Lucretia
2007-05-11 17:43               ` Lucretia
2007-05-11 18:20                 ` Robert A Duff
2007-05-11 18:49                   ` Lucretia
2007-05-11 20:34                     ` Georg Bauhaus
2007-05-11 22:37                       ` Lucretia
2007-05-11 22:06                     ` Robert A Duff
2007-05-11 22:41                       ` Lucretia [this message]
2007-05-16 19:40                 ` Randy Brukardt
2007-05-09 20:48 ` Robert A Duff
2007-05-10  3:38   ` Lucretia
2007-05-16 19:58   ` Randy Brukardt
2007-05-09 21:15 ` Gautier
2007-05-10  3:39   ` Lucretia
2007-05-10 15:34   ` Stefan Bellon
2007-05-10 16:25     ` Jean-Pierre Rosen
2007-05-10 17:07       ` Ludovic Brenta
2007-05-10 17:14         ` Stefan Bellon
2007-05-10 16:37     ` Ludovic Brenta
2007-05-10 16:43       ` Stefan Bellon
2007-05-10 16:49         ` Ludovic Brenta
2007-05-10 17:02           ` Stefan Bellon
2007-05-10 19:57             ` Jacob Sparre Andersen
2007-05-10 20:31             ` Simon Wright
2007-05-10 17:37       ` Pascal Obry
2007-05-11 10:09         ` Ludovic Brenta
2007-05-11 16:33           ` Pascal Obry
2007-05-10 17:36     ` Pascal Obry
2007-05-10 17:42     ` Lucretia
2007-05-10 17:34 ` Pascal Obry
2007-05-10 17:48   ` Lucretia
2007-05-10 20:01   ` Duncan Sands
2007-05-10 21:00     ` Pascal Obry
2007-05-11 11:04       ` Duncan Sands
2007-05-13 12:03         ` Ludovic Brenta
2007-05-10 21:00     ` Pascal Obry
2007-05-11  8:39   ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox