Re: compiler and metadata, request opinions...

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Fri, 24 Apr 2009 20:31:08 +0200

          From comp.compilers

Related articles
compiler and metadata, request opinions... cr88192@hotmail.com (cr88192) (2009-04-22)
Re: compiler and metadata, request opinions... DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-04-24)
Re: compiler and metadata, request opinions... cr88192@hotmail.com (cr88192) (2009-04-25)
Re: compiler and metadata, request opinions... DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-04-27)
Re: compiler and metadata, request opinions... cr88192@hotmail.com (cr88192) (2009-04-28)
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Fri, 24 Apr 2009 20:31:08 +0200
Organization: Compilers Central
References: 09-04-051
Keywords: parse, design
Posted-Date: 25 Apr 2009 14:51:29 EDT

cr88192 schrieb:


> I am actually using the same parser for all 3 languages (and C++ as well,
> but this is a lower priority), where an internal "lang" variable is used to
> remember which language is being processed at the time (and adapt behavior
> as appropriate).


I'd use different frontends (parser...) for each language, each building
an canonical AST. Where "canonical" means that the AST is understood by
all following stages.


Problematic are e.g. classes, which have different implementations and
behaviour in C++, Java, .NET etc., so that the generated code for
dealing with an object has to take into account the language's class
model and lifetime rules.




> I have determined that, due to semantic and architectural issues, I can't
> embed the metadata directly into the object modules (the reason being that
> COFF and ELF modules are loaded as needed, but for technical reasons all of
> the metadata needs to be available to the runtime prior to the linking
> process).


What exactly is "metadata"?




> further context:
> portions of the runtime may register themselves with the linker, where a
> request for a particular piece of information is embedded in a symbol (sort
> of like in HTTP CGI requests), and so when a module is linked, the runtime
> may recieve the request and generate any code or data necessary to fullfill
> this request.


That's a consequent extension of the selectable frontend (language...).


The FreePascal compiler has an interesting model for dealing with
different target widgetsets, machines and systems. cpp will have a
similar model (dunno). You can declare abstract classes or interfaces
for your AST nodes and targets, and instantiate the appropriate
object(s) when the language, library type etc. is known.


DoDi



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.