Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!bloom-beacon.mit.edu!news.tamu.edu!news.utdallas.edu!corpgate!bcarh189.bnr.ca!nott!cunews!dbuck
From: dbuck@superior.carleton.ca (Dave Buck)
Subject: Re: Compilation vs Interpretation
X-Nntp-Posting-Host: superior.carleton.ca
Message-ID: <D7KGvF.A8q@cunews.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Organization: Carleton University, Ottawa, Canada
References: <3n9a2m$cu4@atglab10.atglab.bls.com> <3nh9bp$dm2@overload.lbl.gov>
Date: Tue, 25 Apr 1995 01:16:27 GMT
Lines: 31

In article <3nh9bp$dm2@overload.lbl.gov>,
Manfred D. Zorn <MDZorn@lbl.gov> wrote:
>I am having a similar problem and I chose to implement your option 3.
>
>My problem: I want to read conditions while the application is running and test these
>conditions subsequently. 
>My solution: I devised a limited set of expressions that allow a user to specify the conditions.
>The expressions are parsed and generate string that is evaluated by the Compiler. This way
>if someone writes 'self halt' it will not pass the interpretation and raise an error. By keeping it
>as an evaluated string rather than a compiled method, I have the compilation step to check
>for non-sense alterations of the code and do not blindly execute code from the data space.

One problem with this is that most dialects of Smalltalk remove the
compiler from packaged applications.  This makes it very difficult to
deploy your application.

If what you want is a simple expression evaluation (i.e., unary,
binary, and keyword messages with parentheses and a handful of simple
literals), it's relatively easy to write a recursive descent parser to
create a parse tree that can then be evaluated.  I wrote such a parser
in one evening recently.  If you need blocks, loops, conditionals,
etc, then things get more complicated.

David Buck
dbuck@ccs.carleton.ca

_________________________________
| David K. Buck                 |
| dbuck@ccs.carleton.ca         |
| The Object People             |
|_______________________________|
