#
• • • • • • • • •
∈
Camera camera = Camera.open(); Camera camera = Camera.open(); camera.setDisplayOrientation(90); camera.setDisplayOrientation(90); camera.unlock(); SurfaceHolder holder = getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.STP); MediaRecorder r = new MediaRecorder(); r.setCamera(camera); r.setAudioSource(MediaRecorder.AS); r.setVideoSource(MediaRecorder.VS); r.setOutFormat(MediaRecorder.MPEG4);
C# Java System.out.println("Hi"); Console.WriteLine("Hi") … …
function chunkData(str, step) { var colNames = []; function FZ(e, t) { var n = []; var len = str.length; var r = e.length; var i = 0; var i = 0; for (; i < r; i += t) if (i + t < for (; i < len; i += step) r) n.push(e.substring(i, i + if (i + step < len) t)); else colNames.push(str.substring(i, i + step)); n.push(e.substring(i, r)); else return n; colNames.push(str.substring(i, len)); } return colNames; }
JSNice: over a year of usage May 2015 – May 2016
function chunkData(e, t) function chunkData(str, step) var n = []; var colNames = []; var r = e.length; var len = str.length; var i = 0; var i = 0; for (; i < r; i += t) for (; i < len; i += step) if (i + t < r) if (i + step < len) n.push(e.substring(i, i + t)); colNames.push(str.substring(i, i + step)); else else n.push(e.substring(i, r)); colNames.push(str.substring(i, len)); return n; return colNames;
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n; t r i … length … t i length r
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n; t r i i t w … i step 0.5 t length j step 0.4 … length i r t i r w r length w i i len 0.6 length length 0.5 length r i length 0.3 len length 0.3
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n; t r i 𝒙 𝑈 𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑢ℎ) i t w … i step 0.5 t length j step 0.4 … length i r t i r w r length w i i len 0.6 length length 0.5 length r i length 0.3 len length 0.3
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n; t r i 𝒙 𝑈 𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑢ℎ) i t w … t i step 0.5 step length j step 0.4 … i r length i len t i r w r length w i i len 0.6 length length 0.5 length r i length 0.3 len length 0.3
function chunkData(e, t) function chunkData(str, step) var n = []; var colNames = []; var r = e.length; var len = str.length; var i = 0; var i = 0; for (; i < r; i += t) for (; i < len; i += step) if (i + t < r) if (i + step < len) n.push(e.substring(i, i + t)); colNames.push(str.substring(i, i + step)); else else n.push(e.substring(i, r)); colNames.push(str.substring(i, len)); return n; return colNames; t r i 𝒙 𝑈 𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑢ℎ) i t w … t i step 0.5 step length j step 0.4 … i r length i len t i r w r length w i i len 0.6 length length 0.5 length r i length 0.3 len length 0.3
1 𝑎(𝑦) exp(𝒙 𝑈 𝒈(𝑧, 𝑦) ) 𝑄 𝑧 𝑦 = 𝒙 𝑈 ∀j ∀ y Σ 𝑥 i f i ( x (j) , y (j) ) ≥ Σ 𝑥 i f i ( x (j) ,y ) + 𝚬 ( y,y (j) ) 𝑎(𝑦)
var n = []; var colNames = []; var r = e.length; var len = str.length; var i = 0; var i = 0; for (; i < r; i += t) for (; i < len; i += step) if (i + t < r) if (i + step < len) n.push(e.subs(i, i + t)); colNames.push(str.subs(i, i + step)); else else n.push(e.subs(i, r)); colNames.push(str.subs(i, len)); return n; return colNames; 150MB 𝑄 𝑧 𝑦 …
package com.example.dbhelper class DBHelper extends package a.b.c SQLiteHelper { class a extends SQLiteHelper SQLiteDatabase db; { SQLiteDatabase b; public public DBHelper(Context ctx) { a(Context ctx) { b = db = getWritableDatabase(); getWritableDatabase(); } } Cursor c(String str) { return b.rawQuery(str); }} Cursor execSQL(String str) { return db.rawQuery(str); } }
Fundamental Problem
D f.open (“f2” | “r”); f.read(); f.open (“file” | “r”); f.open (“f2” | “w”); f. ? f.write (“c”); f.open (“f1” | “r”); f.read();
D f.open (“f2” | “r”); f.read(); f.open (“file” | “r”); f.open (“f2” | “w”); f. ? f.write (“c”); f.open (“f1” | “r”); f.read(); P( open | f. ) ~ 3/6 P( read | f. ) ~ 2/6 P( write | f. ) ~ 1/6 𝜹
D f.open (“f2” | “r”); f.read(); f.open (“file” | “r”); f.open (“f2” | “w”); f. open f.write (“c”); f.open (“f1” | “r”); f.read(); P( open | f. ) ~ 3/6 P( read | f. ) ~ 2/6 P( write | f. ) ~ 1/6 𝜹
P( read | open ) ~ 2/3 P( write | open ) ~ 1/3 D 𝜹 f.open (“f2” | “r”); f.read(); f.open (“file” | “r”); f.open (“f2” | “w”); f. ? f.write (“c”); f.open (“f1” | “r”); f.read(); P( open | f. ) ~ 3/6 P( read | f. ) ~ 2/6 P( write | f. ) ~ 1/6 𝜹
P( read | open ) ~ 2/3 P( write | open ) ~ 1/3 D 𝜹 f.open (“f2” | “r”); f.read(); f.open (“file” | “r”); f.open (“f2” | “w”); f. read f.write (“c”); f.open (“f1” | “r”); f.read(); P( open | f. ) ~ 3/6 P( read | f. ) ~ 2/6 P( write | f. ) ~ 1/6 𝜹
P( read | open ) ~ 2/3 P( write | open ) ~ 1/3 D 𝜹 f.open (“f2” | “r”); f.read(); f.open (“file” | “r”); f.open (“f2” | “w”); f. ? f.write (“c”); f.open (“f1” | “r”); f.read(); P( open | f. ) ~ 3/6 P( read | f. ) ~ 2/6 P( write | f. ) ~ 1/6 𝜹
→ 𝜹 key idea: synthesize a function f:
f best = argmin cost( D , f ) f best ∊ D f ∊ ( ) f best f best 𝜹
elem.notify({ CallExpression position: ‘top’, autoHide: false, MemberExpression ObjectExpression delay: 100 }); Identifier Property Property Property Property elem notify position autoHide delay String Boolean ‘ top’ false
TCond ::= 𝜁 | WriteOp TCond | MoveOp TCond MoveOp ::= Up, Left, Right, DownFirst, DownLast, NextDFS, PrevDFS, NextLeaf, PrevLeaf,PrevNodeType, PrevNodeValue, PrevNodeContext WriteOp ::= WriteValue, WriteType, WritePos Up Left WriteValue 𝜹 ← 𝜹 ∙
f best f best = argmin cost( D , f ) f ∊
f best f D TCond ::= 𝜁 | WriteOp TCond | MoveOp TCond MoveOp ::= Up, Left, Right, ... WriteOp ::= WriteValue, WriteType, ... ≈ 10 8 f best = argmin cost( D , f ) f ∊ P D f P(element | f ( )) cost( D , f) = ( P ) 𝑃( 𝐸 )
f best to predict program f best 𝜹 Left {} elem.notify( ... , WriteValue {hide} ... , Up {hide} { WritePos {hide, 3} position: ‘top’, Up {hide, 3} hide: false, DownFirst {hide, 3} ? DownLast {hide, 3} } WriteValue {hide, 3, notify} );
D : f best 22.2% 30.4% 66.6%
D : f best Hutter Prize Wikipedia Dataset uses a char-level DSL with state : 1.94 1.67 1.62 1.60 51% 1.44 51% 1.40 51%
VarPtsTo (“global” , h ) checkIfInsideMethodCall function isBig(v) { checkMethodCallName return v < this .length checkReceiverType } checkNumberOfArguments ... [12, 5].filter(isBig); VarPtsTo( this, h )
• • •
∈ TCond ::= 𝜁 | WriteOp TCond | MoveOp TCond MoveOp ::= Up, Left, Right, DownFirst, DownLast, NextDFS, PrevDFS, NextLeaf, PrevLeaf, PrevNodeType, PrevNodeValue, WriteOp ::= WriteValue, WriteType, WritePos f best = argmin cost( D , f ) f best ∊ f ∊ f best ( ) f best 𝜹
Recommend
More recommend