RFC: generator_generator 1.01

From: David Coppit (newspost_at_coppit.org)
Date: 10/31/04


Date: 30 Oct 2004 21:54:28 EDT

Hello everyone,

I'm seeking comments about a script I'll be releasing on CPAN soon. You
can think of it as YACC for generators instead of parsers.

   generator_generator - given a grammar, generates a C++ string generator

   generate_generator generates a C++ program that generates all strings of
   the format specified by the input grammar. The resulting generator
   generates strings of the user-specified length. The input file format is
   very similar to the normal YACC and LEX input files. This program is
   designed to create a fast program for computing the "exhaustive initial
   segment" of inputs for testing of another program.

I've tried very hard to make it easy to use, but it's still fragile due to
the complexity and system-dependent nature of it. I hope to test on a
wider set of platforms to make it more robust. You can get it here if you
want to take a look:

http://www.coppit.org/temp/generator_generator-1.01.tar.gz

The TODO file contains the beginnings of a tutorial, which I need to
write. I also need to update the documentation. I'll finish all that
before releasing the script publicly. If you want to try it out
out-of-the-box (after running "perl Makefile.PL"):

   ./generator_generator -fm -u in*tree grammars/f*.yg grammars/f*.lg
   ./output/progs/generate 12

to generate fault trees of length 13, and:

   ./generator_generator -fm -u in*ion grammars/l*.yg grammars/l*.lg
   ./output/progs/generate 4

to generate logical expressions of length 8.

I need comments on the following:

- I really don't like the name. Anyone have a better one?
- I'm not really sure how to explain it succinctly. The above blurb is
   quite bad. Can anyone suggest a better description?
- I need to install templates and other non-module code on the system.
   Should I use the generator_generator:: namespace? (Anyone know how to do
   installation of non-module files with Module::Install?)
- Is it best to write the tutorial up in POD, and embed it in an otherwise
   empty module? (I think Inline does this.)
- I need to distribute some example files. Is there a standard directory
   like "eg" or "ex"? If I choose "examples" will that break anything?
- Should I install examle files on the system?

If you happen to try it out, please let me know.

Regards,
David



Relevant Pages

  • In search of grammars for parsing
    ... I'm writing a code generator that needs to parse a YACC-like input file ... I figured I would start with existing YACC and LEX grammars, ...
    (comp.lang.perl.misc)
  • Re: prolog with yacc/bison
    ... Hans Aberg wrote: ... >>i need to find input file for yacc. ... >>input file for Yacc for Prolog? ...
    (comp.lang.prolog)
  • Re: Lex/Yacc and multiple input files
    ... I am using lex and yacc to write a vhdl to systemc converter. ... Lex simply reads the input file and yacc implements grammar and ... If you use flex, you can read the man page for flex and search for the section named MULTIPLE INPUT BUFFERS. ...
    (comp.lang.c)
  • Re: "Faster" I/O in a script
    ... script is fairly simple. ... It reads a line form the input file, ... whole reading file is processed then the ... Sounds like perhaps generators would help. ...
    (comp.lang.python)
  • prolog with yacc/bison
    ... i need to find input file for yacc. ... input file for Yacc for Prolog? ... It's really urgent, so please answer me ...
    (comp.lang.prolog)