[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Language plugins for cscc

From: Rhys Weatherley
Subject: Re: [DotGNU]Language plugins for cscc
Date: Fri, 08 Nov 2002 18:24:13 +1000

Adam Treat wrote:

> Am wondering about the details for language plugins to cscc.  The docs state:
> "The minimum you must provide is a translator between the source language and
> IL assembly code."  Am wondering about this plugin interface ... Would it be
> possible to extend this interface to allow language plugins written in C#?

Absolutely.  As far as the "cscc" front-end is concerned, a plugin
is an executable that understands some common command-line options,
and outputs IL assembly code that is ready to be fed into "ilasm".

Any command-line C# application would be able to do this, with
a little bit of script glue to launch "ilrun" on the "plugin.exe"
file.  e.g. to add support for the Foo language (source extension
of ".foo"), one would provide the following:

1. "cscc-foo.exe", written in C#, which understands the plugin option
   syntax and generates IL output.
2. /usr/local/lib/cscc/plugins/cscc-foo script (or cscc-foo-s):

   exec /usr/local/bin/ilrun /usr/local/lib/cscc/plugins/cscc-foo.exe $*

I could make it even easier by launching "ilrun" automatically if
it sees "cscc-foo.exe" (I'd need to be careful not to interfere
with Windows executables under cygwin, but it's doable).

The real issue is one of support code.  Because the C# plugin
wouldn't have direct access to the "pnet/codegen" stuff, it will
be necessary for the plugin to implement its own code generation,
option processing, type handling, etc, etc, etc.

If there is some interest in this, I could throw together a library
of routines that handle basic option processing, plugin setup and
teardown, along the lines of "pnet/cscc/common".  You'd then just
need to implement the "ICompiler" interface or somesuch.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]