Abstract
The Racket doctrine tells developers to narrow the gap between the terminology of a problem domain and general programming constructs by creating languages instead of just plain programs. This pearl illustrates this point with the creation of a relatively simple domain-specific language for editing videos. To produce the video proceedings of a conference, for example, video professionals traditionally use "non-linear" GUI editors to manually edit each talk, despite the repetitive nature of the process. As it turns out, video editing naturally splits the work into a declarative phase and an imperative rendering phase at the end. Hence it is natural to create a functional-declarative language for the first phase, which reduces a lot of manual labor. This user-facing DSL utilizes a second, internal DSL to implement the second phase, which is an interface to a general, low-level C library. Finally, we inject type checking into our language via another DSL that supports programming in the language of type formalisms. In short, the development of the video editing language cleanly demonstrates how the Racket doctrine naturally leads to the creation of language hierarchies, analogous to the hierarchies of modules found in conventional functional languages.
Supplemental Material
Available for Download
Virtual Machine Containing Video and Type Video implementations.
- Eli Barzilay and John Clements. Laziness Without All the Hard Work. In Functional and Declarative Programming in Education, pp. 9–13, 2005. Google ScholarDigital Library
- Eli Barzilay and Dimitry Orlovsky. Foreign Interface for PLT Scheme. In Scheme and Functional Programming, pp. 63–74, 2004.Google Scholar
- Alan Bawden and Jonathan Rees. Syntactic Closures. In Lisp and Functional Programming, pp. 86–95, 1988. Google ScholarDigital Library
- Jon Bentley. Little Languages. Communications of the ACM 29(8), pp. 711–21, 1986. Google ScholarDigital Library
- Dick Bulterman, Jack Jansen, Pablo Cesar, Sjoerd Mullender, Eric Hyche, Marisa DeMeglio, Julien Quint, Hiroshi Kawamura, Daniel Weck, Xabiel García Pañeda, David Melendi, Samuel Cruz-Lara, Marcin Hanclik, Daniel F. Zucker, and Thierry Michel. Synchronized Multimedia Integration Language. World Wide Web Consortium (W3C), 3.0, 2008. https://www.w3.org/TR/2008/REC-SMIL3-20081201/Google Scholar
- Jacques Carette, Oleg Kiselyov, and Chung-chieh Shan. Finally Tagless, Partially Evaluated. Journal of Functional Programming 19(5), pp. 509–543, 2009. Google ScholarDigital Library
- Stephen Chang, Alex Knauth, and Ben Greenman. Type Systems as Macros. In Principles of Programming Languages, pp. 694–705, 2017.Google Scholar
- William Clinger. Hygienic Macros Through Explicit Renaming. Lisp Pointers IV(4), pp. 25–28, 1991.Google ScholarDigital Library
- William R. Cook. Applescript. In History of Programming Languages, pp. 1-1–1-21, 2007.Google Scholar
- Ryan Culpepper. Fortifying Macros. Journal of Functional Programming 22(4-5), pp. 439–476, 2012. Google ScholarDigital Library
- Ryan Culpepper and Matthias Felleisen. Debugging Hygienic Macros. Science of Computer Programming 75(7), pp. 496–515, 2010. Google ScholarDigital Library
- Ken Dancyger. The Technique of Film and Video Editing: History, Theory, and Practice. Fifth edition. Focal Press, 2010.Google Scholar
- Sergey Dmitriev. Language Oriented Programming: The Next Programming Paradigm. JetBrains onBoard Electronic Magazine 1(1), 2004.Google Scholar
- R. Kent Dybvig, Robert Hieb, and Carl Bruggeman. Syntactic Abstraction in Scheme. Lisp and Symbolic Computation 5(4), pp. 295–326, 1993. Google ScholarDigital Library
- Sebastian Erdweg, Tillmann Rendel, Christian Kästner, and Klaus Ostermann. SugarJ: Library-based Syntactic Language Extensibility. In Object Oriented Programming Systems, Languages, and Applications, pp. 391–406, 2011.Google Scholar
- Sebastian Erdweg, Tijs van der Storm, Markus Völter, Laurence Tratt, Remi Bosman, William R. Cook, Albert Gerritsen, Angelo Hulshout, Steven Kelly, Alex Loh, Gabriël Konat, Pedro J. Molina, Martin Palatnik, Risto Pohjonen, Eugen Schindler, Klemens Schindler, Riccardo Solmi, Vlad Vergu, Eelco Visser, Kevin van der Vlist, Guido Wachsmuth, and Jimi van der Woning. Evaluating and Comparing Language Workbenches: Existing Results and Benchmarks for the Future. Computer Languages, Systems and Structures 44(Part A), pp. 24–47, 2015.Google Scholar
- Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi, Eli Barzilay, Jay McCarthy, and Sam Tobin-Hochstadt. The Racket Manifesto. In Summit on Advances in Programming Languages, pp. 113–128, 2015.Google Scholar
- Daniel Feltey, Spencer P. Florence, Tim Knutson, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, Robert Bruce Findler, and Matthias Felleisen. Languages the Racket Way. In Language Workbench Challenge, 2016.Google Scholar
- Robert Bruce Findler, John Clements, Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, Paul Steckler, and Matthias Felleisen. DrScheme: A Programming Environment for Scheme. Journal of Functional Programming 12(2), pp. 159–182, 2002. Google ScholarDigital Library
- Robert Bruce Findler and Matthias Felleisen. Contracts for Higher-order Functions. In International Conference on Functional Programming, pp. 48–59, 2002. Google ScholarDigital Library
- Matthew Flatt. Composable and Compilable Macros, You Want It When? In International Conference on Functional Programming, pp. 72–83, 2002.Google Scholar
- Matthew Flatt. Creating Languages in Racket. Communications of the ACM 55(1), pp. 48–56, 2012. Google ScholarDigital Library
- Matthew Flatt, Eli Barzilay, and Robert Bruce Findler. Scribble: Closing the Book on Ad Hoc Documentation Tools. In International Conference on Functional Programming, pp. 109–120, 2009. Google ScholarDigital Library
- Matthew Flatt, Robert Bruce Findler, and John Clements. GUI: Racket Graphics Toolkit. PLT Design Inc., PLT-TR-2010-3, 2010. https://racket-lang.org/tr3/Google Scholar
- Martin Fowler and Rebecca Parsons. Domain-specific Languages. Addison-Wesley, 2010.Google Scholar
- Jeremy Gibbons and Nicolas Wu. Folding Domain-specific Languages: Deep and Ahallow Embeddings (Functional Pearl). In International Conference on Functional Programming, pp. 339–347, 2014. Google ScholarDigital Library
- Gabriel Gonzalez. Light-weight and Type-safe Scripting with Haskell. In Commercial Users of Functional Programming Tutorials, 2015.Google Scholar
- Paul Hudak. Building Domain-Specific Embedded Languages. ACM Computing Surveys 28(4es), 1996. Google ScholarDigital Library
- Maxim Jago and Adobe Creative Team. Adobe Premiere Pro CC Classroom in a Book. Adobe Press, 2017.Google Scholar
- Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Geoffrey Washburn. Simple Unificationbased Type Inference for GADTs. In International Conference on Functional Programming, pp. 50–61, 2006.Google Scholar
- Lennart C.L. Kats and Eelco Visser. The Spoofax Language Workbench: Rules for Declarative Specification of Languages and IDEs. In Object Oriented Programming Systems, Languages, and Applications, pp. 444–463, 2010.Google Scholar
- Steven Kelly, Kalle Lyytinen, and Matti Rossi. MetaEdit+: A Fully Configurable Multi-User and Multi-Tool CASE and CAME Environment. In Conference on Advances Information System Engineering, pp. 1–21, 1996. Google ScholarCross Ref
- Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, and Bruce Duba. Hygienic Macro Expansion. In Lisp and Functional Programming, 1986. Google ScholarDigital Library
- Eugene Kohlbecker and Mitchell Wand. Macro-by-example: Deriving Syntactic Transformations From Their Specifications. In Principles of Programming Languages, pp. 77–84, 1987.Google Scholar
- Shriram Krishnamurthi. Linguistic Reuse. PhD dissertation, Rice University, 2001.Google Scholar
- Erik Meijer. Server Side Web Scripting in Haskell. Journal of Functional Programming 10(1), pp. 1–18, 2000. Google ScholarDigital Library
- Daniel Patterson and Amal Ahmed. Linking Types for Multi-Language Software: Have Your Cake and Eat It Too. In Summit on Advances in Programming Languages, pp. 12-1–12-15, 2017.Google Scholar
- Eric S. Raymond. The Art of UNIX Programming. First edition. Addison-Wesley, 2003.Google Scholar
- Ton Roosendaal and Roland Hess. The Essential Blender: Guide to 3D Creation with the Open Source Suite Blender. No Starch Press, 2007.Google Scholar
- Wim Taymans, Steve Baker, Andy Wingo, Rondald S. Bultje, and Kost Stefan. GStreamer Application Development Manual. 2013. https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/manual.pdfGoogle Scholar
- Sam Tobin-Hochstadt, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, and Matthias Felleisen. Languages As Libraries. In Programming Languages Design and Implementation, pp. 132–141, 2011. Google ScholarDigital Library
- Martin P. Ward. Language Oriented Programming. Software—Concepts and Tools 15, pp. 147–161, 1994.Google Scholar
- Hongwei Xi, Chiyan Chen, and Gang Chen. Guarded Recursive Datatype Constructors. In Principles of Programming Languages, pp. 224–235, 2003. Google ScholarDigital Library
- Hongwei Xi and Frank Pfenning. Eliminating Array Bound Checking Through Dependent Types. In Programming Languages Design and Implementation, pp. 249–257, 1998. Google ScholarDigital Library
Index Terms
- Super 8 languages for making movies (functional pearl)
Recommendations
Everything old is new again: quoted domain-specific languages
PEPM '16: Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program ManipulationWe describe a new approach to implementing Domain-Specific Languages(DSLs), called Quoted DSLs (QDSLs), that is inspired by two old ideas:quasi-quotation, from McCarthy's Lisp of 1960, and the subformula principle of normal proofs, from Gentzen's ...
Storm: a language platform for interacting and extensible languages (tool demo)
SLE 2018: Proceedings of the 11th ACM SIGPLAN International Conference on Software Language EngineeringThe ability to extend programming languages with domain-specific concepts is becoming an essential technology for developing complex software. However, many domain-specific languages are implemented in a way that interact poorly with the host language. ...
Testing domain-specific languages
OOPSLA '11: Proceedings of the ACM international conference companion on Object oriented programming systems languages and applications companionThe Spoofax testing language provides a new approach to testing domain-specific languages as they are developed. It allows test cases to be written using fragments of the language under test, providing full IDE support for writing test cases and ...
Comments