Fast-code emitter

Guided Program Synthesis-, Probabilistic Program Models-, Syntax-guided synthesis, etc. are gaining in popularity

Perhaps we could implement a fast-code emitter, when supplied input-output examples in JSON

Example

/*
    Provided Input, Output pairs
    "1/17/16-1/18/17", "1/17/16"
    "1/17/16-1/18/17", "1/18/17"
    "01/17/2016-01/18/2017", "01/17/2016"
    "01/17/2016-01/18/2017", "01/18/2017"
*/
let ProvidedInputOutputPairs = [
    [ // training set #1
        { 
            input : { date : ["1/17/16","1/18/17"] }, 
            output : { date : ["1/17/16"] },
        },
        { 
            input : { date : ["1/17/16","1/18/17"] }, 
            output : { date : ["1/18/17"] },
        },
    ],
    [ // training set #2
        { 
            input : { date : ["01/17/2016","01/18/2017"] }, 
            output : { date : ["01/17/2016"] },
        },
        { 
            input : { date : ["01/17/2016","01/18/2017"] }, 
            output : { date : ["01/18/2017"] },
        },
    ]
]

let res = Fast( ProvidedInputOutputPairs ) 

/*

    res = 
    `  
        // EXTERN: input, output   
        // let protoA = input.date
        // let protoB = null
        
        protoB==null ? protoA[0] : protoA[1] ;
            
        output.date[0] = protoB
    `
*/ 

This is not something that belongs in the spec. Maybe a userland library, but not the spec.

1 Like