SlideShare uma empresa Scribd logo
1 de 51
Variability-Aware Parsing
                            in the Presence of
   Lexical Macros and Conditional Compilation




                                                 Christian Kästner
                                                 Paolo G. Giarrusso
                                                 Tillmann Rendel
                                                 Sebastian Erdweg
                                                 Klaus Ostermann
                                                 Thorsten Berger
Parsing C Code
without Preprocessing



                        Christian Kästner
                        Paolo G. Giarrusso
                        Tillmann Rendel
                        Sebastian Erdweg
                        Klaus Ostermann
                        Thorsten Berger
Viewer Discretion Is Advised
Linux
Kernel
10,000 features, 6 million lines of C code
Parse and Type check
               all configurations of the
                               entire Linux     kernel

   10,000 features, 6 million lines of C code
greet.c


                          printf   …       VWORLD          VBYE        main


           AST with                msg          ε      msg         ε   printf

Variability Information   ¬ (WORLD ˄BYE)
                                                                       msg
                                           true -> (WORLD v BYE)
Variability-Aware Analysis
                 Type System
                 Static Analysis
                 Bug Finding
                 Testing
                 Model Checking
                 Theorem Proving
                 …
Parsing C without Preprocessing
Macro expansion                 Undisciplined
needed for parsing               annotations                                       Alternative macros




                                                     ?
                     ?                                                         ?
                                                     greet.c



                         + printf           VWORLD         VBYE       + main


                                    + msg        ε     + msg      ε   printf


                                                                       msg
Previous Solutions

Disciplined Subset
      Requires Code Preparation

Heuristics and Partial Analysis
     Inaccurate, False Positives

Brute Force
     Infeasible Effort
https://github.com/ckaestne/TypeChef

TypeChef
                                                         Variability-Aware
                                               Parser-Framework

                        (                                                                +
                            2
    Variability-Aware           *                   Variability-Aware
                                    3                                            *               VA
         Lexer                          )
                                            +          Parser
                                             4A
                                              5¬A                            2       3       4        5


                                                                             Variability-Aware

                                                                             Analysis
Variability-Aware       Lexer




            (
                2
                    *
Variability-Aware   Lexer
353 included header files
      0                             per C file



   8590 macros
      0             per C file



   1387 conditional macros
      0                          per C file




335490 token
     0          per C file



    72 % conditional
     0                                        2.6.33.3
                                              X86
Variability-Aware   Parsing

(   2   *   3   )   +   4A 5¬A
                                                    +

                                            *               VA

                                        2       3       4        5
Undisciplined Annotations


2   *   (A   3    +   4   )A                   VA

                                   *                        +

                               2       +                *       4

                                   3       4        2       3
Partial Errors


2   *   (A   3   +   4   )                    VA

                                  *           Parse Error
                                              Expected + or EOF,
                                              but found ) at 1:7
                              2       +

                                  3       4
true
       (   3   +   4A   (¬A 4¬A˄ +¬A˄ 6¬A
                                B    B      )¬A   )
true
(      3   +   4A   (¬A 4¬A˄ +¬A˄ 6¬A
                            B    B      )¬A   )
3
        true
(   3      +   4A   (¬A 4¬A˄ +¬A˄ 6¬A
                            B    B      )¬A   )
3
        true
(   3   +   4A   (¬A 4¬A˄ +¬A˄ 6¬A
                         B    B      )¬A   )
A
3                4A   (¬A 4¬A˄ +¬A˄ 6¬A
                              B    B      )¬A   )

(   3   +

                 4A   (¬A 4¬A˄ +¬A˄ 6¬A
                              B    B      )¬A   )
            ¬A
4             A
3                4A       (¬A 4¬A˄ +¬A˄ 6¬A
                                  B    B      )¬A   )

(   3   +

                 4A       (¬A 4¬A˄ +¬A˄ 6¬A
                                  B    B      )¬A   )
            ¬A
4                  A
3                4A    (¬A 4¬A˄ +¬A˄ 6¬A
                               B    B            )¬A    )

(   3   +
                      Next Token:
                 4A    (¬A 4¬A˄ +¬A˄ 6¬A
                               B    B            )¬A    )
                      ctx -> tok: Consume
            ¬A        ctx ->¬tok: Skip
                      else:       Split (ctx ˄pc) andctx ˄ ¬pc)
                                                     (
4                     A
3                4A   (¬A 4¬A˄B +¬A˄ 6¬A
                                    B      )¬A   )

