documenting PLYed parsers

M

Maurice LING

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
 
D

Diez B. Roggisch

Maurice said:
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?

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top