Jump to page: 1 2
Thread overview
Integrated Scripting
May 17, 2004
mike parker
May 17, 2004
Daniel Horn
May 17, 2004
Andrew
May 18, 2004
Mike Parker
May 21, 2004
Brian Hammond
May 21, 2004
Brian Hammond
May 21, 2004
J Anderson
May 21, 2004
Brian Hammond
May 17, 2004
Billy Zelsnack
May 18, 2004
Tu Nam
May 18, 2004
J Anderson
May 17, 2004
I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.

It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).

I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.

So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?
May 17, 2004
it would be nice if the scripting language had the same syntax pretty similar to D...in fact couldn't the compiler just compile a copy of itself into its' dynamic loading system
then compile fed-in d source code to the compiler then the module loader...
that would be really nice--no glue of any kind would be needed and regular users could immediately edit models without rebuilding libs and getting the build path and env all setup.


mike parker wrote:
> I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.
> 
> It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).
> 
> I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.
> 
> So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?
May 17, 2004
In article <c8b5t4$qvu$1@digitaldaemon.com>, mike parker says...
>
>I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.
>
>It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).
>
>I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.
>
>So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?

Don't know but this might be of interest to you:

http://www.digitalmars.com/dscript/index.html

It might not be exactly what you are looking for. Unfortunately, I've never used it so I couldn't comment on it.

Andrew


May 17, 2004
I don't think an official scripting language is a good plan, but I do think making the process as painless as possible for existing scripting languages would be a good idea.

Boost Python is pretty nice, but compile times really kill it. Exposing this and that soon turns into exposing everything.

When it comes down to it, you generally end up doing lots of sets, gets, and calls by name. You can already switch on strings and that cleans things up dramatically. Maybe if there were default operator overloads with names.

class Foo
{
  float _x;
  int _y;

//compiler would generate something like this
void opIndex(char[] memberName,Object obj)
{
  switch(memberName)
  {
    case "_x":{_x=to_float(obj);break;}
    case "_y":{_y=to_int(obj);break;}
    default:{super.opIndex(memberName,obj);break;}
  }
}

}

Of course you could do that manually too.

Dunno. Just an idea.



mike parker wrote:
> I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.
> 
> It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).
> 
> I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.
> 
> So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?
May 18, 2004
Sorry I have awrong place reply . Please delete all my post in this thread "Tu Nam" <dreamweaver@mail15.com> wrote in message news:c8cr7g$bjf$1@digitaldaemon.com...
> Please correct me if i wrong , when I first read it , it seems a callback
> alternative technique .
> Well I read in D docs that it has "delegate" if my mind is not wrong , and
> C# is using it for event handling . And we still implement an Adapter
> pattern for each event we need to handle .
> But I'm still reading the "signal and slot" from Qt again to explore more
.
>
> "mike parker" <mike@aldacron.com> wrote in message news:c8b5t4$qvu$1@digitaldaemon.com...
> > I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.
> >
> > It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).
> >
> > I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.
> >
> > So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?
>
>


May 18, 2004
Tu Nam wrote:

>Sorry I have awrong place reply . Please delete all my post in this thread
>  
>
You can do it yourself if your using a newsreader like mozilla.

-- 
-Anderson: http://badmama.com.au/~anderson/
May 18, 2004
Andrew wrote:
> In article <c8b5t4$qvu$1@digitaldaemon.com>, mike parker says...
> 
>>I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.
>>
>>It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).
>>
>>I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.
>>
>>So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?
> 
> 
> Don't know but this might be of interest to you:
> 
> http://www.digitalmars.com/dscript/index.html
> 
> It might not be exactly what you are looking for. Unfortunately, I've never used
> it so I couldn't comment on it.

Yeah I checked it out before. It's Walter's ECMA implementation. You can set it up to replace JScript for Windows scripting. But to get it into an app AFICS is no different than using other ECMA implementations, such as Rhino.
May 21, 2004
One of the more popular scripting languages for embedding is Lua (http://www.lua.org).  I have "ported" the C headers for Lua 5.0 for use from D. However, as has been stated, there's still a lot of glue code required to register functions, data structures, etc from D to Lua.

It would be really nice to aid in generating the glue code, possibly to the point of having it "integrated" by automation.

A tool called tolua exists that aids in generating the glue code required to interface C/C++ code to Lua, much like SWIG.

Distribution:
http://www.tecgraf.puc-rio.br/~celes/tolua/

Docs: http://www.tecgraf.puc-rio.br/~celes/tolua/tolua-3.2.html

A first step would be to branch/patch tolua to generate _D_ based glue code.  I am new to both D and Lua (a few months each) so I am asking for someone more experienced in either/both.

AFAIK the parser for the "cleaned" C/C++ headers passed to tolua is written itself in Lua and is simply based on a lot of regular expressions.  These regex's recognize C/C++ language features such as typedefs, functions, etc.

Once this is completed, I can think of 2 options to make this "integrated":

1) Manually create "cleaned" D sources for passing to tolua (should we call it tolua-d? :).  run tolua-d as a custom build step.  I don't like this as it's easy for the normal/cleaned versions to get out of sync.

