12.05.2011

Prolog-inspired string matching

Beeing a bit picky about what to program after that sort of half success I had yesterday, I got somehow interested in my Prolog lectures and realized that it might become more interesting from today on. We finally got those parts making the language itself more useful while throwing some more normal programming language elements not beeing tracked all the time. And by "track" I actually mean that the method of backtracking went to it's full power in head. I noticed how I'd be able to use backtracking to create any kind of binary of text parser since regular expresion would, in theory, also need backtracking to fully match. Furthermore, I could use backtracking for any not time-critical task that requires a certain amount of complex scanning and collecting of data. Whole can be written with it when applying the concepts Prolog used (though only the track-on-true-backtrack-on-false stuff should be used in combination with normal programming language features. So yeah, I'm digging the concept. Until I feel myself comftable enough with threads again, I'll create a macro-based tracking/backtracking system for all kind of things and data types. It's a good task to do while distracting myself with Minecraft and a copy of Dead Island (well, only if I get it early enough). I hope that this method will expand my code arsenal by a deadly weapon to use for everything where it could replace horribly much amount of code or brain spaghetti - simply by tackling a problem differently than with a solution that you can't figure out in your head completely. Sometimes this happens to me.

No comments: