macho: programming with man pages anthony cozzie, murph finnicum, sam king university of illinois at...
TRANSCRIPT
![Page 1: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/1.jpg)
Macho: Programming
With Man Pages
Anthony Cozzie, Murph Finnicum, Sam KingUniversity of Illinois at Urbana-Champaign
![Page 2: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/2.jpg)
Programming is hard!
• Extreme Detail• Extreme Precision
![Page 3: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/3.jpg)
Lots of Automated Tools
• Static Analysis– Coverity
• Code Snippet search engines– Prospector, SNIFF, Xsnippet, even Google
• Automated Debuggers– Genetic programming, Delta debugging
![Page 4: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/4.jpg)
Automating Programming
• Computer makes decisions• But it will make mistakes too!• Programmer must go back and check the tool
– not easy• So, how can we do this efficiently?
![Page 5: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/5.jpg)
Macho Architecture
NL parsing Database Stitching Debugger
RawText
RequestedComputation Code Snippets
CandidatePrograms
Runtime Feedback
Solutions
![Page 6: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/6.jpg)
The Trick
NL parsing Database Stitching Debugger
![Page 7: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/7.jpg)
Examples!
• Example is end-to-end: covers many decisions• Easy to understand compared to code
![Page 8: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/8.jpg)
The Example (LS)
Print the names of files in a directory. Sort the names.
![Page 9: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/9.jpg)
Extract Implied Computation
directory -> filesfiles -> namesprint(names)sort(names)
Print the names of files in a directory. Sort names.
![Page 10: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/10.jpg)
Use Programmer’s Labels
public static void main(String[] args) {
....
//first (original) database files = directory.listFiles();
....}
![Page 11: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/11.jpg)
![Page 12: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/12.jpg)
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); } }
![Page 13: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/13.jpg)
Bugs!
• Prints hidden files• Crashes if the input is not a directory
![Page 14: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/14.jpg)
![Page 15: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/15.jpg)
Synthesized Version of LSpublic 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 + ""); }
![Page 16: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/16.jpg)
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.
![Page 17: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/17.jpg)
Macho
Print the names of files in a directory. Sort the names.
+ simple example
![Page 18: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/18.jpg)
Input Synergy
• NL: moderate information over a large part of the state space
• Examples: very precise information over a tiny part of the state space
• Together: win
![Page 19: Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign](https://reader035.vdocument.in/reader035/viewer/2022062715/56649d995503460f94a83ade/html5/thumbnails/19.jpg)