Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!vtserf!creatures!csgrad!lavinus From: lavinus@csgrad.cs.vt.edu Newsgroups: comp.lang.misc Subject: Re: The search for heterogeneous lists is still on! Message-ID: <1076@creatures.cs.vt.edu> Date: 1 Apr 91 18:18:16 GMT Article-I.D.: creature.1076 References: <167:Mar3121:32:0891@kramden.acf.nyu.edu> Sender: usenet@creatures.cs.vt.edu Reply-To: lavinus@csgrad.cs.vt.edu () Organization: Virginia Tech Computer Science, Blacksburg, VA Lines: 25 Hi out there! I make no claims as to how good this example is, nor whether I might have done this in a better way using something other than heterogeneous collections, but here is a 'real' example: I recently wrote a shift-reduce parser in Lisp, to parse infix mathematical expressions. The stack for the actual parser contains both token (terminal) descriptions, representations of nonterminals, and integers representing the state of the underlying FSM in the parser. Additionally, for the code generation portion, there is a "semantic stack" which stores the types of variables (for variables), values of various types of constants, and mathematical operators (+, -, etc.). The only easy way I can see to do this complete system in C or whatever is to either break it up into about five different stacks, or to keep a stack of pointers of type void. Like I say, this may not be a great example, but it does exist as an example of a heterogeneous collection in action. Flames graciously accepted :-). Joe -- _________________________________ \ ___________________________________ Joseph W. Lavinus, Virginia Tech \ email: lavinus@csgrad.cs.vt.edu 1204-A University Terrace /\ phone: (703) 552-0241 Blacksburg, VA 24060 / \ (703) 231-5853