1 / 20

Compile Time Abstraction Techniques for the D Programming Language

Compile Time Abstraction Techniques for the D Programming Language. Benjamin Shropshire. Abstraction. What Why When How. What & Why. What: Isolation of lower level complexity Distillation of Intent Removal of redundancy Why: Saving Time Programming time Maintenance time User time.

nhu
Télécharger la présentation

Compile Time Abstraction Techniques for the D Programming Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Compile Time Abstraction Techniques for the D Programming Language Benjamin Shropshire

  2. Abstraction What Why When How

  3. What & Why • What: Isolation of lower level complexity • Distillation of Intent • Removal of redundancy • Why: Saving Time • Programming time • Maintenance time • User time Benjamin Shropshire

  4. When to use Abstractions? • Let the computer do what it is good at. • Abstract where abstraction is a good fit Benjamin Shropshire

  5. When to Not use Abstractions? • If the abstraction doesn't fit, don't force it. • Beware of premature optimizations. • Code speed • Coding speed • Test optimizations. Benjamin Shropshire

  6. Compile time processing Nesting Templates Chained Recursion Nested Tuples

  7. Nesting Templates Define two lists using two templates Benjamin Shropshire

  8. Nesting Templates • Multiple Tuples • Useful naming Benjamin Shropshire

  9. Chained Recursion Starting point Introduce alias to nested templates Nested templates that do something and then also use mixin Benjamin Shropshire

  10. Chained Recursion • Object Oriented style design • Domain Specific Languages • Closer to what is wanted Benjamin Shropshire

  11. Nested Tuples Alias tuples inside of strut Benjamin Shropshire

  12. Nested Tuples • Use structs • Alias in templates don’t work • foreach works well on types Benjamin Shropshire

  13. All Together Now Compile Time Parsing Compile Time Parser Generation

  14. Compile Time Parsing • Reading Data • Building tree Benjamin Shropshire

  15. Compile Time Parsing Attempt to parse D Attempt to parse B Build tuple of D’s Record unused input Benjamin Shropshire

  16. Compile Time Parsing Found BCA Found BC failed on A, so parsing only B Found B failed on C, so parsing only B Failed on B, so failing Benjamin Shropshire

  17. Compile Time Parsing Benjamin Shropshire

  18. Compile Time Parser Generation • Parse grammar • Select production to instance • Try each disjunction • Try each part • Recurs to other productions • Record checkpoints • Backtrack through checkpoints on failure Benjamin Shropshire

  19. Compile Time Parser Generation Benjamin Shropshire

  20. Dr. Robert Hiromoto Michael Hewitt Dr. David Buehler Dr. Geoffrey Shropshire Eric Hewitt Compile Time Abstraction Techniques for the D Programming Language Benjamin Shropshire Special Thanks to: Benjamin Shropshire

More Related