poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recutils, HN etc.


From: Jose E. Marchesi
Subject: Re: recutils, HN etc.
Date: Mon, 27 Jan 2020 15:56:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

[CCing poke-devel]

BTW, if you are interested in this topic... I have been playing as well
with a grammar-driven fuzzer called grammarinator.  GNU poke implements
a full-fledged programming language, and while AFL is very useful to
test the program's reaction to badly formed programs, we needed
something that would stress the compiler with grammatically-correct
programs.

So I wrote a g4 grammar for Poke.  What follows is an excerpt of poke's
HACKING file:

Grammarinator
~~~~~~~~~~~~~

*grammarinator* is a random test generator/fuzzer that creates test
cases according to an input antlr4 grammar.

In order to generate Poke programs with grammarinator, follow the
following steps.

First of all, install grammarinator::

  $ git clone https://github.com/renatahodovan/grammarinator
  $ cd grammarinator
  $ sudo python3 setup.py install

Then, use ``grammarinator-process`` in order to create the "unparser"
and "unlexer" for poke::

  $ grammarinator-process ../path/to/poke.g4

This will create two files in the current working directory:
``pokeUnlexer.py`` and ``pokeUnparser.py``.  Next step is to use
``grammarinator-generate`` in order to create tests::

  $ grammarinator-generate -l pokeUnlexer.py -p pokeUnparser.py \
                           -r program -n 100 -d 10 \
                           -t grammarinator.runtime.simple_space_transformer

The option ``-n`` specifies the number of tests (Poke programs) to
generate.

The option ``-d`` specifies the maximum recursive level.  The bigger
the recursive level, the bigger the test files will be.  If you don't
specify a maximum recursive level then grammarinator-generate will
crash.

The option ``-t grammarinator.runtime.simple_space_transformer`` makes
sure that whitespaces get inserted between literal tokens.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]