> > Guido van Rossum wrote: > > Before we all start writing nannies and checkers, how about a standard > > API design first? > Moshe Zadka wrote: > Here's a strawman API: > There's a package called Nanny > Every module in that package should have a function called check_ast. > It's argument is an AST object, and it's output should be a list > of three-tuples: (line-number, error-message, None) or > (line-number, error-message, (column-begin, column-end)) (each tuple can > be a different form). Greg Wilson wrote: The SUIF (Stanford University Intermediate Format) group has been working on an extensible compiler framework for about ten years now. The framework is based on an extensible AST spec; anyone can plug in a new analysis or optimization algorithm by writing one or more modules that read and write decorated ASTs. (See http://suif.stanford.edu for more information.) Based on their experience, I'd suggest that every nanny take an AST as an argument, and add complaints in place as decorations to the nodes. A terminal nanny could then collect these and display them to the user. I think this architecture will make it simpler to write meta-nannies. I'd further suggest that the AST be something that can be manipulated through DOM, since (a) it's designed for tree-crunching, (b) it's already documented reasonably well, (c) it'll save us re-inventing a wheel, and (d) generating human-readable output in a variety of customizable formats ought to be simple (well, simpler than the alternatives). Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4