Git Product home page Git Product logo

dharma's Introduction

Logo

Generation-based, context-free grammar fuzzer.

Build Status IRC

Table of Contents

Run

All roads lead to Rome but Python 3.x is the prefered vehicle.

pip

pip install dharma
dharma --help

pipenv

pipenv install --dev
pipenv run dharma --help

package

python -m dharma --help

Docker

docker build -t dharma .
docker run --rm -it dharma -grammars dharma/grammars/canvas2d.dg

Examples

Generate a single test-case and print it to stdout. Multiple grammars can be appended to the -grammars argument.

dharma -grammars dharma/grammars/canvas2d.dg

Generating multiple test-cases and save the result to disk.

dharma -grammars dharma/grammars/canvas2d.dg -storage . -count 5

Generate test-cases and serve them in a template via WebSocket. Launch dharma/grammars/var/index.html in the browser after Dharma launched.

dharma -grammars dharma/grammars/canvas2d.dg -server -template grammars/var/templates/html5/default.html

Benchmark the generator.

time dharma -grammars dharma/grammars/canvas2d.dg -count 10000 > /dev/null

Development

PyLint

In case you run PyLint 1.9.2 and Python 3.7 you need to upgrade PyLint.

pip3 install pylint astroid --pre -U

Dharma Grammar Cheatsheet

Comments

%%% comment

Controls

%const% name := value

Sections

%section% := value
%section% := variable
%section% := variance

Extension Methods

Refer to extensions.py in dharma/core/ and to the xref_registry in the DharmaMachine class to add further extensions.

%range%(0-9)
%range%(0.0-9.0)
%range%(a-z)
%range%(!-~)
%range%(0x100-0x200)

%repeat%(+variable+)
%repeat%(+variable+, ", ")

%uri%(path)
%uri%(lookup_key)

%block%(path)

%choice%(foo, "bar", 1)

Assigning Values

digit :=
    %range%(0-9)

sign :=
    +
    -

value :=
    +sign+%repeat%(+digit+)

Using Values

+value+

Assigning Variables

variable :=
    @variable@ = new Foo();

Using Variables

value :=
    !variable!.bar();

Referencing values from common.dg

value :=
    attribute=+common:number+

Calling JavaScript library methods

foo :=
    Random.pick([0,1]);

API Documentation

Dharma in the Public

Dharma mentionings in the news.

dharma's People

Contributors

b1tray3r avatar ikkisoft avatar posidron avatar stjoannou avatar tysmith avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.