Have you done any profiling to isolate the part(s) of the code where you burn up most of your time?
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, October 23, 2001 3:05 PM To: [EMAIL PROTECTED] Subject: [Boston.pm] parser [forwarded submission from a non-member address -- rjk] From: [EMAIL PROTECTED] Date: 23 Oct 2001 10:45:52 -0700 Subject: parser To: [EMAIL PROTECTED] Folks, I've written a parser that allows you to write your grammars in pure perl. After a couple of tweaks, I believe I have all the functionality in the module for a minimal parser. The problem is that it is slow. A simple grammar with about 20 rules parses about 160 lines per second. I don't know how to optimize perl, I'm only familiar with the functionality. if there is a speed-demon on the list, or a parser wizard on the list who would be willing to take a look at it and give me some direction for improvement, I'd be greatly appreciative. The code is at: http://www.cpan.org/modules/by-authors/id/G/GS/GSLONDON/ the module is Parse-Nibbler-1.04.tar.gz The code consists of a lexer that is 180 lines of perl, and a rule wrapper that is about 200 lines of perl. (lines, as in lines in a text file, not perl statements.) the rest of it is short little methods that provide bits of functionality, or define a grammar rule. I use method calls throughout, parser objects are hashes, and pretty much everything is stored in the hash. I also use a number of regular expressions, all of which may be part of the speed problem. I don't know. any help would be appreciated. Greg London
