documenting PLYed parsers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maurice LING

    #1

    documenting PLYed parsers

    Hi,

    I am using PLY (Python-Lex-Yacc) to write my parsers. However, it seems
    to me that PLY is using comments (especially multiline comments) in the
    Yacc component such as

    def p_expression(p) :
    '''expression : term PLUS term'''
    ....

    So I was thinking about how can I document my codes, which can be
    processed by epydoc or happydoc? Will my comments, enclosed by ''',
    interferes with PLY?

    Any comments?

    Thanks
    Maurice
  • Diez B. Roggisch

    #2
    Re: documenting PLYed parsers

    Maurice LING wrote:
    [color=blue]
    > Hi,
    >
    > I am using PLY (Python-Lex-Yacc) to write my parsers. However, it seems
    > to me that PLY is using comments (especially multiline comments) in the
    > Yacc component such as
    >
    > def p_expression(p) :
    > '''expression : term PLUS term'''
    > ...
    >
    > So I was thinking about how can I document my codes, which can be
    > processed by epydoc or happydoc? Will my comments, enclosed by ''',
    > interferes with PLY?
    >
    > Any comments?[/color]

    How about trying it? I use spark, which utilizes comment strings, too - but
    as it simply loops over the comment lines and tries to use them as grammar
    rules without bailing out if a line isn't a grammar rule, I can happily put
    comments in there.

    And after all, you don't need to comment using the doc-string, you can use
    #. And I personally believe that a parser doesn't need to be
    api-documented on every grammar rule, so you don't lose anything here.
    --
    Regards,

    Diez B. Roggisch

    Comment

    • Istvan Albert

      #3
      Re: documenting PLYed parsers

      Maurice LING wrote:

      [color=blue]
      > So I was thinking about how can I document my codes, which can be
      > processed by epydoc or happydoc? Will my comments, enclosed by ''',
      > interferes with PLY?[/color]

      You could also use pythondoc that uses
      comments that are listed before a function
      defintion (the java way).



      Istvan.

      Comment

      Working...