9.19.2012

Parsed

I haven't in a while here and I'm guilty as hell cause Dark Souls took my full attention. However, I did not forget my planned ITK update. But, uhm... well - let's just say since I can't work on it fulltime anymore, I see why I didn't get along when it became bigger. It's simply too big, has too much different functionality to work perfectly well. My idea is to split the whole stuff and do a set of sub libraries/headers. I never really liked frameworks or monoliths - I like small and clever solutions. The also brings the comfort or not needing to prefix everything with ITK, a really annoying thing to do... Something slightly different that brought up this idea is this sort of universal parser I'm finishing right now. I just started something without all the ITK macros and it worked so well, developed so fast that I decided this to be my preferred way of creating stuff. Of course I'll be using ITK for the multithreading part, but written as a different library. Soooo, now that I sorted this out, I can finally express how awesome I'm finding my parser. I designed several sorts in the future but I never thought about just writing a parser like I always did in the past just to realize how easy a generalization of my systematic thoughts would be. So this is what I did - building a system that works on modes that share a list of checks. If a check is successful (that means: the character is alphanumeric, a whitespace or special character or so) the check loop will break and a series of actions for this check will be executed. These actions include mode changes, buffering of the current character, mode stack operations for complex nested syntax and a bunch of other things. The algorithm generates an output string containing the buffered string chunks, mode and check - so whatever you want to parse, you get a list consisting of the stuff you allowed to be in it. There are a few things missing but there's enough time to add them, too. So finally there's something I can parse stuff with! I'm testing it with ini files right now and will continue to do some XML processing. Sorta uncomftable to define every mode and every char that's allowed, but thankfully C provide some cool character check functions to take care of this. That's also what I'm using to check plus two other custom checks for fixed strings and a list of possible characters. Works surprisingly well - a few will of course need some lexer work to be right. So that's it right now. Nothing fancy, I just didn't have the time or interest to post stuff at all. But I'll eventually need to so I guess...

No comments: