Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decvax.UUCP Path: utzoo!linus!decvax!borman From: borman@decvax.UUCP (Dave Borman) Newsgroups: net.lang Subject: Re: Self-modifying code Message-ID: <324@decvax.UUCP> Date: Wed, 4-Jan-84 12:10:44 EST Article-I.D.: decvax.324 Posted: Wed Jan 4 12:10:44 1984 Date-Received: Thu, 5-Jan-84 01:18:30 EST References: <2157@fortune.UUCP> Organization: DEC UNIX Engineering Group Lines: 16 Several years ago (~1979/1980) at St. Olaf College (it's in Minnesota, stolaf on the net) a plotting package was written in C, to run under V7 on a PDP 11/70. One question was how to allow the user to input functions to be plotted, and how to evauluate them. What was decided upon was to write a function compiler, so that at run time the functions could be broken down into assembly and then executed. The machine instructions were put into an integer array, and then the array was cast into a function pointer and called for each point at which a value was needed. The compiler handled all normal arithmetic operations, plus summations, products, conditionals, constants, and references to other functions, both user defined and from an internal library. The only drawback to this scheme is that since the code is being generated in data space, in order to execute it you can't have compiled the program split I/D. The author of this function compiler is Steve Tarr. -Dave Borman, decvax!borman