Re: Embedding a limited interpreter in a SISC Scheme application.
"Scott G. Miller" <[email protected]> Tue, 13 Mar 2007 08:18:46 -0500
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Mar 13, 2007 at 09:48:53AM -0300, Igor Hjelmstrom Vinhas Ribeiro wrote: > Hello everyone! > > I am creating one application in Scheme/SISC and I would like that the > user of the application could extend it using Scheme. However I would need the > user to have access to a limited subset of what SISC can do. > > A few closures will be available for the user. For instance: > > (buy-stock-when <stock-code> <amount> > <threshold-after-which-start-buy> <stop-loss-minimum-value>) > > (current-stock-price <stock-code>) > > > I just want users to have the full power of Scheme/SISC as one algorithm > designing language while not allowing them to wreak havoc in the system they are > using. Take a look at the implementation of Sarahbot, an IRC bot in SISC. It can be found in the contrib module of SISC's CVS, in the irc/scheme/sarah subdirectory. In particular, look at plugins/scheme.scm, which uses SISC's symbolic environments functionality to present just the Scheme R5RS environment to users of IRC channels, and removes dangerous functions. You can use this as a starting point, then add procedures you want the users to have using getprop/putprop into that environment. It does not check for memory requirements at the moment, only a rough elapsed time. You may be able to use S2J to bridge to functionality in the java.lang.management package to monitor memory or cpu time more thoroughly. Scott ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV