Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370614

Summary: Make the EDT compiler extensible
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Matt Heitz <mheitz>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: pharmon, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: Extensibility_Compile

Description Matt Heitz CLA 2012-02-03 17:16:31 EST
The EDT compiler will be made extensible.  Custom code registered via an extension point will be able to override the default way that IRs are created.

This work rides the coattails of Bug 369139 - Create an extensible gen framework.  Anyone extending the compiler to produce custom IRs will have to also extend the generator to do something with the new IRs.

The compiler's extensibility is intentionally limited: extensions can create their own kind of IRs for functions, the call statement, and the I/O statements.  Everything else is considered too fundamental to change.  (If you want 'x = y;' to mean something other than an assignment statement, you're not really interested in EGL.)

The interfaces and extension point created for Bug 369139 will be renamed.  Their names are currently too generic, and their new names will make it clear that they're specifically for generation.  New interfaces and extension points will be added for compilation (and validation too, though that's not covered by this enhancement).

Compiler extensions will be able to add to the set of 'system' types, by adding eglars.

Our current compiler code will be refactored to use the interfaces and extension points.  In the areas that are extensible, no behavior will be hard-coded.

The interfaces and extension point are TBD at this time.  We expect to use a factory approach.  Multiple extensions will be allowed at the same time.  Each registered extension will have an opportunity to create the IR for a particular AST node.  The first extension which to decides to create the IR will do so, and any other extensions will not be invited to examine the AST node.  This implies an ordered 'extension path'.  Our implementation of the IR generators should be last in the path, so they'll be used if no extension is used.
Comment 1 Matt Heitz CLA 2012-02-06 10:42:37 EST
Jeff did the renaming mentioned above.  The new terminology for the generation
side is GenerationContribution which implements GenerationContributor.  The
extension point names have changed as well.  Example code can be found in
JavaGenerationContribution.
Comment 2 Matt Heitz CLA 2012-02-06 12:06:48 EST
(In reply to comment #1)
> Jeff did the renaming mentioned above.  The new terminology for the generation
> side is GenerationContribution which implements GenerationContributor.  The
> extension point names have changed as well.  Example code can be found in
> JavaGenerationContribution.

Scratch that...the new new names are GenerationContributor and GenerationContributable.
Comment 3 Matt Heitz CLA 2012-02-27 15:31:25 EST
(In reply to comment #2)
> the new new names are GenerationContributor and GenerationContributable.

Actually, the names are GenerationContributor and GenerationRegistry.
Comment 4 Paul Harmon CLA 2012-02-27 15:55:22 EST
I have updated the following classes to add the ability to get the current compiler from the org.eclipse.edt.compiler.Context that is used by the EGL2Mof code:

Context
Processor
SDKContext
EGLC
AbstractProcessingQueue
IDEContext
WorkingCopyGenerationOperation
Comment 5 Matt Heitz CLA 2012-03-06 09:40:08 EST
This is being deferred out of 0.8 I3.  We still have some open issues regarding how SQL statements should be implemented in the "core" vs. the "extension".  I will discuss them with Tim and continue the work for the next release.
Comment 6 Matt Heitz CLA 2012-06-14 10:04:28 EDT
Defer to 0.8.2.
Comment 7 Matt Heitz CLA 2012-11-16 13:28:57 EST
This was completed (mainly by Justin and Paul) in 0.8.2 M3.
Comment 8 Matt Heitz CLA 2012-11-19 08:17:17 EST
Closing.