
Ask HN: How to create a DSL to represent clothing? - Jun8
I&#x27;ve been thinking about this for a long time. People usually give the advice of &quot;scratch your own itch&quot; to generate ideas: well, when it comes to selecting what to wear I&#x27;m not only color blind but also, how to put it, somewhat fashion-challenged. Current solution is to have my wife select stuff and give me the look-over in the morning. I know, pathetic.<p>In search of a better approach, I thought of creating a list of all clothing items I have with attributes (type:t-shirt, color:green, etc.). I&#x27;d like to create a DSL that I can (1) use to describe my whole outfit and (2) &quot;compile&quot; the selected outfit for &quot;errors&quot;, e.g. red short doesn&#x27;t go with brown sweater.<p>To get me started, what&#x27;s the best approach to building such a thing?
======
__d
Perhaps you could start out building your data model using an existing
language? That'd give you the chance to experiment with the semantics, and
figure out what you need to express in your DSL in a fairly rigorous way.

Once you've nailed that, you could start playing with syntaxes that could be
compiled to that data model. Some sort of declarations and then expressions
for "outfits", maybe?

Have you considered using Prolog? I'm no expert, but that was my first thought
for tackling this kind of problem.

