Re: YACC, going the other way

carlton@aldebaran.Berkeley.EDU (Mike Carlton)
Tue, 23 Apr 91 20:38:41 PDT

          From comp.compilers

Related articles
YACC, going the other way elk@cblpn.att.com (1991-04-15)
Re: YACC, going the other way zeil@cs.odu.edu (1991-04-23)
Re: YACC, going the other way carlton@aldebaran.Berkeley.EDU (1991-04-23)
Re: YACC, going the other way wunder@hpsdel.sde.hp.com (Walter Underwood) (1991-04-24)
Re: YACC, going the other way zvr@ntua.gr (1991-04-25)
Re: YACC, going the other way jimad@microsoft.UUCP (1991-04-26)
Re: YACC, going the other way ressler@cs.cornell.edu (1991-05-01)
| List of all articles for this month |

Newsgroups: comp.compilers
From: carlton@aldebaran.Berkeley.EDU (Mike Carlton)
In-Reply-To: <1991Apr23.163353.28709@cs.odu.edu>
Keywords: yacc, testing, prolog
Organization: Compilers Central
References: <1991Apr23.140427.5416@iecc.cambridge.ma.us>
Date: Tue, 23 Apr 91 20:38:41 PDT

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
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.