Creating a simple scripting language in Python

Viewed 1462

I'm creating a GUI application that can monitor and manipulate a stream of messages. I'm trying to create a simple means to let the user script some of this functionality and I'm looking for possible candidates. Initially I wanted to use XML since it can naturally take care of embedded code:

<if>
   <condition>
      <recv>
         <MesgTypeA/>
      </recv>
   </condition>
   <loop count=10>
      <send>
         <MesgTypeB>
            <param1>12</param1>
            <param2>52</param2>
         </MesgTypeB>
      </send>
   </loop>
</if>

For parsing I was planning on using ElementTree and just build states out of the code. Writing and reading XML isn't the easiest thing to do, especially since I can't assume that the writers of the script will have any sort of experience. I was wondering if anyone had any alternatives that is easier to read/write and process in Python. I looked into JSON but because it's a script, order matters.

Can anyone suggest any possible alternatives?

Thanks.

3 Answers
Related