This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I've been working on a TCL to Scheme translator, and I have a few questions to throw out there. Is there anyone else actively working on translating languages to Scheme? I've heard references to being able to use gdb to debug Scheme/Guile source. Is this true? Can someone point me to how I can do this? I'm trying to figure out how to integrate TCL and Scheme code -- in some ways it seems hopeless. However, that aside, maybe there's some ways to do some of these things: How can I convert a string to a variable. E.g., if the TCL tries to call a variable "*some-variable*" how can I use that string to get the value of *some-variable? How can I define a variable based on a string? E.g., if the TCL wishes to export some procedure, how can I put that procedure's name in the global namespace? Can anyone see possible solutions to the type problem -- i.e., that TCL has only one type (strings)? I think this will be a general problem for translated languages, because the type system of one language won't translate one-to-one to the type system of Scheme. If it is staticly typed you can munge your way around this, but most scripting languages aren't statically typed. The specific problem is that if a TCL program tries to call a Scheme program, how will it pass its arguments? A TCL string can be a list: "1 2 {3 4}" -> '(1 2 "3 4"), or maybe '(1 2 (3 4)) A number: "432.4e4" A channelId (a port): "file3" A block: "{puts hello ; puts world}" A variable reference: "x" as in "set x YYY" And, of course, a string. There's probably a number of other things it can be as well, all depending on the context. Even if some of these data types are not stored internally as strings, they are still essentially strings. For instance this: string compare [list member1 member2] "member1 member2" Must be true (and all the more subtle ways of expressing the same thing). One possiblity, of course, is to make any callouts by the TCL program use special type-identifiers. For instance: scheme:append [scheme:list "member1" "member2"] [scheme:list "member3"] It would be nice is there was something cleaner, though. Maybe there isn't. So, those are my questions. Hopefully you all can help me out. So far the translation seems like it's going fairly well -- I'm using a TCL interpreter written in Scheme, then applying a partial evaluator (Similix http://www.diku.dk/research-groups/topps/activities/similix.html). I don't think there's really any other reasonable way to translate TCL, it being so context sensitive. (I don't know how they byte-compile TCL -- the language seems practically designed to make it hard to compile by convential means). <-------------------------------------------------------------------> < Ian Bicking | bickiia@earlham.edu > < drawer #419 Earlham College | http://www.cs.earlham.edu/~bickiia > < Richmond, IN 47374 | (765) 973-2824 > <------------------------------------------------------------------->