Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!world!iecc!compilers-sender From: carlton@aldebaran.Berkeley.EDU (Mike Carlton) Newsgroups: comp.compilers Subject: Re: YACC, going the other way Keywords: yacc, testing, prolog Message-ID: <9104240338.AA01486@aldebaran.Berkeley.EDU> Date: 24 Apr 91 03:38:41 GMT References: <1991Apr23.140427.5416@iecc.cambridge.ma.us> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: carlton@aldebaran.Berkeley.EDU (Mike Carlton) Organization: Compilers Central Lines: 28 Approved: compilers@iecc.cambridge.ma.us In-Reply-To: <1991Apr23.163353.28709@cs.odu.edu> In article <1991Apr23.140427.5416@iecc.cambridge.ma.us> elk@cblpn.att.com (Edwin Lewis King +1 614 860 3394) writes: >I'm interesting in generating strings that are described by a BNF (OK, >YACC) grammar. How proficient are you in Prolog? Prolog is a very nice environment to do this sort of thing. I recently took a bnf specification (written in prolog) of an intermediate language an modified it to be a generator for the same language. The specification was an executable program which succeeded iff the input was in the language given by the bnf. It was a simple matter to replace a few low level test rules such as register(r(I)) :- integer(I). with generators such as register(r(0)). register(r(1)). With a suitable set of generators, I was able to generate all interesting intermediate language statements and then run the output through the backend for testing. cheers, --mike -- Mike Carlton carlton@cs.berkeley.edu -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.