Skip to content

Internal specifications capable to synthetically create Java code (for testing/fuzzing) #3

@edefazio

Description

@edefazio

Each _node type needs to have enough detail in their feature specification to be able to synthesize "random" syntactically correct instances... (we arent worried about uniformly distributed)
for example I should be able to do something like this:

//build & return a new if statement 
_ifStmt _i = Synthesizer.of(_ifStmt.class, seed);

//some example synthesized ifs might be:

//1) an if statement with no curlys (& single statement)
    if(true) System.out.println(1);

//2) an if statement with a body:
   if(call()){
       assert(1==1);
       return 3;
   }
//3) an if statement with else
   if( a & b ){
        return j;
   }else{
        return k;
   }
...etc. etc.

(Or to put it plainly, the specification needs to be rigid enough that I can "iterate" over each feature and synthesize a value that can be combined into syntactically correct instances that can be converted into Java code.)

code synthesis is both a "test" of the specification, to ensure that the interdependencies between elements are modeled, and a way of testing/fuzzing the parsers.

(the synthesized code may not compile, but should be parseable)

the actual implementation of the Synthesier is more about refining the specification than it really is about the synthesis of code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions