pierre@yc.estec.nl (Pierre Jeanne) (08/10/89)
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 Any help will be greatly appreciated. You can respond to this group or send me mail at pierre@yc.estec.nl
walker@hpl-opus.HP.COM (Rick Walker) (08/11/89)
/ 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