CSE411

CSE411: Introduction to Compilers

Program Synthesis

Jooyong Yi (UNIST)

2023 Spring
CSE411

20% Rule

2023 Spring
CSE411

Synthesizing a Lexer

           regular expression
                    ↓
             |-------------|    
             |    Lexer    |        
             | Synthesizer |
             |-------------|
                    |
               synthesizes   
                    ↓
                |-------|            
int val = 10; → | Lexer | → int ID ASSIGN NUM ;
                |-------|                          
2023 Spring
CSE411

Synthesizing a Program

              specification
                    ↓
             |-------------|    
             |   Program   |        
             | Synthesizer |
             |-------------|
                    |
               synthesizes   
                    ↓
               |---------|            
               | Program |
               |---------|                          
2023 Spring
CSE411

Concrete Example of Program Synthesis

  • Excel Flash Fill

2023 Spring
CSE411

Under the Hood of Flash Fill

Running Example

2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Under the Hood of Flash Fill (Step 1)

Use a Domain-specific language (DSL) to limit the synthesis space.

2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Under the Hood of Flash Fill (Step 2)

Sub-problems

  • When , how to define and ?
2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Under the Hood of Flash Fill (Step 3)

Inverse Semantic Operator

  • When , how to define and ?
  • We can define the semantics of and .
2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Under the Hood of Flash Fill (Step 4)

2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Under the Hood of Flash Fill (Step 5)

Use VSA (Version Space Algebra) for compact representation.

2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Version Space Algebra

Syntax

Semantics

2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Under the Hood of Flash Fill (Step 6)

The second IO example:

2023 Spring (adapted from the slides of Woosuk Lee)
CSE411

Under the Hood of Flash Fill (Step 7)

Intersection of VSAs

2023 Spring (adapted from the slides of Woosuk Lee)