820 likes | 948 Views
Keyword Programming in Java. Greg Little and Robert C. Miller MIT CSAIL This work was supported in part by the National Science Foundation under award number IIS-0447800, and by Quanta Computer as part of the TParty project. Keyword Programming. Problem. src. array. cursor.
E N D
Keyword Programming in Java Greg Little and Robert C. Miller MIT CSAIL This work was supported in part by the National Science Foundation under award number IIS-0447800, and by Quanta Computer as part of the TParty project.
Problem src array cursor read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
AutoComplete read a line from src, and add it to array
Keyword Programming read a line from src, and add it to array
Keyword Programming read a line from src, and add it to array
Keyword Programming read a line from src, and add it to array
Keyword Programming read a line from src, and add it to array
Keyword Programming read a line from src, and add it to array
Related Work • AutoComplete • syntactically valid prefix • Jungloids[Mandelin et al PLDI ’05] • XSnippet[Sahavechaphan et al OOPSLA ’06] • input and output types • Keyword Programming • keywords from expression
Overview • Algorithm • Evaluation
Algorithm array.add(src.readLine());
Algorithm array.add(src.readLine); array readLine src
Algorithm array.add(src.readLine); array readLine src List<String> String BufferedReader
Algorithm boolean add List<String>, String List<String> array String readLine BufferedReader BufferedReader src
Algorithm boolean add List<String>, String List<String> array Function String readLine BufferedReader BufferedReader src
Algorithm Function Database Dynamic Program Extract Tree
Function Database List<String> array
Function Database boolean add List<String>, String List<String> array
Function Database boolean add List<String>, String List<String> array BufferedReader src
List Functions boolean add List<String>, String List<String> array String readLine BufferedReader BufferedReader src
Function Database boolean add List<String>, String List<String> array String String readLine new String BufferedReader BufferedReader src
Score Functions boolean add List<String>, String List<String> array String String new String readLine BufferedReader BufferedReader src
Score Functions boolean add List<String>, String List<String> array String String new String readLine BufferedReader add line BufferedReader src
Score Functions boolean add List<String>, String List<String> array 1 String String new String readLine BufferedReader add line BufferedReader src
Score Functions boolean add List<String>, String List<String> array 1 1 String String readLine new String BufferedReader add line BufferedReader src
Dynamic Program boolean add List<String>, String List<String> array List<String> boolean BufferedReader String array add src readLine 1 2 1 1 1 1 1 1 1 1 1 1 String String List<String>, String BufferedReader new String readLine BufferedReader List<String> boolean BufferedReader String array add src readLine List<String>, String BufferedReader BufferedReader List<String> boolean BufferedReader String src array ? add src new String List<String>, String
Extract Tree List<String> boolean BufferedReader String array add src readLine 2 1 List<String>, String BufferedReader List<String> boolean BufferedReader String array add src readLine List<String>, String BufferedReader List<String> BufferedReader String array src new String
Extract Tree List<String> boolean BufferedReader String array add src readLine 2 1 List<String>, String BufferedReader List<String> boolean BufferedReader String array add src readLine List<String>, String BufferedReader List<String> BufferedReader String array src new String
Extract Tree List<String> boolean BufferedReader String array add src readLine 2 1 List<String>, String BufferedReader List<String> boolean BufferedReader String array add src readLine BufferedReader List<String>, String List<String> BufferedReader String array src new String
Extract Tree List<String> boolean BufferedReader String array add src readLine 2 1 List<String>, String BufferedReader List<String> boolean BufferedReader String array add src readLine BufferedReader List<String>, String List<String> BufferedReader String array src new String
Extract Tree boolean add List<String>, String List<String> String array readLine BufferedReader BufferedReader src
Render as Java array.add(src.readLine()) boolean add List<String>, String List<String> String array readLine BufferedReader BufferedReader src
More Complex .Math.max(x, y).......... Keep best n functions per box 3 .Math.max(x, x).......... max x y . Discourage double counting
Evaluation Artificial Corpus sense of speed in real projects sense of accuracy in wide variety of contexts User Study sense of accuracy on real inputs sense for how real inputs look
Artificial Corpus multiple open source repositories Popular Could Compile
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name)
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbol newSymbol getRuntime name
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbolnewSymbolgetRuntime name Ruby Symbol new Symbol get Runtime name
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbolnewSymbolgetRuntime name Ruby Symbol new Symbol get Runtime name ruby symbol new symbol get runtime name
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbolnewSymbolgetRuntime name Ruby Symbol new Symbol get Runtime name ruby symbol new symbol get runtime name name runtime get symbol symbol ruby new