(   3   +

                 4A   (¬A 4¬A˄ +¬A˄ 6¬A
                              B    B       )¬A   )
            ¬A
4                          A
3                4A   (¬A 4¬A˄B +¬A˄ 6¬A
                                    B      )¬A   )

(   3   +

                 4A   (¬A 4¬A˄ +¬A˄ 6¬A
                              B    B       )¬A   )
            ¬A
4                                  A
3                4A   (¬A 4¬A˄B +¬A˄ 6¬A
                                    B          )¬A   )

(   3   +

                 4A   (¬A 4¬A˄ +¬A˄ 6¬A
                              B    B           )¬A   )
            ¬A
4                                        A
3                4A   (¬A 4¬A˄B +¬A˄ 6¬A
                                    B      )¬A       )

(   3   +

                 4A   (¬A 4¬A˄ +¬A˄ 6¬A
                              B    B       )¬A       )
            ¬A
4                                        A
3           4A        (¬A 4¬A˄B +¬A˄ 6¬A
                                    B      )¬A       )

(   3   +

            4A        (¬A 4¬A˄ +¬A˄ 6¬A
                              B    B       )¬A       )
                 ¬A
4                                   A
3           4A   (¬A 4¬A˄B +¬A˄ 6¬A
                               B      )¬A       )

(   3   +

            4A   (¬A 4¬A˄ +¬A˄ 6¬A
                         B    B       )¬A       )
                   ¬A
4                                    A
3           4A   (¬A 4¬A˄B +¬A˄ 6¬A
                               B       )¬A       )

(   3   +         ¬A˄B
                       4¬A˄ +¬A˄ 6¬A
                           B    B      )¬A       )
            4A   (¬A
                       4¬A˄ +¬A˄ 6¬A
                           B    B      )¬A       )
                 ¬A˄¬B
4                                    A
3           4A   (¬A 4¬A˄B +¬A˄ 6¬A
                               B       )¬A       )

(   3   +         4      ¬A˄B
                       4¬A˄ +¬A˄ 6¬A
                           B    B      )¬A       )
            4A   (¬A
                       4¬A˄ +¬A˄ 6¬A
                           B    B      )¬A       )
                 ¬A˄¬B
4                                    A
3           4A   (¬A 4¬A˄B +¬A˄ 6¬A
                               B       )¬A       )

(   3   +         4           ¬A˄B
                       4¬A˄ +¬A˄ 6¬A
                           B    B      )¬A       )
            4A   (¬A
                       4¬A˄ +¬A˄ 6¬A
                           B    B      )¬A       )
                 ¬A˄¬B
4                                     A
3           4A   (¬A + 4¬A˄B +¬A˄ 6¬A
                                 B      )¬A       )

(   3   +         4    6           ¬A˄B
                       4¬A˄ +¬A˄ 6¬A
                           B    B       )¬A       )
            4A   (¬A
                       4¬A˄ +¬A˄ 6¬A
                           B    B       )¬A       )
                 ¬A˄¬B
4                                     A
3           4A   (¬A + 4¬A˄B +¬A˄ 6¬A
                                 B      )¬A       )

(   3   +         4    6           ¬A˄B
                       4¬A˄ +¬A˄ 6¬A
                           B    B       )¬A       )
            4A   (¬A
                       4¬A˄B +¬A˄ 6¬A
                                 B      )¬A       )
                           ¬A˄¬B
4                                     A
3           4A   (¬A + 4¬A˄B +¬A˄ 6¬A
                                 B      )¬A       )

(   3   +         4    6           ¬A˄B
                       4¬A˄ +¬A˄ 6¬A
                           B    B       )¬A       )
            4A   (¬A
                       4¬A˄B +¬A˄ 6¬A
                                 B      )¬A       )
                              ¬A˄¬B
4                                     A
3           4A   (¬A + 4¬A˄B +¬A˄ 6¬A
                                 B      )¬A       )

(   3   +         4    6           ¬A˄B
                       4¬A˄ +¬A˄ 6¬A
                           B    B       )¬A       )
            4A   (¬A
                       4¬A˄B +¬A˄ 6¬A
                                 B      )¬A       )

                              6    ¬A˄¬B
