Domain Specific Languages and IF

I’m one of the insane people in the IF Community who loves the idea of creating a new platform to make IF games. I’ve been thinking about it for years, if not decades.

One of the concepts that I graviate to is the idea that there are domain specific languages. The current platforms for IF development are all DSL’s. The problem I have is that I think IF itself is really multiple DSL’s. I believe that a true IF platform would have different DSL’s for different aspects of IF development, such as mapping, setting, conversations, npc automation, etc.

Well one of my favorite technical authors is nearing completion of a book about DSL’s and I thought everyone should know about it. Martin Fowler is coming out with a book called, you got it, Domain Specific Languages (http://martinfowler.com/dslwip/), and in the book he breaks down the processes involved in developing a DSL.

The online content will disappear soon, but I think it’s worth perusing now if you have time.

David C.

Hey, who doesn’t?

Here’s another book on domain specific languages I read a long time ago: Constructing Language Processors for Little Languages by Randy Kaplan

DSL for mapping.

In Inform 7, you create the map of your game by simple declaring rooms and how they relate to each other, as so:

The Kitchen is a room.
The Hall is east of the Kitchen.
The Living Room is south of the Hall.
The Dining Room is north of the Hall.
The Foyer is east of the Hall.

As DSL’s go, I can’t see how this could be any clearer.

Does anyone think there’s a different syntax that declares rooms and their relationships better than Inform 7? Your example doesn’t need to come from an existing DSL.

David C.

IMO one thing to think about is whether a DSL necessarily implies you’re dealing directly with text.

Coincidentally I’ve got more into this stuff recently too, when I talked to a guy at one of the Seattle meet ups who happens to work at Intentional Software, where they’re working on a language workbench. Anyway, the point being that while the I7 syntax is probably as simple as you can go if you’re using cardinal directions, I think it’s possible a better DSL than I7 wouldn’t use text at all.

About language workbenches…looking back at the original position papers for I7, it seems like the big ideas were to create a natural language-ish IF system, with a book metaphor for the IDE, and using a literate programming methodology. But it seems, maybe just by accident, that the I7 team sort-of created the first language workbench for IF. You can look at the skein, the index, and so on as sort-of DSLs for those problem domains, and real DSLs if their functionality was extended.

Yes, arguably a graphical mapping tool might be more convenient for some people. I’ve never really been in favor of it. I don’t even really care for the mapping feature in the index of I7. It seems…unnecessary.

And yes, the index, the skein, those are DSL’s too.

The one DSL no one has really figured out (at least in my book) is conversations. It’s such an awful thing to try to map in text, in grids, in tables, or code. I’ve often thought that those mind-mapping graphical tools looked close to how conversations might be drawn, but it would have to have controls to alter the view so you can see the conversation branching well.

David C.