Re: [Pyparsing] text grammar -- first rough
Brought to you by:
ptmcg
From: Paul M. <pt...@au...> - 2008-11-19 00:50:57
|
Ralph - Actually, spir/Denis is proposing a specialized form of BNF, which would be compilable into pyparsing constructs (I think that's where we left this idea last), probably using a pyparsing parser. I do agree, though, that writing up an actual example would be very instructive, both in conveying the concepts, and in actually testing the syntax out. How about this for a test structure, a log message: An integer message number Date/time timestamp Severity (Debug/Info/Warning/Error) Message everything up to the end of line Example: 10001 2008/11/18 12:34:56 Error A bad thing happened Use the syntax to name each field, each field in the date-timestamp, and convert the integers to actual integers and the date-timestamp into a datetime.datetime (that is a datetime object as imported from the Python datetime module). You can also look back on the examples I've posted over the past few years on comp.lang.python and use one of them. -- Paul -----Original Message----- From: Ralph Corderoy [mailto:ra...@in...] Sent: Tuesday, November 18, 2008 2:40 PM To: spir Cc: [pyParsing] Subject: Re: [Pyparsing] text grammar -- first rough Hi spir, I don't wish to discourage your using the list as a sounding board, but I for one would have more inclination to read in detail if there was an example at the top that contrasts how I'd have to write something now in PyParsing compared to the better way I could write it with your suggestions. Cheers, Ralph. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Pyparsing-users mailing list Pyp...@li... https://lists.sourceforge.net/lists/listinfo/pyparsing-users |