comp.lang.ada
 help / color / mirror / Atom feed
From: cl1motorsports <cwlambert76@yahoo.com>
Subject: Re: how do i implement double-dispatching?
Date: Sat, 20 Dec 2003 11:00:39 -0600
Date: 2003-12-20T11:00:39-06:00	[thread overview]
Message-ID: <pan.2003.12.20.17.00.33.831421@yahoo.com> (raw)
In-Reply-To: 18484099.QgktZUUZ8s@linux1.krischik.com

On Sat, 20 Dec 2003 10:56:07 +0100, Martin Krischik wrote:

> cl1motorsports wrote:
> 
>> and just to let y'all know. I'm trying to write a C to Ada translator. The
>> first task on my list is to handle #define statements. I'm sure this
>> should be in another thread if a topic gets started on this. But I thought
>> it would be nice to let y'all know what you were helping me with here.
> 
> Have you considered to send the C file thrue the C preprocessors and convert
> the output? #if #define etc. pp. will be cone by then.

What's the fun in that? Seriously though, the most common preprocessor is
the one that comes with gcc, and it puts alot of non standard C stuff in
its output. That is one reason I didn't want to do that. Another reason is
because some people may want to convert a whole project and want to keep
the preprocessed code. I already have some ideas on this

#define FOO
Foo : constant Boolean := True

#define FOO "i'm a string"
Foo : constant String(1..12") := "i'm a string";

#define FOO 12
Foo : constant := 12;

#define MAX(a,b) (a < b) b ? a;
generic
	type blah is <>;
function Max(a : blah; b : blah) return blah is
begin
	if (a < b) then
		return b;
	else
		return a;
	end if;
end Max;
function 

that's just a few examples. I also want to use the define statements to be
able to produce generic packages. I've got a direct conversion for most
types of #define statements (i think) except ones with the stringize and
concatination operators, and the ones that are just down right messy
(garbage in garbage out). Right now i'm just trying to work out a
framework for accomplishing this because i would also like to make some
other tools (maybe converters from other languages). I don't want ada to
die. And if there were converters from other langauges that would be a
start. Having common API's would be another great place. I think this tool
would make that easier as well (ala cbind style). i'm still in the
preliminary stages of this. However, I think with this one project i could 
take the information that i learn from it and apply it to several other
development tools, and that would put ada code directly in the programmers
hands.

> 
> With Regards
> 
> Martin




  reply	other threads:[~2003-12-20 17:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-17 18:08 how do i implement double-dispatching? cl1motorsports
2003-12-18  2:17 ` Stephen Leake
2003-12-18  9:48 ` Dmitry A. Kazakov
2003-12-18 15:13 ` Martin Krischik
2003-12-20  6:27 ` cl1motorsports
2003-12-20  9:56   ` Martin Krischik
2003-12-20 17:00     ` cl1motorsports [this message]
2003-12-21 13:39       ` Stephen Leake
2003-12-21 17:40         ` cl1motorsports
2003-12-22 22:47           ` Stephen Leake
2003-12-22 21:41   ` cl1motorsports
2003-12-22 21:47     ` cl1motorsports
2003-12-23 11:03       ` Dmitry A. Kazakov
2003-12-22 22:49     ` Stephen Leake
2003-12-22 23:04       ` cl1motorsports
replies disabled

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