Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!network!sdcsvax!ucsdhub!hp-sdd!hplabs!hpl-opus!walker From: walker@hpl-opus.HP.COM (Rick Walker) Newsgroups: comp.sources.wanted Subject: Re: Interpreter using lex and yacc Message-ID: <63140007@hpl-opus.HP.COM> Date: 11 Aug 89 03:05:59 GMT References: <1034@esatst.yc.estec.nl> Organization: HP Labs, High Speed Electronics Dept., Palo Alto, CA Lines: 19 / hpl-opus:comp.sources.wanted / pierre@yc.estec.nl (Pierre Jeanne) / > In the coming weeks we are going to use yacc (and lex) to build an > interpreter. If someone, somewhere has written an interpreter for > structured language using lex and yacc (possibly even a C interpreter) > and if we could get such an example, it would help speed our project Try looking at the 'hoc' interpreter in "The UNIX programming environment" by Kernighan and Pike, Prentice-Hall, or the simple C compiler in "Introduction to compiler construction with UNIX" by Axel T. Schreiner and H. George Friedman, Jr, also Prentice-Hall. The hoc interpreter uses yacc and actually builds an internal stack based machine to execute. It handles if(), else(), while()... etc. The compiler in Schreiner and Friedman emits readable code which is executed by a second stack based virtual-machine. This book does a good job of covering the interface between lex and yacc. ---------- Rick Walker