SlideShare a Scribd company logo
LUIS EDUARDO S. AMORIM (Delft University of Technology)
TIMOTHE ́E HAUDEBOURG (ENS Rennes)
MICHAEL J. STEINDORFER (Delft University of Technology)
EELCO VISSER (Delft University of Technology)
TU Delft
March 2019
A Direct Semantics for Declarative
Disambiguation of Expression Grammars
What is the meaning of associativity and priority declarations?
!2
!3
Major revision of TOPLAS submission
Work in progress
68 pages
What is the meaning of a set of disambiguation rules for a grammar?
- What are the parse trees associated with sentences in the language of the disambiguated grammar? 

- independent of particular implementation strategy?

Is a set of disambiguation rules safe?
- Do the disambiguation rules preserve the language of the grammar they disambiguate? 

- Is it necessary for disambiguation rules to be safe, or can rules exclude sentences?

Is a set of disambiguation rules complete?
- Do the rules identify at most one parse tree for each sentence in the language? 

- Not obvious: ambiguity of CFGs is undecidable

What is the coverage of disambiguation rules?
- What classes of ambiguity do the rules solve?

What is an effective implementation strategy for disambiguation rules?
What is the notational overhead of disambiguation rules?
- More effective than an encoding in the grammar?
!4
Research Questions
Expression grammars
- Sub-classes of CFGs with decidable ambiguity

- Extraction of embedded expression grammars

Harmless overlap
- Avoid inherent ambiguities

Subtree exclusion patterns
- Deep priority conflict patterns

Safe and complete
- Preserve language and solve all ambiguities 

- Proof: induction on trees under subtree exclusion

Implementation in SDF3
- Transformation to contextual grammars

- Data-dependent parsing

Evaluation on 5 programming languages
!5
Contributions
This Talk
!6
!7
Grammars and Ambiguity
8
Grammars, Well-Formed Trees, Languages
!9
Parsing
!10
Derivations
!11
Lemma 2.5. A parse tree directly corresponds to a derivation,
modulo the order in which productions are applied.
Parse Tree to Abstract Syntax Tree
!12
Tree Patterns and Pattern Matching
!13
Tree Patterns and Pattern Matching: Example
!14
Ambiguity
!15
Explicit Disambiguation (Brackets)
!16
Disambiguation Filter
!17
Subtree Exclusion Filter
!18
Trees under Subtree Exclusion
!19
Safety and Completeness
!20
Expression Grammars
21
Embedded Expression Grammars
!22
Classes of Expression Grammars
!23
Basic Distfix Indirectly recursive
Expression Grammar Hierarchy
!24
Infix Expression Grammars
25
Infix Expression Grammars
!26
Grammar Rewriting
!27
SDF2 Semantics
!28
Subtree Exclusion is Safe
!29
Subtree Exclusion is Safe
!30
Subtree Exclusion is Safe
!31
Subtree Exclusion is Safe
!32
Total Set of Disambiguation Rules
!33
Subtree Exclusion is Complete
!34
Subtree Exclusion is Complete
!35
Subtree Exclusion is Complete
!36
Subtree Exclusion is Complete
!37
Subtree Exclusion is Complete
!38
Disambiguation for Infix Expression is Safe and Complete
!39
Deep Priority Conflicts
40
Prefix Expression Grammars
!41
SDF2 Semantics is Unsafe for Prefix Expression Grammars
!42
Safe Semantics
!43
Safe Semantics for Shallow Conflicts
!44
Deep Priority Conflicts
!45
Rightmost Deep Matching
!46
Rightmost Deep Matching
!47
Rightmost Deep Priority Conflict Pattern
!48
Etc.
49

More Related Content

PPTX
Contrastive analysis (ca)
PPTX
Coding as a (second) Language
PPTX
Contrastive analysis
PPT
Contrastive analysis (ca)
PPTX
English 5 partial 1 Exam Eeview Online
PDF
syntaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pdf
PDF
05SyntaxAnalysis in compiler design notespdf
PPTX
compiler design syntax analysis top down parsing
Contrastive analysis (ca)
Coding as a (second) Language
Contrastive analysis
Contrastive analysis (ca)
English 5 partial 1 Exam Eeview Online
syntaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pdf
05SyntaxAnalysis in compiler design notespdf
compiler design syntax analysis top down parsing

Similar to A Direct Semantics of Declarative Disambiguation Rules (20)

