Newsgroups: comp.lang.c++ Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Subject: Re: repost on compiler-compilers Message-ID: <1991Apr17.195646.11429@Think.COM> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA References: <1995@umvlsi.ecs.umass.edu> Date: Wed, 17 Apr 91 19:56:46 GMT In article <1995@umvlsi.ecs.umass.edu> jog@umvlsi.ecs.umass.edu (Ashwini ) writes: >Whats the difference between yacc and Bison, I know "Bison generates C++ >compatible code" is this the parser thats produced? Yes, it's referring to the generated parser. I don't actually see any references to C++ in the Bison manual; however, it does generate ANSI C compatible code, and I strongly doubt it generates any code that depends on the few features of ANSI C that are not included in C++. > Actually I've got >very confused after reading a couple of books. Are'nt parser generators >supposed to handle any language? .ie Can I write a program in Yacc to >translate a simple English-like language to C++ code?(of course with >me supplying the routines) The parser that is generated handles the language it was designed to parse. For instance, you can use Yacc or Bison to write a Pascal compiler. The input to Yacc or Bison is a text file containing a mixture of grammar specifications and C or C++ source code that define the actions of the parser when a particular piece of the language is recognized. Yacc and Bison read this file and write a C source file. When this C file is compiled, the result is a parser that recognizes the grammar and performs the specified actions. Bison comes with a 90-page manual that includes introductory information on the concepts of parser generators. I suggest you read this for more details. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar