Macho: Programming With Man Pages Anthony Cozzie, Murph - - PowerPoint PPT Presentation

macho programming with man pages
SMART_READER_LITE
LIVE PREVIEW

Macho: Programming With Man Pages Anthony Cozzie, Murph - - PowerPoint PPT Presentation

Macho: Programming With Man Pages Anthony Cozzie, Murph Finnicum, Sam King University of Illinois at Urbana-Champaign Programming is hard! Lots of


slide-1
SLIDE 1

Macho: ¡ Programming ¡ With ¡Man ¡Pages ¡

Anthony ¡Cozzie, ¡Murph ¡Finnicum, ¡Sam ¡King ¡ University ¡of ¡Illinois ¡at ¡Urbana-­‑Champaign ¡

slide-2
SLIDE 2

Programming ¡is ¡hard! ¡

slide-3
SLIDE 3

Lots ¡of ¡Automated ¡Tools ¡

slide-4
SLIDE 4

AutomaGng ¡Programming ¡

slide-5
SLIDE 5

Macho ¡Architecture ¡

NL ¡parsing ¡ Database ¡ SGtching ¡ Debugger ¡ Raw ¡ Text ¡ Requested ¡ ComputaGon ¡ Code ¡Snippets ¡ Candidate ¡ Programs ¡ RunGme ¡Feedback ¡ SoluGons ¡

slide-6
SLIDE 6

The ¡Trick ¡

NL ¡parsing ¡ Database ¡ SGtching ¡ Debugger ¡

slide-7
SLIDE 7

Examples! ¡

slide-8
SLIDE 8

The ¡Example ¡(LS) ¡

Print ¡the ¡names ¡of ¡files ¡in ¡a ¡

  • directory. ¡Sort ¡the ¡names. ¡
slide-9
SLIDE 9

Extract ¡Implied ¡ComputaGon ¡

directory ¡-­‑> ¡files ¡ files ¡-­‑> ¡names ¡ print(names) ¡ sort(names) ¡ Print ¡the ¡names ¡of ¡ files ¡in ¡a ¡directory. ¡ Sort ¡names. ¡

slide-10
SLIDE 10

Use ¡Programmer’s ¡Labels ¡

public static void main(String[] args) { .... //first (original) database files = directory.listFiles(); .... }

slide-11
SLIDE 11
slide-12
SLIDE 12

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); } }

slide-13
SLIDE 13

Bugs! ¡

slide-14
SLIDE 14
slide-15
SLIDE 15

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 + ""); }

slide-16
SLIDE 16

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

  • ver the result from the beginning to

the end: If the current element's filename does not begin with ".", print it.

slide-17
SLIDE 17

Macho ¡

Print the names of files in a

  • directory. Sort the names.

+ simple example

slide-18
SLIDE 18

Input ¡Synergy ¡

slide-19
SLIDE 19