4                                              A
3               4A       (¬A 4¬A˄B +¬A˄ 6¬A
                                       B         )¬A       )

(   3   +
                               4¬A˄ +¬A˄ 6¬A
                                   B    B
                4A       (¬A                     )¬A       )
                               4¬A˄B +¬A˄ 6¬A
                                         B

                VB                          ¬A
            +        6
        4       6
4                                             A
3               4A       (¬A 4¬A˄B +¬A˄ 6¬A
                                       B        )¬A        )

(   3   +
                               4¬A˄ +¬A˄ 6¬A
                                   B    B
                4A       (¬A                    )¬A        )
                               4¬A˄B +¬A˄ 6¬A
                                         B
                                                      ¬A
                VB
            +        6
        4       6
3                        4A   (¬A 4¬A˄B +¬A˄ 6¬A     )¬A
                                            B          true
(            3       +                                        )
                                    4¬A˄ +¬A˄ 6¬A
                                        B    B
                         4A   (¬A                    )¬A
        VA                          4¬A˄B +¬A˄ 6¬A
                                              B

    4       VB
        +        6
    4        6
4A   (¬A 4¬A˄B +¬A˄ 6¬A
                                            B        )¬A       true
(            3       +                                     )
                                    4¬A˄ +¬A˄ 6¬A
                                        B    B
    +                    4A   (¬A                    )¬A
3       VA                          4¬A˄B +¬A˄ 6¬A
                                              B

    4       VB
        +        6
    4        6
Variability-Aware
Parser Combinator Library
for Scala
Variability-Aware   Parsers
GNU C + cpp     Java + Antenna
Parsing Linux



Variability in Build System (kbuild)
            and with #ifdef

Variability Model (kconfig)            2.6.33.3
                                       X86
7665 C files (x86)
    0
  30 seconds per file
    0                        (median)



  85 hours total
    0
  4.1 % overhead
    0              (undiscipl.)


     0
     0 syntax errors                    2.6.33.3
                                        X86
Parser
Variability-Aware   Type System
                    Module System
                    Static Analysis
                    Bug Finding
                    Testing
                    Model Checking
                    Theorem Proving
                    Editor Support
                    Code Transform.
                    …
Variability-Aware Parsing
                                   in the Presence of
          Lexical Macros and Conditional Compilation



                                                                         Variability-Aware
                                                               Parser-Framework

                                        (                                                                +
                                            2
                Variability-Aware               *                   Variability-Aware
                                                    3                                            *               VA
                     Lexer                              )
                                                            +          Parser
                                                             4A
                   (macros, includes)
                                                              5¬A         (split & join)     2       3       4        5




https://github.com/ckaestne/TypeChef

