From: ·······@gmail.com
Subject: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <1135619667.105024.116170@g44g2000cwa.googlegroups.com>
I'm looking for source code for a lisp (or scheme) interpreter written
in Microsoft Office Visual Basic for Applications (or in another
language that I can easily translate into VBA).

I work in a restricted environment.  Part of my work requires
statistical analysis of complex data.  Right now I'm limited to what I
can do in Excel, either directly on the spreadsheet GUI or through VBA.
Unfortunately VBA isn't a very good development environment for
complex software.  Lisp (or scheme) would be much better.  My goal is
to start with an ASCII text file of source code and end with a working
lisp interpreter, using Microsoft VBA as the only bootstrap.

I'm limited to this approach because of security restrictions my
environment.  The security rules forbid importing anything except ASCII
text and Microsoft Office Documents.  All input files must be scanned
for malware.  With a very few exceptions, the Office documents must be
Macro-free.  And woe-betide anyone who gets caught in an end-run ---
especially if he's carrying a contaminated ball.

In particular, I can't import any binary executables --- including COM
objects, DLLs, and the like.  There are no tools for creating
stand-alone executables (cc, gcc, as, asm, etc) nor are there any
general-purpose programming systems (scheme, lisp, Java, Python,
stand-alone Visual Basic, etc).  The explicit goal is to prevent anyone
from importing or developing "non-standard" software that might pose a
security threat or jeopardize information assurance.

The one exception to the "no executable" rules is Microsoft Office
Visual Basic for Applications.  The rationale appears to be "This is
just a macro-language and we need it for our office automation."
Office Automation has been used extensively, so development in VBA has
not been restricted.  It's hard to bring in documents with embedded
macros, but writing your own is relatively easy.

So, that's the goal: to bootstrap a lisp environment onto VBA based
only on ASCII source code, without any compiled or binary files.   I've
looked at translating some small C-based interpreters or trying to
implement the meta-circular scheme evaluator from SICP, but I have to
do
anything like this as overhead without interfering with scheduled
delivery on the customer's intended work.

If anyone has an idea about how to do that --- without taking enough
time to interfere with customer delivery --- I'd be really interesting
in hearing about it.

From: Cameron MacKinnon
Subject: Re: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <43b06863$0$15794$14726298@news.sunsite.dk>
·······@gmail.com wrote:
> I'm looking for source code for a lisp (or scheme) interpreter written
> in Microsoft Office Visual Basic for Applications (or in another
> language that I can easily translate into VBA).
...
> So, that's the goal: to bootstrap a lisp environment onto VBA based
> only on ASCII source code, without any compiled or binary files.   I've
> looked at translating some small C-based interpreters or trying to
> implement the meta-circular scheme evaluator from SICP, but I have to
> do
> anything like this as overhead without interfering with scheduled
> delivery on the customer's intended work.

One obvious method which springs to mind is a VBA program with a static 
array of integers, each representing a byte in the executable for your 
Scheme implementation. The VBA writes the bytes out to a file, then 
executes the file. Can't do that? How about stuffing the bytes into 
memory, having the operating system mark that memory as executable, then 
calling it?

Alternatively, you could port one of the several Schemes which compile 
to C source. Add the new VBA backend, bootstrap and you've got a Scheme 
written in VBA.

Three thoughts on this whole crazy exercise, if I may. First, you're 
probably deluding yourself if you think THEY aren't going to fire your 
ass when they discover you've blatantly circumvented the spirit of their 
security policy while scrupulously obeying the letter of it. Second, 
this is a problem you're really going to have to solve yourself -- 
posting on c.l.l every six months won't get you results because Scheme 
in VBA is an itch NOBODY (save yourself) wants to scratch, IMHO. There's 
even Scheme writen in Javascript (and I think that's cool) but VBA? 
Nope. Third: Maybe you should consider a change of employer. Your 
current one seems to be limiting your productivity in ways you're not 
particularly enjoying. Rather than pitting your intelligence against 
management's, why not find management that will allow you to use all of 
your skills in service of corporate goals? Just food for thought; no 
need to reply with your reasons for remaining in hell.
From: Pascal Bourguignon
Subject: Re: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <87lky7csvh.fsf@thalassa.informatimago.com>
Cameron MacKinnon <··········@clearspot.net> writes:
> Three thoughts on this whole crazy exercise, if I may. First, you're
> probably deluding yourself if you think THEY aren't going to fire
> your ass when they discover you've blatantly circumvented the spirit
> of their security policy while scrupulously obeying the letter of
> it. Second, this is a problem you're really going to have to solve
> yourself -- 
> posting on c.l.l every six months won't get you results because Scheme
> in VBA is an itch NOBODY (save yourself) wants to scratch,
> IMHO. There's even Scheme writen in Javascript (and I think that's
> cool) but VBA? Nope. Third: Maybe you should consider a change of
> employer. Your current one seems to be limiting your productivity in
> ways you're not particularly enjoying. Rather than pitting your
> intelligence against management's, why not find management that will
> allow you to use all of your skills in service of corporate goals?
> Just food for thought; no need to reply with your reasons for
> remaining in hell.

Right.  

