I've designed a very simple domain specific language(DSL) to specify and execute full-screen interactive behavior on devices. It's event based action language with XML as the carrier syntax. Example of it is here:
<state no="15000" >
<timeout>30</timeout>
<backgroundactions>
<as3function name="hideImages">
</as3function>
</backgroundactions>
<screen>
<components>
<textfield x="50" y="120" width="924" textsize="50" background="1" border="1">
<text say="1">
<part type="text">Who would you like to call?</part>
</text>
</textfield>
<button label="MENU" width="80" height="30" x="920" y="10" textsize="14" icon="none" adjtext="-5">
<event name="clicked">
<action preconditions="no" name="transition">
<parameter>
<type>state</type>
<name>n</name>
<value>800</value>
</parameter>
</action>
</event>
</button>
<button label="My contacts" width="250" height="200" x="212" y="500" textsize="40" icon="iconRight2.png" iconx="65" icony="20" adjtext="35">
<event name="clicked">
<action preconditions="no" name="transition">
<parameter>
<type>state</type>
<name>n</name>
<value>15007</value>
</parameter>
</action>
</event>
</button>
<button label="Other" width="250" height="200" x="562" y="500" textsize="40" icon="iconWrong2.png" iconx="65" icony="20" adjtext="35">
<event name="clicked">
<action preconditions="no" name="transition">
<parameter>
<type>state</type>
<name>n</name>
<value>15100</value>
</parameter>
</action>
</event>
</button>
</components>
</screen>
</state>
It semantically means the following:
It's a state transition language where the programmer declaratively describes the UI layout and the events to which the program should react to and the actions flowing the events. The DSL is designed for readability. Here's a short description of the nodes:
- timeout: The duration of a state timer while executing each state
- backgroundactions:these represent the actions executed on-entering a state
- state screen: screen components and events associated with them
- expectedevents: Events expected by the current state. these are async events
Is there a way to represent this particular language in a more formal description as a grammar or meta-model(i am not familiar with language modeling techniques). My idea is to write a language specifications for this DSL so that other programmers in my team can generate scripts in other languages of their choice such as python or lua from this specifications. Possibly even code-generate this XML as well? What would be the best way to represent this? I have been going through lots of language tools and dsl tools, but i can't figure out what would be most efficient for this langauge? someone with expertise can help me in the right direction and give a headstart on the steps that need to be done.