Mais conteúdo relacionado

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Variability-Aware Parsing -- OOPSLA Talk

  • 1. Variability-Aware Parsing in the Presence of Lexical Macros and Conditional Compilation Christian Kästner Paolo G. Giarrusso Tillmann Rendel Sebastian Erdweg Klaus Ostermann Thorsten Berger
  • 2. Parsing C Code without Preprocessing Christian Kästner Paolo G. Giarrusso Tillmann Rendel Sebastian Erdweg Klaus Ostermann Thorsten Berger
  • 4.
  • 6. 10,000 features, 6 million lines of C code
  • 7. Parse and Type check all configurations of the entire Linux kernel 10,000 features, 6 million lines of C code
  • 8. greet.c printf … VWORLD VBYE main AST with msg ε msg ε printf Variability Information ¬ (WORLD ˄BYE) msg true -> (WORLD v BYE)
  • 9. Variability-Aware Analysis Type System Static Analysis Bug Finding Testing Model Checking Theorem Proving …
  • 10. Parsing C without Preprocessing
  • 11. Macro expansion Undisciplined needed for parsing annotations Alternative macros ? ? ? greet.c + printf VWORLD VBYE + main + msg ε + msg ε printf msg
  • 12.
  • 13.
  • 14. Previous Solutions Disciplined Subset Requires Code Preparation Heuristics and Partial Analysis Inaccurate, False Positives Brute Force Infeasible Effort
  • 15. https://github.com/ckaestne/TypeChef TypeChef Variability-Aware Parser-Framework ( + 2 Variability-Aware * Variability-Aware 3 * VA Lexer ) + Parser 4A 5¬A 2 3 4 5 Variability-Aware Analysis
  • 16. Variability-Aware Lexer ( 2 *
  • 18. 353 included header files 0 per C file 8590 macros 0 per C file 1387 conditional macros 0 per C file 335490 token 0 per C file 72 % conditional 0 2.6.33.3 X86
  • 19. Variability-Aware Parsing ( 2 * 3 ) + 4A 5¬A + * VA 2 3 4 5
  • 20. Undisciplined Annotations 2 * (A 3 + 4 )A VA * + 2 + * 4 3 4 2 3
  • 21. Partial Errors 2 * (A 3 + 4 ) VA * Parse Error Expected + or EOF, but found ) at 1:7 2 + 3 4
  • 22. true ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A )
  • 23. true ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A )
  • 24. 3 true ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A )
  • 25. 3 true ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A )
  • 26. A 3 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 27. 4 A 3 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 28. 4 A 3 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ( 3 + Next Token: 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ctx -> tok: Consume ¬A ctx ->¬tok: Skip else: Split (ctx ˄pc) andctx ˄ ¬pc) (
  • 29. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 30. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 31. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 32. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 33. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 34. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A
  • 35. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + ¬A˄B 4¬A˄ +¬A˄ 6¬A B B )¬A ) 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A˄¬B
  • 36. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4 ¬A˄B 4¬A˄ +¬A˄ 6¬A B B )¬A ) 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A˄¬B
  • 37. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4 ¬A˄B 4¬A˄ +¬A˄ 6¬A B B )¬A ) 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A˄¬B
  • 38. 4 A 3 4A (¬A + 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4 6 ¬A˄B 4¬A˄ +¬A˄ 6¬A B B )¬A ) 4A (¬A 4¬A˄ +¬A˄ 6¬A B B )¬A ) ¬A˄¬B
  • 39. 4 A 3 4A (¬A + 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4 6 ¬A˄B 4¬A˄ +¬A˄ 6¬A B B )¬A ) 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ¬A˄¬B
  • 40. 4 A 3 4A (¬A + 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4 6 ¬A˄B 4¬A˄ +¬A˄ 6¬A B B )¬A ) 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ¬A˄¬B
  • 41. 4 A 3 4A (¬A + 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4 6 ¬A˄B 4¬A˄ +¬A˄ 6¬A B B )¬A ) 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) 6 ¬A˄¬B
  • 42. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4¬A˄ +¬A˄ 6¬A B B 4A (¬A )¬A ) 4¬A˄B +¬A˄ 6¬A B VB ¬A + 6 4 6
  • 43. 4 A 3 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A ) ( 3 + 4¬A˄ +¬A˄ 6¬A B B 4A (¬A )¬A ) 4¬A˄B +¬A˄ 6¬A B ¬A VB + 6 4 6
  • 44. 3 4A (¬A 4¬A˄B +¬A˄ 6¬A )¬A B true ( 3 + ) 4¬A˄ +¬A˄ 6¬A B B 4A (¬A )¬A VA 4¬A˄B +¬A˄ 6¬A B 4 VB + 6 4 6
  • 45. 4A (¬A 4¬A˄B +¬A˄ 6¬A B )¬A true ( 3 + ) 4¬A˄ +¬A˄ 6¬A B B + 4A (¬A )¬A 3 VA 4¬A˄B +¬A˄ 6¬A B 4 VB + 6 4 6
  • 47. Variability-Aware Parsers GNU C + cpp Java + Antenna
  • 48. Parsing Linux Variability in Build System (kbuild) and with #ifdef Variability Model (kconfig) 2.6.33.3 X86
  • 49. 7665 C files (x86) 0 30 seconds per file 0 (median) 85 hours total 0 4.1 % overhead 0 (undiscipl.) 0 0 syntax errors 2.6.33.3 X86
  • 50. Parser Variability-Aware Type System Module System Static Analysis Bug Finding Testing Model Checking Theorem Proving Editor Support Code Transform. …
  • 51. Variability-Aware Parsing in the Presence of Lexical Macros and Conditional Compilation Variability-Aware Parser-Framework ( + 2 Variability-Aware * Variability-Aware 3 * VA Lexer ) + Parser 4A (macros, includes) 5¬A (split & join) 2 3 4 5 https://github.com/ckaestne/TypeChef