PPTX
COMPILER DESIGN LECTURES -UNIT-2 ST.pptx
PPT
Describing syntax and semantics66666.ppt
PPTX
4. languages and grammars
DOCX
9-Removal of ambiguity, precedence and associativity-26-05-2023.docx
PDF
Compiler Construction | Lecture 4 | Parsing
PPT
Compiler design lessons notes from Semester
PPTX
Lexhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptx
PPT
Chapter 3 -Syntax Analyzer.ppt
PPT
Context free grammar
PDF
ambiguity grammar.pdf
PDF
Syntax Analysis_73 pages notes IIIT Manipur.pdf
PPT
sabesta3.ppt
PPTX
Chapter3pptx__2021_12_23_22_52_54.pptx
PDF
Syntax analysis
DOCX
8-Practice problems on operator precedence parser-24-05-2023.docx
PDF
CS4200 2019 | Lecture 3 | Parsing
PPTX
6-Role of Parser, Construction of Parse Tree and Elimination of Ambiguity-06-...
PPT
Integrated Fundamental and Technical Analysis of Select Public Sector Oil Com...
PPT
Module 11
PPT
COMPILER DESIGN LECTURES -UNIT-2 ST.pptx
Describing syntax and semantics66666.ppt
4. languages and grammars
9-Removal of ambiguity, precedence and associativity-26-05-2023.docx
Compiler Construction | Lecture 4 | Parsing
Compiler design lessons notes from Semester
Lexhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptx
Chapter 3 -Syntax Analyzer.ppt
Context free grammar
ambiguity grammar.pdf
Syntax Analysis_73 pages notes IIIT Manipur.pdf
sabesta3.ppt
Chapter3pptx__2021_12_23_22_52_54.pptx
Syntax analysis
8-Practice problems on operator precedence parser-24-05-2023.docx
CS4200 2019 | Lecture 3 | Parsing
6-Role of Parser, Construction of Parse Tree and Elimination of Ambiguity-06-...
Integrated Fundamental and Technical Analysis of Select Public Sector Oil Com...
Module 11
Ad

More from Eelco Visser (20)

PDF
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
PDF
CS4200 2019 | Lecture 4 | Syntactic Services
PDF
CS4200 2019 | Lecture 2 | syntax-definition
PDF
CS4200 2019 Lecture 1: Introduction
PDF
Declarative Type System Specification with Statix
PDF
Compiler Construction | Lecture 17 | Beyond Compiler Construction
PDF
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
PDF
Compiler Construction | Lecture 15 | Memory Management
PDF
Compiler Construction | Lecture 14 | Interpreters
PDF
Compiler Construction | Lecture 13 | Code Generation
PDF
Compiler Construction | Lecture 12 | Virtual Machines
PDF
Compiler Construction | Lecture 11 | Monotone Frameworks
PDF
Compiler Construction | Lecture 10 | Data-Flow Analysis
PDF
Compiler Construction | Lecture 9 | Constraint Resolution
PDF
Compiler Construction | Lecture 8 | Type Constraints
PDF
Compiler Construction | Lecture 7 | Type Checking
PDF
Compiler Construction | Lecture 6 | Introduction to Static Analysis
PDF
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
PDF
Compiler Construction | Lecture 3 | Syntactic Editor Services
PDF
Compiler Construction | Lecture 2 | Declarative Syntax Definition
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 Lecture 1: Introduction
Declarative Type System Specification with Statix
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 3 | Syntactic Editor Services
Compiler Construction | Lecture 2 | Declarative Syntax Definition
Ad

Recently uploaded (20)

PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PPTX
Cybersecurity: Protecting the Digital World
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
assetexplorer- product-overview - presentation
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
STL Containers in C++ : Sequence Container : Vector
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
Trending Python Topics for Data Visualization in 2025
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Salesforce Agentforce AI Implementation.pdf
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Oracle Fusion HCM Cloud Demo for Beginners
Cybersecurity: Protecting the Digital World
Tech Workshop Escape Room Tech Workshop
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Digital Systems & Binary Numbers (comprehensive )
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Monitoring Stack: Grafana, Loki & Promtail
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
GSA Content Generator Crack (2025 Latest)
assetexplorer- product-overview - presentation
Computer Software and OS of computer science of grade 11.pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
STL Containers in C++ : Sequence Container : Vector
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Trending Python Topics for Data Visualization in 2025

A Direct Semantics of Declarative Disambiguation Rules