Re: [logs] Re: Generic Log Message Parsing Tool

From: Sweth Chandramouli (loganalysisat_private)
Date: Wed Jun 05 2002 - 10:11:05 PDT

  • Next message: Sweth Chandramouli: "Re: [logs] Re: Generic Log Message Parsing Tool"

    On Wed, Jun 05, 2002 at 09:45:29AM -0400, Marcus J. Ranum wrote:
    > Sweth Chandramouli wrote:
    > >Marcus was doing his
    > >version in C, which for performance reasons makes a lot of sense
    > 
    > :) I was doing it in C because it's the only programming language
    > I know. :) It wasn't for performance reasons!!!
    	Understood.  I was just saying that you were using C, and
    that independent of that, I thought that the use of C would make sense
    in the long run for performance reasons. :)
    
    > Lex/Yacc produce static parsers. They're compiler/parser generators
    > and I think you'd be taking the wrong approach to use them. What I'd
    > suggest is developing a subset of a BNF grammar
    	A Parse::RecDescent grammar in Perl is almost exactly that.
    Case in point, here's a quick P::RD grammar I came up with the other day
    to parse shell globbing syntax:
    
          globstring:         token(s)
          token:              metastring | globchar | literal
          metastring:         escaped_char | character_class
          escaped_char:       /\\./
          character_class:    openbracket
                              [ negation | internal_bracket ]
                              class_token(s)
                              closebracket
          openbracket:        /\[/
          negation:           /!/
          internal_bracket:   /[][]/
          class_token:        escaped_char | character_range | class_char
          character_range:    /.-./
          class_char:         /[^]]/
          closebracket:       /]/
          globchar:           asterisk | questionmark
          asterisk:           '*'
          questionmark:       '?'
          literal:            /./
    
    	.  No left recursion, which I think you were worried about
    in a different post, and the regexes could just as easily be replaced
    with string matches if you really wanted to; I'll address the concerns
    about regexes in another post, however.  :)
    
    	-- Sweth.
    
    -- 
    Sweth Chandramouli      Idiopathic Systems Consulting
    svcat_private      http://www.idiopathic.net/
    
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: loganalysis-unsubscribeat_private
    For additional commands, e-mail: loganalysis-helpat_private
    



    This archive was generated by hypermail 2b30 : Wed Jun 05 2002 - 10:56:10 PDT