Survey DSL

H. Conrad Cunningham

16 April 2022

Copyright (C) 2006, 2008, 2022, H. Conrad Cunningham
Professor of Computer and Information Science
University of Mississippi
214 Weir Hall
P.O. Box 1848
University, MS 38677
(662) 915-7396 (dept. office)

Browser Advisory: The HTML version of this textbook requires a browser that supports the display of MathML. A good choice as of April 2022 is a recent version of Firefox from Mozilla.

1 Survey DSL

1.1 Background

I developed the Survey DSL case study for my paper “A Little Language for Surveys: Constructing an Internal DSL in Ruby” [3].

H. Conrad Cunningham, “A Little Language for Surveys: Constructing an Internal DSL in Ruby,” In Proceedings of the ACM SouthEast Conference, Auburn, Alabama, USA, pp. 282–287, March, 2008.

My Powerpoint presentation from ACMSE 2008 is at this link.

Note: I subsequently wrote an improved version of the paper’s introduction.

1.2 Source Code

I developed this DSL (my first larger DSL from scratch) originally as an example in my Fall 2006 special topics class (Engr 692) on Ruby and Software Development. I expanded it in late 2007 and early 2008 for the ACMSE 2008 paper [3]. I used the Ruby programming language [8,9].

2022 Note: This program should be tested with the current Ruby implementation and updated appropriately.

1.3 Acknowldgments

This case study develops an internal domain-specific language (DSL) for describing simple surveys consisting of sequences of questions with each question having a sequence of possible responses. The development of this DSL and program was inspired by an example in Jon Bentley’s Programming Pearls column on “Little Languages” [1]. In addition, the language and its implementation were influenced by Fowler [4,5,6 (draft)], Freeze [7], Buck [2], and other sources.

I developed this DSL (my first larger internal DSL from scratch) originally as an example in my Fall 2006 special topics class (Engr 692) on Ruby and Software Development. I expanded it in late 2007 and early 2008 for the ACMSE 2008 paper [3].

I retired from the full-time faculty in May 2019. As one of my post-retirement projects, I am continuing work on possible textbooks based on the course materials I had developed during my three decades as a faculty member. In January 2022, I began refining the existing content, integrating separately developed materials together, reformatting the documents, constructing a unified bibliography (e.g., using citeproc), and improving my build workflow and use of Pandoc. I adapted this index page from a portion of my Spring 2018 course notes.

I maintain this chapter as text in Pandoc’s dialect of Markdown using embedded LaTeX markup for the mathematical formulas and then translate the document to HTML, PDF, and other forms as needed.

1.4 References

[1]
Jon Bentley. 1986. Programming pearls: Little languages. Communications of the ACM 29, 8 (1986), 711–721.
[2]
Jamis Buck. 2006. Writing domain specific languages (blog post). Retrieved from https://weblog.jamisbuck.org/2006/4/20/writing-domain-specific-languages.html
[3]
H. Conrad Cunningham. 2008. A little language for surveys: Constructing an internal DSL in Ruby. In Proceedings of the ACM SouthEast conference, Auburn, Alabama, USA, 282–287.
[4]
Martin Fowler. 2005. Language workbenches: The killer-app for domain specific languages? (Blog post). Retrieved from http://www.martinfowler.com/articles/languageWorkbench.html
[5]
Martin Fowler. 2005. Generating code for DSLs (blog post). Retrieved from https://www.martinfowler.com/articles/codeGenDsl.html
[6]
Martin Fowler and Rebecca Parsons. 2010. Domain specific languages. Addison-Wesley, Boston, Massachusetts, USA.
[7]
Jim Freeze. 2006. Creating DSLs with Ruby. Retrieved from https://www.artima.com/articles/creating-dsls-with-ruby
[8]
Ruby Community. 2022. Ruby: A programmer’s best friend. Retrieved from https://www.ruby-lang.org
[9]
David Thomas, Chad Fowler, and Andrew Hunt. 2004. Programming Ruby (Second ed.). Pragmatic Bookshelf, Raleigh, North Carolina, USA.