Path: utzoo!utgpu!cs.utexas.edu!wuarchive!uunet!stanford.edu!agate!agate!hughes From: hughes@bigbang.Berkeley.EDU (Eric Hughes) Newsgroups: alt.hackers Subject: Re: credit 'fixing' Message-ID: Date: 9 Mar 91 05:50:27 GMT References: <1991Feb21.154633.20781@bronze.ucs.indiana.edu> Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: ucb Lines: 44 Approved: BIFF In-Reply-To: jkonrath@silver.ucs.indiana.edu's message of 21 Feb 91 15:46:33 GMT In article <1991Feb21.154633.20781@bronze.ucs.indiana.edu> jkonrath@silver.ucs.indiana.edu (jon) said something like: The "lack of knowledge around me" wrote: IF top = 8 THEN top = 0 ELSE INC(top) END; where i just did top := (top+1)MOD8 ==endquote== Now wait! The first code will (on most compilers) execute much faster, since there's no division instruction generated. Put this fragment inside a loop, and you've got a significant performance difference. Hack: a favorite C statement (conditional assignment) *( bool ? &x : &y ) = t ; I have broken two C compilers with this expression. Hack: For my work, I am currently converting an interpreter, which takes a custom semi-text input format, and which is written in 8088 assembly, to a compiler/inner-interpreter pair. Fine. But we have a design constraint that all the existing high-level code has to continue to run while the engines are being worked on. Ick. Solution: A custom language, with a compiler written in AWK, which specifies the exchange language between the compiler and the i-interpreter. It allows the generation of text statements for those verbs which are unconverted, and for postfix expressions for those which are. Now I can convert a keyword at a time, switch its output syntax, reimplement the keyword in C, and the user is none the wiser. Eventually all this scaffolding for conversion will be thrown out when a full postfix conversion is completed. Neat. Particular gratitude to Jon Bentley, who inspired this approach. Eric Hughes P.O. 4789 Berkeley, CA 94704