2) Have the compiler (DMD, GDC) automatically create cleaned D code, run it through tolua-d, and add the generated D glue code to the list of D files to compile and link.  Nothing would be out of sync using this method but it does tie the scripting language to Lua... Perhaps it could be extensible via compiler plugins?

Thoughts?
Brian

In article <c8de9q$1ekm$1@digitaldaemon.com>, Mike Parker says...
>
>Andrew wrote:
>> In article <c8b5t4$qvu$1@digitaldaemon.com>, mike parker says...
>> 
>>>I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.
>>>
>>>It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).
>>>
>>>I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.
>>>
>>>So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?
>> 
>> 
>> Don't know but this might be of interest to you:
>> 
>> http://www.digitalmars.com/dscript/index.html
>> 
>> It might not be exactly what you are looking for. Unfortunately, I've never used it so I couldn't comment on it.
>
>Yeah I checked it out before. It's Walter's ECMA implementation. You can set it up to replace JScript for Windows scripting. But to get it into an app AFICS is no different than using other ECMA implementations, such as Rhino.


May 21, 2004
I don't use DIDE (yet?) but I noticed just now that it has Lua scripting built-in.  Would you care to share how you've created the D-Lua bindings for internal DIDE features?  Manually?

Thanks,
Brian

In article <c8l5lv$5qb$1@digitaldaemon.com>, Brian Hammond <d at brianhammond dot com> says...
>
>One of the more popular scripting languages for embedding is Lua (http://www.lua.org).  I have "ported" the C headers for Lua 5.0 for use from D. However, as has been stated, there's still a lot of glue code required to register functions, data structures, etc from D to Lua.
>
>It would be really nice to aid in generating the glue code, possibly to the point of having it "integrated" by automation.
>
>A tool called tolua exists that aids in generating the glue code required to interface C/C++ code to Lua, much like SWIG.
>
>Distribution:
>http://www.tecgraf.puc-rio.br/~celes/tolua/
>
>Docs: http://www.tecgraf.puc-rio.br/~celes/tolua/tolua-3.2.html
>
>A first step would be to branch/patch tolua to generate _D_ based glue code.  I am new to both D and Lua (a few months each) so I am asking for someone more experienced in either/both.
>
>AFAIK the parser for the "cleaned" C/C++ headers passed to tolua is written itself in Lua and is simply based on a lot of regular expressions.  These regex's recognize C/C++ language features such as typedefs, functions, etc.
>
>Once this is completed, I can think of 2 options to make this "integrated":
>
>1) Manually create "cleaned" D sources for passing to tolua (should we call it tolua-d? :).  run tolua-d as a custom build step.  I don't like this as it's easy for the normal/cleaned versions to get out of sync.
>
>2) Have the compiler (DMD, GDC) automatically create cleaned D code, run it through tolua-d, and add the generated D glue code to the list of D files to compile and link.  Nothing would be out of sync using this method but it does tie the scripting language to Lua... Perhaps it could be extensible via compiler plugins?
>
>Thoughts?
>Brian
>
>In article <c8de9q$1ekm$1@digitaldaemon.com>, Mike Parker says...
>>
>>Andrew wrote:
>>> In article <c8b5t4$qvu$1@digitaldaemon.com>, mike parker says...
>>> 
>>>>I'm curious if anyone has/is/might be considering implementing an integrated scripting language with D. One thing that turns me off about existing scripting languages such as Python, Ruby, Lua, Pike and friends is that there's a great deal of glue code required.
>>>>
>>>>It would be nice to see something built from the ground up to work with D, such that D objects are script objects, and vice versa. Import D modules in the script, and script modules in D. I mean, how cool is it to just link a lib, write a script and run it without worrying about typing in mundane glue code or wrestling with Swig. BeanShell and pnuts are examples of this with Java (though I never saw the need for those in Java, considering how dymanic class loading is cake).
>>>>
>>>>I've thought about taking Lua (since it's tiny compared to Python), porting it to D, and giving it the integration I want. But I know I'm not the right man for the job. My knowledge of parsers/lexers/interpreters/compilers is limited to a few pages of the Dragon book which has been collecting mounds of dust on my shelf.
>>>>
>>>>So before I get in over my head, I thought I'd check if someone more experienced than I is thinking the same thing. Anyone?
>>> 
>>> 
>>> Don't know but this might be of interest to you:
>>> 
>>> http://www.digitalmars.com/dscript/index.html
>>> 
>>> It might not be exactly what you are looking for. Unfortunately, I've never used it so I couldn't comment on it.
>>
>>Yeah I checked it out before. It's Walter's ECMA implementation. You can set it up to replace JScript for Windows scripting. But to get it into an app AFICS is no different than using other ECMA implementations, such as Rhino.
>
>


May 21, 2004
Brian Hammond <d at brianhammond dot com> wrote:

>I don't use DIDE (yet?) but I noticed just now that it has Lua scripting
>built-in.  Would you care to share how you've created the D-Lua bindings for
>internal DIDE features?  Manually?
>
>Thanks,
>Brian
>
>  
>
DIDE is programmed in C++.  Therefore there are no D-Lua bindings.  C did it the same as any other lua programmer would, using to-lua.  Leds is a D editor programmed in D.

-- 
-Anderson: http://badmama.com.au/~anderson/
« First   ‹ Prev
1 2