h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=2o8AIYoi6IJuRmUBHIjCi1m4kUcJ3EpI3VCfd8TyA9c=; b=p6oKYvZUyXyfK4sRsnnXxI1Rgt9JuVI80qjcHZnw2NW9wvyg0StDogKS1TacmrpDu2zB+lBCYaSdZPLwhA/s6ssBH2pwn1KKEhEKhtas+zsrjNv9Y7qB7A2r8tVMU141/NUMCAyhuTXuGWf6XM+3/57+bltV6b0oMxQMaCgF5e8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=lrMSAw/dzWkk2l7Y82yp9AtkgHDE2BDE0CS8CjJwUDV1oZsW6d5daU/ktoFAfNw5g9E/fjR887xay3hi+3BFi7w7VL1rU3x6eVe6BItM3mU4axHVloHit9b30tFm6JeJ0pg/60bXYCCR/+FLfNk9TeYgQ6gxfQpWzPKCEKq1lhw= Received: by 10.66.220.12 with SMTP id s12mr5349853ugg.1194320878294; Mon, 05 Nov 2007 19:47:58 -0800 (PST) Received: by 10.67.22.20 with HTTP; Mon, 5 Nov 2007 19:47:58 -0800 (PST) Message-ID: <5f27691c0711051947j5d625d8ema1530eb3e56314e9 at mail.gmail.com> Date: Mon, 5 Nov 2007 20:47:58 -0700 From: "codepilot Gmail Account" <codepilot at gmail.com> To: EUforum at topica.com Subject: Re: C to EU Translator In-Reply-To: <996636586-1463747838-1194199112 at boing.topica.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_24843_19006174.1194320878291" References: <996636586-1463747838-1194199112 at boing.topica.com> ------=_Part_24843_19006174.1194320878291 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'll look at the stucture thing more, and also see how involved a complete C processor would be. Daniel On 11/4/07, Chris Bensler <guest at rapideuphoria.com> wrote: > > ============ The Euphoria Mailing List ============ > > > posted by: Chris Bensler <eu at creativep?rta?.ca> > > codepilot Gmail Account wrote: > > > > Hmm. Maybe I should make it do macros and structures? Good idea! I have > > already done COM. I know that macros can do a lot of things, should they > > turn into functions? At some point a full blown C to Euphoria translator > > needs to be made, because made H files have things that aren't as cut > and > > dry as a simple specification of call point entries/types/constants. > Many of > > the macros do a lot of work precompile that would make much sense in run > > time, in euphoria as functions. And I really can't think of a good way > to do > > structures, maybe some ideas would be good. > > In previous attempts at making a C2EU translator, I aimed for a hybrid > system involving several steps. Something like Auto->Manual->Auto->Manual. > All in all I thought it was quite successful, but the process was still > fairly labour intensive. Eg. All macros that were determined not to be > constant values, were simply output as commented code. There were also > portions of code that I didn't know how to handle correctly at the time or > the translator was too dumb to handle, so I made a line matching cache, > which the user would be prompted to manually convert a given line and the > two would would then be stored in the cache file for later uses, without > having to re-enter that line conversion again. > > This system had a few main drawbacks though. Mainly it only produced a > single state of the api. Eg. Win98 and Ansi > Producing another state would require going through the entire process > again and having multiple versions of the API to deal with. > > It's been a while since I was working on it, but IIRC, there is 3 basic > types of macros: constants, functions, and fragments > Constants are fairly easy to determine, but to be able to identify > functions from fragments, the translator must be capable of validating the C > code as being self contained. Essentially this means that the translator > must be capable of processing C code 100%. > > Structures are fairly difficult to process from the C code as well. It > requires a fairly complete processor to be able to handle all possible > occurances. For conversion to Euphoria, there is various methods that could > be used for the generated structures. Win32lib uses it's own system of > store/fetch I beleive. I think Bernie Ryan created a structure library made > of machine code. And I wrote a structure emulation library. > > Chris Bensler > Code is Alchemy ------=_Part_24843_19006174.1194320878291--