© Thomas Mailund 2018
Thomas MailundDomain-Specific Languages in Rhttps://doi.org/10.1007/978-1-4842-3588-1_4

4. Functions, Classes, and Operators

Thomas Mailund1 
(1)
Aarhus N, Staden København, Denmark
 

Everything you do in R, you do with functions. Consequently, if you want to implement a domain-specific language, you must do so by writing functions. All the actions that your new DSL should support must be implemented using functions, and should you want a special syntax for your DSL, you will have to write functions for parsing this syntax. When implementing an embedded DSL, as we shall see, much of the parsing can be outsourced to R’s parser. The price for this is some restrictions to the syntax for the DSL—the DSL must be syntactically valid ...

Get Domain-Specific Languages in R: Advanced Statistical Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.