Rewriting pidl in Haskell

tags = [, ]

Now that my rewrite of pidl has been finished, I am wondering what the future for pidl will be.

Looking at the new structure of the source code, I notice that pidl's structure is now very simple. First, it generates a datastructure representing the IDL file; then it generates new datastructures by walking the first one recursively. In the last step, it recursively walks a datastructure generating output.

Things like this are very easy to do in Haskell, using a trivial parser and a couple of fold functions, as I learned at the course on grammars and parsing at uni.

The parsing step is probably the most difficult one, i.e. going from a file to something like this:

type Property = (String, [String])

type EnumMember = (String, String)

data Type = Struct (Maybe String) [DataMember]
             | Union (Maybe String) [Maybe DataMember]
             | Enum (Maybe String) [EnumMember]
             | Reference String
             | Interface String (Maybe String) [Property] [InterfaceMember]

type Typedef = (String, Type)

data InterfaceMember = Function String [Property] Type [DataMember]
                     | Typedef String [Property] Type
                     | Const Type String String
                     | Type Type

type DataMember = (Type, Int, String, [Property], [String])

Ah well, back to more important things now...

Go Top