Anthony Cozzie Murph Finnicum Sam King University of Illinois at UrbanaChampaign Programming is hard Extreme Detail Extreme Precision Lots of Automated Tools Static Analysis Coverity ID: 489385
Download Presentation The PPT/PDF document "Macho: Programming With Man Pages" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Macho: Programming With Man Pages
Anthony Cozzie, Murph Finnicum, Sam KingUniversity of Illinois at Urbana-ChampaignSlide2
Programming is hard!
Extreme DetailExtreme PrecisionSlide3
Lots of Automated Tools
Static AnalysisCoverityCode Snippet search enginesProspector, SNIFF, Xsnippet, even GoogleAutomated DebuggersGenetic programming, Delta debuggingSlide4
Automating Programming
Computer makes decisionsBut it will make mistakes too!Programmer must go back and check the tool – not easySo, how can we do this efficiently?Slide5
Macho Architecture
NL parsing
Database
Stitching
Debugger
Raw
Text
Requested
Computation
Code Snippets
Candidate
Programs
Runtime Feedback
SolutionsSlide6
The Trick
NL parsing
Database
Stitching
DebuggerSlide7
Examples!
Example is end-to-end: covers many decisionsEasy to understand compared to codeSlide8
The Example (LS)
Print the names of files in a directory. Sort the names.Slide9
Extract Implied Computation
directory -> filesfiles -> namesprint(names)sort(names)
Print the names of files in a directory. Sort names.Slide10
Use Programmer’s Labels
public static void main(String[] args) { ....
//first (original) database
files
=
directory
.listFiles
();
....
}Slide11Slide12
Input to Synthesis: LS1
public static void Ls1(java.lang.String p_directory) {
java.io.File tmp
=
new File(
p_directory
)
;
java.io.File
[] files =
tmp.listFiles
()
;
int tmp_0 =
files.length; java.lang.String[] tmp_1 = new java.lang.String[tmp_0];
for(int tmp_3 = 0; tmp_3 < files.length; ++tmp_3) {
java.io.File tmp_2 = files[tmp_3]; java.lang.String names = tmp_2.getName();
tmp_1[tmp_3] = names; }
Arrays.sort(tmp_1)
; for(int
tmp_5 = 0; tmp_5 < tmp_1.length; ++tmp_5) { java.lang.String
tmp_4 = tmp_1[tmp_5]; System.out.println
(tmp_4)
;
}
} Slide13
Bugs!
Prints hidden filesCrashes if the input is not a directorySlide14Slide15
Synthesized Version of LS
public static void Ls3(String p_dir) { java.io.File
tmp = new File(p_dir
);
java.io.File
[] files =
tmp.listFiles
();
boolean
tmp_3 =
tmp.isDirectory
()
;
if(tmp_3) { Arrays.sort(files);
for(int tmp_1 = 0; tmp_1 < files.length; ++
tmp_1) { java.io.File tmp_0 = files[tmp_1];
java.lang.String names = tmp_0.getName();
boolean
tmp_2 = tmp_0.isHidden();
if(!tmp_2
)
System.out.println
(names
);
}
}
else
System.out.println
(
tmp
+
"");
} Slide16
Pure NL Spec
Take the path "/home/zerocool/" If the path is a file, print it. Otherwise get the list of files in the directory. Sort the
result alphabetically. Go over the result from the beginning to the
end: If
the current element's filename does not begin with ".", print it.Slide17
Macho
Print the names of files in a directory. Sort the names.
+ simple exampleSlide18
Input Synergy
NL: moderate information over a large part of the state spaceExamples: very precise information over a tiny part of the state spaceTogether: winSlide19