For the OP, an alternative which is understandable (one must pay the
bills), is to do what they want you to do at work: have a low
productivity and get rested (sleep!), and in the evenings and
week-ends you'll be creative and develop new products in Lisp as a
second job.  Eventually, you'll earn so much more with your second job
that you'll be able to resign from the first job.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Nobody can fix the economy.  Nobody can be trusted with their finger
on the button.  Nobody's perfect.  VOTE FOR NOBODY.
From: Peter Olsen
Subject: Re: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <1135716266.898383.37340@z14g2000cwz.googlegroups.com>
I agree with your assessment of VBA programming as "remaining in hell."
 Were this my primary job, I'd leave in a heartbeat.  Luckily I'm a
operations researcher/systems engineer for whom VBA (and sadly Lisp as
well) is merely the means to an end --- in this case, building models
for systems evaluation.  The modeling is fun and leads to having some
significant influence over some high-level management decisions.
Unfortunately all of the data is on restricted systems

Writing a Scheme interpreter as a set of data bytes is an interesting
idea.  Unfortunately I work in an environment were the IS security
'droids have no sense of humor.  They take the regulations literally,
so I think I'm actually OK if what I write executes completely in the
VBA environment.

As for the real security implications of letting people write their own
macros: who am I to shoot my own foot.
From: Michael Sullivan
Subject: Re: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <1h891oa.145cwq01xjwdg5N%mes@panix.com>
Peter Olsen <·······@gmail.com> wrote:

> I agree with your assessment of VBA programming as "remaining in hell."
>  Were this my primary job, I'd leave in a heartbeat.  Luckily I'm a
> operations researcher/systems engineer for whom VBA (and sadly Lisp as
> well) is merely the means to an end --- in this case, building models
> for systems evaluation.  The modeling is fun and leads to having some
> significant influence over some high-level management decisions.
> Unfortunately all of the data is on restricted systems
> 
> Writing a Scheme interpreter as a set of data bytes is an interesting
> idea.  Unfortunately I work in an environment were the IS security
> 'droids have no sense of humor.  They take the regulations literally,
> so I think I'm actually OK if what I write executes completely in the
> VBA environment.

It's surely possible to do this, but what you come up with is going to
execute *very* slowly.  And the braindeadness of VBA means that it's not
going to be trivial.  But if you can work on memory maps or something
that can be homologically equivalent (like applescript lists), you can
write a very simple lisp interpreter.  You just have to create functions
for the 7 fundamental instructions.  have a look at the postscript
article at the bottom of <http://www.paulgraham.com/rootsoflisp.html>.

Once you've got those basics, it's a bit of library work to end up with
something approaching the usefulness of a normal scheme, but it's
certainly possible.  I can't imagine why it would be worth doing other
than as an intellectual exercise, because the resulting scheme
interpreter is going to be an order of magnitude slower than VBA.  It's
going to be much worse than in something like javascript because VBA is
much slower to start, and has much less of the necessary functionality
already built-in.


Michael
From: Brian Downing
Subject: Re: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <8FXrf.677613$xm3.249473@attbi_s21>
In article <························@g44g2000cwa.googlegroups.com>,
 <·······@gmail.com> wrote:
> I'm looking for source code for a lisp (or scheme) interpreter written
> in Microsoft Office Visual Basic for Applications (or in another
> language that I can easily translate into VBA).
> 
> I work in a restricted environment.  [...]

I don't think there has been any significant developments on the
Lisp-in-VBA front since your last post in May:

http://groups.google.com/group/comp.lang.lisp/msg/d3050dd4091faba3

-bcd
-- 
*** Brian Downing <bdowning at lavos dot net> 
From: Coby Beck
Subject: Re: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <TKXrf.6657$km.954@edtnps89>
<·······@gmail.com> wrote in message 
·····························@g44g2000cwa.googlegroups.com...
> I'm looking for source code for a lisp (or scheme) interpreter written
> in Microsoft Office Visual Basic for Applications (or in another
> language that I can easily translate into VBA).
>
> I work in a restricted environment.  Part of my work requires
...
> In particular, I can't import any binary executables --- including COM
> objects, DLLs, and the like.  There are no tools for creating
> stand-alone executables (cc, gcc, as, asm, etc) nor are there any
> general-purpose programming systems (scheme, lisp, Java, Python,
> stand-alone Visual Basic, etc).  The explicit goal is to prevent anyone
> from importing or developing "non-standard" software that might pose a
> security threat or jeopardize information assurance.
>
> The one exception to the "no executable" rules is Microsoft Office
> Visual Basic for Applications.  The rationale appears to be "This is
> just a macro-language and we need it for our office automation."
> Office Automation has been used extensively, so development in VBA has
> not been restricted.  It's hard to bring in documents with embedded
> macros, but writing your own is relatively easy.

Sounds like all the things you'd have to get around to write a virus 
attacking MS Office applications.

-- 
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")
From: Peter Olsen
Subject: Re: Needed: Lisp interpreter written in Basic (or, better yet, VBA).
Date: 
Message-ID: <1135716584.918994.78610@g49g2000cwa.googlegroups.com>
Thanks for everyone's comments.  Luckily modeling in VBA is just a
small part of a generally enjoyable job as an operations
researcher/systems engineer.  Perhaps I'll write my own Scheme
interpreter as an exercise --- purely in the spirit of "That which does
not kill me makes me stronger."

Either way, thanks again.

Happy New Year 2006!