How to parse the mkgmap style files ?

http://wiki.openstreetmap.org/wiki/Mkgmap/help/style_rules
describes the style rules that can be found inside the style files for mkgmap, e.g. the files lines, points, relations…
I would like to know, how these style files can be easily red by a parser?
Which parser would be able to read the format of these style files?
How does mkgmap work with these style files?
My aim is to use the sophisticated styles (e.g. OpenMTBMap, Wanderreitkarte) for the mkgmap renderer and “translate” these rules with a script/program to style files for other renderers like e.g. Maperitive, Kosmos, Mapnik…
Maybe it is too much effort to write this “translator” and it is quicker to write new style files for the renderer?
My goal is, that i will get better maps for outdoor use (Hiking, MTB) with an Android App and offline navigation.
I don’t like most of the ready-made map tiles (for outdoor use) that can be downloaded with the Mobile Atlas Creator.
And neither the Android Apps nor Mobile Atlas Creator are able to render new map tiles with a user-defined style, they only use already rendered map tiles.

I think all the style processing in mkgmap is done in the osmstyle section:
http://www.mkgmap.org.uk/svn/wsvn/mkgmap/src/uk/me/parabola/mkgmap/osmstyle/
You should read this code if you want to know how mkgmap does it.

Thanks for the direct link to the svn repository.
I assume, this will get a bit more difficult to understand how mkgmap handle the sytle files :confused:

mkgmap-style files are something like a dictionary between osm-tags and Garmin-IDs. For your parser you will also need the corresponding TYP-file, which contains the info how a Garmin-ID will be drawn.