Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

A Direct Semantics of Declarative Disambiguation Rules

393 views

Published on

Slides for a talk in the PL seminar at TU Delft

Published in: Software
  • Be the first to comment

  • Be the first to like this

A Direct Semantics of Declarative Disambiguation Rules

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

×