Is there any lib/module I could use for data parsing?
I has some data format that the grammar is known (quite simple actually),
but
I need to write some function/API such that I could read the data and
reformat
(to XML maybe), dump it into database, and recall those data easily in the
future.
I think I need to write a parser but had little experience. I had looked up
Lex and Yacc, or bison, with some little time I play, I know I could get
promising result, but I want it written in Perl instead of C.
With almost no knowledge on the parsing heuristic/algorithm,
I actually painfully wrote a parser using tons of matching statement and
achieved some partial success. However, the more I drilled into details,
the harder it seems. Playing with regular expression to do EXACTLY what
I really want is taking a lot of my time to rethink if I had the right
approach.
The developing time of writing an regular expression is exponentially
proportional to its complexity, well, at least to me.
One thing made me hesistate to go any further in my current approach is
the future support. No matter how well I comment my code, and with
good note taking habit on new things I learned, I tend to forget some
scriplet I wrote just weeks ago.
It will be painful to be supported by another person in the future with
little Perl exp.
Yeah, I knew Perl is a cryptic language, but Perl does so good on pattern
matching that hard to beat. I try to avoid add any more obscurity.
I had checked some XML stuff but seem not finding anything useful,
although I had quite a strong belief there must be something, considering
there must be large amount of existing data out there in the world
need to be parsed and convert to XML in order to take advantage
of the technology.
Joseph Pang