Questions: Domain-Specific Language Design and Implementation

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A team of financial engineers needs a language for expressing derivative contracts. They want domain experts (traders and quants, not software engineers) to write contracts directly. Which approach is most appropriate, and why?

AAn embedded DSL in Python, because Python's flexibility lets domain experts write contracts without a separate toolchain
BAn external DSL with its own parser, custom error messages in financial terms, and syntax tailored to contract expressions — so domain experts can work without programming knowledge
CA general-purpose language like Java, because DSLs are too narrow for the variety of financial contracts
DAn embedded DSL in Haskell, because Haskell's type system can enforce financial constraints
Question 2 Multiple Choice

A DSL for hardware description enforces timing constraints syntactically — certain race-condition patterns simply cannot be expressed in the language. Which design principle does this exemplify?

AThe DSL uses a more restrictive grammar than necessary, limiting expressiveness unnecessarily
BDomain knowledge is encoded in the language itself, making dangerous patterns structurally impossible
CThe hardware description DSL is actually a general-purpose language with a restricted standard library
DSyntactic restrictions compensate for the lack of a type system in the host language
Question 3 True / False

An embedded DSL is more powerful than an external DSL because it can use the full syntax and semantics of its host language.

TTrue
FFalse
Question 4 True / False

A well-designed DSL should make it easy for users to perform both domain-specific operations and general-purpose programming tasks.

TTrue
FFalse
Question 5 Short Answer

What is the core design principle that distinguishes a well-designed DSL from a poorly-designed one, and why does it matter for usability?

Think about your answer, then reveal below.