Post on 04-Jun-2020
Super 8 Languages for Making Movies(A Functional Pearl)
Leif AndersenStephen Chang
Mahias Felleisen
PLT @ Northeastern University
ICFP - Sept 4, 2017
Super 8: Languages for Making Movies
Super, 8 Languages for Making Movies
Super 8: Languages for Making Movies
A DSL for Scripting Videos
Super, 8 Languages for Making Movies
DSL Towers to Solve Multitudes of Problems
Super 8: Languages for Making Movies
A DSL for Scripting Videos
Super, 8 Languages for Making Movies
DSL Towers to Solve Multitudes of Problems
One down
One down19 more to go…
We NeedAutomation
We NeedAutomationAbstraction
e Landscape
Tool Example Experience
Plugin-Ins Blender Script, AE Script
UI Automation(Macros)
Apple Script
Shell Scripts FFmpeg, AVISynth
e Landscape
Tool Example Experience
Plugin-Ins Blender Script, AE Script
UI Automation(Macros)
Apple Script
Shell Scripts FFmpeg, AVISynth
e Landscape
Tool Example Experience
Plugin-Ins Blender Script, AE Script
UI Automation(Macros)
Apple Script
Shell Scripts FFmpeg, AVISynth
e Landscape
Tool Example Experience
Plugin-Ins Blender Script, AE Script
UI Automation(Macros)
Apple Script
Shell Scripts FFmpeg, AVISynth
Video Editor
Functional Programming Language*
*But bad with abstractions.
Video,the programming language
Primitives
List Comprehensions
Modules
Functions
Writing Video+ Editing Talks
(RacketCon 2016)< Editing Talks
Manually(RacketCon 2015)
Super 8: Languages for Making Movies
A DSL for Scripting Videos
Super, 8 Languages for Making Movies
DSL Towers to Solve Multitudes of Problems
Super 8: Languages for Making Movies
A DSL for Scripting Videos
Super, 8 Languages for Making Movies
DSL Towers to Solve Multitudes of Problems
Video,the tower of languages
FFmpegMLT
Video
FFmpegMLT
Video
We have a problem…
We have a problem…
We want to solve it in theproblem domain's own language…
We have a problem…
We want to solve it in theproblem domain's own language…
DSLs are the
"Ultimate Abstraction"
Paul Hudak
We have a problem… V
We have a problem…
We want to solve it in theproblem domain's own language…
V
We have a problem…
We want to solve it in theproblem domain's own language…
Towerof DSLs
V
Towerof DSLs
Language Oriented
Programming
We want to make DSLs quickly…
Use Racket, a programmableprogramming language
MLT FFmpeg
We make DSLs using
Linguistic Inheritance
We make DSLs using
Linguistic InheritanceMovie Script
Video Implementation
Racket
We make DSLs using
Linguistic InheritanceMovie Script
Video Implementation
Racket
Re-export construct
We make DSLs using
Linguistic InheritanceMovie Script
Video Implementation
Racket
Re-export construct
Remove construct
We make DSLs using
Linguistic InheritanceMovie Script
Video Implementation
Racket
Re-export construct
Remove construct
New construct
We make DSLs using
Linguistic InheritanceMovie Script
Video Implementation
Racket
Re-export construct
Remove construct
New construct
Change construct
Change construct
Interposition Points
#lang video
logotalk
;; Where(define logo ...)(define talk ...)
(module anon video (#%module-begin
logotalk(define logo ...)(define talk ...)))
parses
Interposition Points
(module anon video (#%module-begin
logotalk(define logo ...)(define talk ...)))
(module anon racket (#%module-begin
(require vidlib)(define logo ...)(define talk
...)(vid-begin vidlogotalk)))
elaborates
Implementing Interposition Points#lang racket
FFI
An FFI DSL
mlt_repositorymlt_factory_init(const char *directory);
(Scheme Wrksp., 2004)
An FFI DSL
mlt_repositorymlt_factory_init(const char *directory);
(define-mlt mlt-factory-init (_fun [p : _path]
-> [ret : _mlt-repository/null]-> (maybe-error? ret)))
(Scheme Wrksp., 2004)
An Object DSL
(define-mlt mlt-factory-init ...)(define-mlt mlt-factory-close ...)
(define-constructor clip video ... mlt-factory-init ...
mlt-factory-close ...)
MLT FFmpeg
Documentation
A Documentation DSL
(ICFP, 2009)
A Documentation DSL
#lang video/documentation@title{Video: The Language}@(defmodulelang video)
Video Language (or VidLang, sometimes referredto as just Video) is a DSL for editing...videos.It aims to merge the capabilities of a traditional
(ICFP, 2009)
MLT FFmpeg
Types
(clip "clip.mp4"#:start 0#:end 50)
(cut-producer
#:start 0#:end 100)
(clip "clip.mp4"#:start 0#:end 50)
(cut-producer
#:start 0#:end 100)
(clip "clip.mp4"#:start 0#:end 50)
A Typed DSL
A Typed DSL
(POPL, 2016)
A Type Implementation DSL
(define-typed-syntax (clip f) ≫ [⊢ f ≫ _ ⇐ File] #:where n (length f) ------------------------------------- [⊢ (untyped:clip f) ⇒ (Producer n)])
(POPL, 2016)
MLT FFmpeg
We have a problem…DSL V
We have a problem…
We want to solve it in theproblem domain's own language…
DSL V
We have a problem…
We want to solve it in theproblem domain's own language…
syntax-parseA DSL for making DSLs
DSL V
(ICFP, 2010)
MLT FFmpeg
We have a problem…Editor V
We have a problem…
We want to solve it in theproblem domain's own language…
Editor V
We have a problem…
We want to solve it in theproblem domain's own language…
? We make DSLs using
Linguistic Inheritance ?
Editor V
Future Work
MLT FFmpeg
anks For Watching
http://lang.video@videolang We make DSLs using
Linguistic Inheritance
MLT FFmpeg