{ "info": { "author": "Jared Forsyth", "author_email": "jared@jaredforsyth.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python" ], "description": "CodeTalker\n==========\n\n.. image:: https://travis-ci.org/jabapyth/codetalker.png?branch=master\n :target: https://travis-ci.org/jabapyth/codetalker\n\nCodetalker has just undergone major revision! :D\n\nThe goal of code talker is to allow for speedy development of parsers +\ntranslators without compromizing performance or flexibility.\n\nFeatures:\n\n- Completely python-based grammar definitions `[example grammar]\n `_\n- Fast (cythonized) tokenizing and parsing\n\n...what more do you need?\n\nHere's the process:\n\n:tokenize: `produce a list of tokens`\n\n If you use the builtin tokens, you can get full c performance, and\n if you need a bit more flexibility, you can define your own token - either\n based on ReToken or StringToken\n\n:parse: `produce a ParseTree`\n\n The parse tree corresponds exactly to your rules + original tokens;\n calling str(tree) returns *the exact orignal code*. Including whitespace,\n comments, etc. This step is perfect of you want to make some automated\n modifications to your code (say, prettyfication), but don't want to\n completely throw out your whitespace and comments.\n\n:Abstract Syntax Tree: `parsetree -> ast` http://docs.python.org/library/ast.html\n\n An AST is used if you only care about the syntax -- whitespace, etc.\n doesn't matter. This the case during compilation or in some cases\n introspection. I've modeled Codetalker's AST implementation after that of\n python. Codetalker does the ParseTree -> AST conversion for you; you just\n tell it how to populate your tree, base on a given node's children.\n\n:Translate:\n\n Once you get the AST, you want to do something with it, right? Most often\n it's \"traverse the tree and do something with each node, depending on it's\n type\". Here's where the `Translator\n `_\n class comes in. It provied a nice easy interface to systematically\n translate an AST into whatever you want. `Here's an example\n `_\n of creating and filling out a Translator.\n\nFor more info, check out my announcing blog post: `Announcing: CodeTalker\n`_.\n\nHere's the JSON grammar::\n\n # some custom tokens\n class SYMBOL(ReToken):\n rx = re.compile('[{},[\\\\]:]')\n\n class TFN(ReToken):\n rx = re.compile('true|false|null')\n\n # rules (value is the start rule)\n def value(rule):\n rule | dict_ | list_ | STRING | TFN | NUMBER\n rule.pass_single = True\n\n def dict_(rule):\n rule | ('{', [commas((STRING, ':', value))], '}')\n rule.astAttrs = {'keys': STRING, 'values': value}\n dict_.astName = 'Dict'\n\n def list_(rule):\n rule | ('[', [commas(_or(dict_, list_, STRING, TFN, NUMBER))], ']')\n rule.astAttrs = {'values': [dict_, list_, STRING, TFN, NUMBER]}\n list_.astName = 'List'\n\n grammar = Grammar(start=value,\n tokens=[STRING, NUMBER, NEWLINE, WHITE, SYMBOL, TFN],\n ignore=[WHITE, NEWLINE], # we don't care about whitespace...\n ast_tokens=[STRING, TFN, NUMBER]) # tokens we want picked up in the Abstract Syntax Tree\n\nTodo\n====\n\n- modify codetalker to allow for streamed input", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/jabapyth/codetalker/tree", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://jaredforsyth.com/projects/codetalker/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "CodeTalker", "package_url": "https://pypi.org/project/CodeTalker/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/CodeTalker/", "project_urls": { "Download": "http://github.com/jabapyth/codetalker/tree", "Homepage": "http://jaredforsyth.com/projects/codetalker/" }, "release_url": "https://pypi.org/project/CodeTalker/1.1/", "requires_dist": null, "requires_python": null, "summary": "a module for dynamic, pythonic language parsing", "version": "1.1" }, "last_serial": 1035647, "releases": { "0.5": [ { "comment_text": "", "digests": { "md5": "d610fe9aaaf13fc4e0dc983b01e42047", "sha256": "c86bf8d038e06e01f3d16f8da9cb796fbd0f2edda08bc8344d4ce6af4e0b1c25" }, "downloads": -1, "filename": "CodeTalker-0.5.tar.gz", "has_sig": false, "md5_digest": "d610fe9aaaf13fc4e0dc983b01e42047", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 137733, "upload_time": "2010-07-15T15:31:39", "url": "https://files.pythonhosted.org/packages/4d/b5/54ea1c4650d560ac0e53c27d531bff66faa439fb2cf4cfb005b508d7f001/CodeTalker-0.5.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "33b46b0c5d4cf234322627cd3af03c84", "sha256": "0d3d22c177df7c364834cd90e4a3c7004df342782e52975133445474e6aca19c" }, "downloads": -1, "filename": "CodeTalker-1.0.tar.gz", "has_sig": false, "md5_digest": "33b46b0c5d4cf234322627cd3af03c84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 85633, "upload_time": "2010-07-27T19:33:08", "url": "https://files.pythonhosted.org/packages/03/f7/77314c31542f4f060455d9952c261751c75b4dadb9e21ead4da0de76cfc6/CodeTalker-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "5941b9c4ceb472ebb4703b7be4167d0c", "sha256": "e9365c16334fb98c5c1e071d90231e26185a867bc48602ae05af9fad74cb9c71" }, "downloads": -1, "filename": "CodeTalker-1.1.tar.gz", "has_sig": false, "md5_digest": "5941b9c4ceb472ebb4703b7be4167d0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 98648, "upload_time": "2014-03-19T23:35:42", "url": "https://files.pythonhosted.org/packages/49/76/92da540652b970af946049b6c48063416b1c0ebb4554de0487b45e77de7b/CodeTalker-1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5941b9c4ceb472ebb4703b7be4167d0c", "sha256": "e9365c16334fb98c5c1e071d90231e26185a867bc48602ae05af9fad74cb9c71" }, "downloads": -1, "filename": "CodeTalker-1.1.tar.gz", "has_sig": false, "md5_digest": "5941b9c4ceb472ebb4703b7be4167d0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 98648, "upload_time": "2014-03-19T23:35:42", "url": "https://files.pythonhosted.org/packages/49/76/92da540652b970af946049b6c48063416b1c0ebb4554de0487b45e77de7b/CodeTalker-1.1.tar.gz" } ] }