Section 10.9.  Exercises
Team LiB
Previous Section Next Section

10.9. Exercises

10-0.

Consider the possibility of using operators other than >> in Spirit to separate consecutive grammar symbols. Would any other operator be better? Why or why not? Hint: Consider C++ grammar rules in addition to readability.

10-1.

Are you beginning to notice a common theme in which limitations of the host language drive many DSEL design decisions? Consider how you might design a language that allows open-ended DSEL syntax and do a cost/benefit analysis comparing the use of the hypothetical language to what you've seen in C++. You might look at the history and use of macros in LISP for inspiration.

10-2.

Use any of the Boost DSEL libraries discussed in this chapter to solve a small problem. Evaluate the user experience: What worked about the library? What was cumbersome about it?

10-3.

Build a small DSEL for handling named function parameters using a protocol similar to the one described in this chapter. Compare your design with that of the Boost named parameters library, by David Abrahams and Daniel Wallin, in the prerelease materials on this book's companion CD.

    Team LiB
    Previous Section Next Section