www.digitalmars.com         C & C++   DMDScript  

DMDScript - Implementation


I spent most of the week's going through the DMDScript interpreter looking for
ways to simplify and/or improve the existing 1.06 implementation.  To Walter's
credit, the text implementation is absolutely gorgeous - I ndisasm'd it and I
couldn't do better in x86 assembler for allocation, length, and organization.
It's brilliantly done.  

I went and wrote some quick inline "rep movsd"/"repe cmpsd" assembler routine
and version(Dinline_assembler?) called it instead of strcpy/strcmp.  That made
strcpy's about 80% faster, and strcmp's about 60%.  (the sieve program only runs
about 1% faster)  Believe it or not, the last 3 bytes cost about as much as
running 60 bytes of text, so if we padded all of the strings to 4 bytes the
algorithms could be made quite a bit faster.  This *might* also help with the
lexer if I find and dig up how.

All in all, I'll think I'll probably have to eat my words and admit I probably
can't squeeze as much out of DMDScript as I thought I could.  Walter's done a
brilliant job.  :p

I'll also have to admit I haven't done anything about the command line bugs that
were mentioned.  :o  I did throw in a Global_cmd(), and I'm starting to think
that cmd()/print()/readln() etc should be thrown into a new static Object.  I
tried writing one and shadow'd the Math object almost exactly and the stupid
thing wouldn't compile (it wouldn't recognize symbols that were clearly declared
and imported?  I don't know much about D.) 

Wrapping it up in one Object would have the added benefit of making it really
easy to identify what is being introduced above and beyond ECMAScript spec.
Would such a beast be called "Command", "Prompt", "Stdio", "System" or some

I also tried learning more about piping text in Windows.  ex:

C:> ds bob.ds < "Hello world.  This is piped text"
user mylocalhost# ds bob.ds ...

Also, because my site uses AJAX, and Internet Explorer seems to bugger up
whenever you use XMLHttpRequest on a different domain (even a different
subdomain!?!?) I moved it to http://murpsoft.com/ under studio.  I'm still
experimenting with how to get the AJAX working properly so that's a reliable way
to get to the page.  :p  Sorry.
Nov 11 2005