|
From: | Matthew Welland |
Subject: | Re: [Chicken-users] Fwd: Newbie question - Converting SKILL/Scheme to C. |
Date: | Sat, 5 Sep 2009 11:54:13 -0700 |
User-agent: | KMail/1.11.2 (Linux/2.6.28-14-generic; KDE/4.2.2; i686; ; ) |
I have done this for some small SKILL programs before. If you have "c-style" (*yuck*) SKILL you will probably save some time by loading it into a cadence tool and using "pp" to convert it back to sane mode. It has been many years since I tried it but I'm pretty sure that works. -=- > Thanks Nicholas > The fact that the C code resulting from the translation is not humanly > readable is not important to me. I only intend to compile the C code > and link it against other libraries. > > /* */ style comments not being supported is a minor problem. > Infix not being supported is a slightly bigger deal, but manageable. > > Thanks! I'll keep on experimenting. > > Regards > Yaron > > On Tue, Sep 1, 2009 at 11:04 PM, Nicholas "Indy" Ray<address@hidden> wrote: > > So, Don't confuse the fact that Chicken compiles to C with being able > > to translate to C. The result of the Chicken compiler is doubtful to > > be maintainable by hand. If you run csc -t on a source file that > > actually compiles, you will see what sort of C Chicken generates. > > > > If you're still trying to get the SKILL program to compile in Chicken > > a fact brought up on the wikipedia page you linked will be > > problematic: > > > > http://en.wikipedia.org/wiki/Cadence_SKILL#Syntax > > > > SKILL seems to allow C style function calling and infex notation for > > some operators. Chicken Scheme (And most Schemes only) use prefix > > notation. > > > > So, function calls written as: > > > > Func(A B) > > > > will have to be rewritten as: > > > > (Func A B) > > > > And operators written as > > > > X + Y > > > > will have to be rewritten as > > > > (+ X Y) > > > > Additionally, for comments /* */ is not supported, Scheme comments > > start with a ; and go on till end of line. > > > > There are many other problems with the syntax of the small code > > snippets you linked, I suggest getting aquainted with standard Scheme > > > > Indy > > > > On Tue, Sep 1, 2009 at 8:11 PM, Yaron Kretchmer<address@hidden> wrote: > >> Hi Ray. > >> My apologies. Let me explain some more. > >> > >> I have a program written in a language called SKILL, which is a > >> variant of Scheme. SKILL is used in semiconductor design to describe > >> the layout of transistors, and is described briefly in > >> http://en.wikipedia.org/wiki/Cadence_SKILL > >> > >> I am interested in translating this SKILL program to C, and thought I > >> could use Chicken to accomplish that. I've installed and ran Chicken > >> on the various SKILL programs I have, and some of the trivial programs > >> compiled OK, whereas some of the more complex examples failed. This > >> might be related to the Syntax differences between SKILL and Scheme, > >> or is related to my incorrect usage of Chicken. > >> > >> > >> Is the above within the confines of this group? If it is, I'll send > >> the code that was causing me problems, and would appreciate any help, > >> > >> Best regards > >> Yaron > >> > >> On Tue, Sep 1, 2009 at 6:45 PM, Nicholas "Indy" Ray<address@hidden> wrote: > >>> Sorry, But I don't think the HTML was the major problem with the > >>> email. > >>> > >>> First of all it's not clear what you are trying to do. > >>> > >>> Second of all without any code to see what's generating you're errors > >>> it's hard to diagnose. > >>> > >>> Also things like > >>> > >>> "(() if (opptapObj->tap == "None" then return (nil) else return > >>> (t)))" > >>> > >>> and > >>> > >>> "/* comment > >>> and more comment > >>> end of comment */" > >>> > >>> and > >>> > >>> "prefix = substring(dev 1 2)" > >>> > >>> Looks nothing like Scheme code, much more like C code. Are you sure > >>> the code is Scheme at all?? > >>> Additionally this isn't exactally a good mailing list for converting > >>> code from SKILL to C as this is a Chicken Scheme mailing list, and > >>> unless Chicken is some how involved, neither C or Skill seems to > >>> apply. > >>> > >>> Indy > >>> > >>> On Tue, Sep 1, 2009 at 6:10 PM, Yaron Kretchmer<address@hidden> wrote: > >>>> Here's a resend with no HTML :P > >>>> ------------------------------- begin > >>>> resend------------------------------------- > >>>> > >>>> Hi All. > >>>> Just joined the group, so forgive my newbie questions :) > >>>> > >>>> I have some legacy code written in SKILL (a variant of Scheme) which > >>>> I'm trying to convert to C. > >>>> > >>>> I tried compiling the code , and got several different error > >>>> message, and was wondering whether somebody could suggest a solution > >>>> for each > >>>> > >>>> > >>>> =======================begin > >>>> problems========================================== Problem 1 - > >>>> substring > >>>> *) The code uses the "substring" function which the compiler seems > >>>> to have a problem with. So lines like > >>>> prefix = substring(dev 1 2) > >>>> create compiler error message like > >>>> Syntax error: illegal atomic form > >>>> > >>>> () > >>>> > >>>> Expansion history: > >>>> ... > >>>> <syntax> (dev 1 2) <-- > >>>> > >>>> problem 2 - multi-line comments > >>>> *) The compiler doesn't recognize multi-line comments > >>>> /* comment > >>>> and more comment > >>>> end of comment */ > >>>> > >>>> problem 3 - Unknown object methods > >>>> *) The code refers to object methods/properties through the use of > >>>> the "->" operator. The compiler doesn't like. > >>>> prog( () > >>>> if( opptapObj->tap == "None" then return(nil) else return(t)) > >>>> ) ;prog > >>>> > >>>> generates error > >>>> Syntax error: illegal atomic form > >>>> > >>>> () > >>>> > >>>> Expansion history: > >>>> > >>>> ... > >>>> <syntax> (() if (opptapObj->tap == "None" then > >>>> return (nil) else return (t))) <-- > >>>> ==================End > >>>> problems=============================================== > >>>> > >>>> Thanks a lot! > >>>> Yaron > >>>> > >>>> > >>>> _______________________________________________ > >>>> Chicken-users mailing list > >>>> address@hidden > >>>> http://lists.nongnu.org/mailman/listinfo/chicken-users > > _______________________________________________ > Chicken-users mailing list > address@hidden > http://lists.nongnu.org/mailman/listinfo/chicken-users |
[Prev in Thread] | Current Thread | [Next in Thread] |