{ "info": { "author": "Giorgos Tzampanakis", "author_email": "giorgos.tzampanakis@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Topic :: Software Development :: Compilers" ], "description": "# aml\nAccounting Mini Language --- Small and simple expression language running on Python.\n\n`aml` is a very small programming language running on top of Python. `aml` is ideal for exposing a powerful but safe interface to users who need to define business rules but have no programming knowledge. In this respect `aml` is an alternative to cumbersome mouse-driven rule engine configurations.\n\nThe grammar and parser utilise the [pypeg2](http://fdik.org/pyPEG/) library which must be installed for aml to work.\n\nTo use `aml` the programmer creates a \"language instace\". Calling the compile function yields an object (essentially an AST). This object can then be evaluated directly using the evaluate function or translated to Python or SQL using the respective functions.\n\nSince the language is very simple, sufficient documentation can be given by example:\n\n\t>>> lang_instance = create_lang_instance()\n\t>>> lang_instance.aml_evaluate(lang_instance.aml_compile('1 = 1'))\n\tTrue\n\t>>> li = create_lang_instance()\n\t>>> c = li.aml_compile\n\t>>> e = li.aml_evaluate\n\t>>> p = li.aml_translate_python\n\t>>> s = li.aml_translate_sql\n\t>>> u = li.aml_suggest\n\t>>> e(c('1 = 0'))\n\tFalse\n\t>>> e(c('\"1\" = \"1\"'))\n\tTrue\n\t>>> e(c('(1=1)'))\n\tTrue\n\t>>> e(c('1 > 1'))\n\tFalse\n\t>>> e(c('not 1 > 1'))\n\tTrue\n\t>>> e(c('1 != 1'))\n\tFalse\n\t>>> e(c('-2 = -2'))\n\tTrue\n\t>>> eval(p(c('-2 = -2')))\n\tTrue\n\t>>> eval(p(c('null = null')))\n\tTrue\n\t>>> eval(p(c('1 = null')))\n\tFalse\n\t>>> e(c('\"foo\" = \"foo\"'))\n\tTrue\n\t>>> e(c('\"foo\" = \\\\'foo\\\\''))\n\tTrue\n\t>>> e(c('\"fo\\\\'o\" = \"fo\\\\'o\"'))\n\tTrue\n\t>>> e(c(\"'foo'\" + '=' + '\"foo\"'))\n\tTrue\n\t>>> li = create_lang_instance({'foo' : 1});\n\t>>> c = li.aml_compile\n\t>>> e = li.aml_evaluate\n\t>>> e(c('foo = 1'))\n\tTrue\n\t>>> li = create_lang_instance({'foo' : 1.00})\n\t>>> c = li.aml_compile\n\t>>> e = li.aml_evaluate\n\t>>> e(c('foo = 1'))\n\tTrue\n\t>>> li = create_lang_instance({'foo' : 2.24})\n\t>>> c = li.aml_compile\n\t>>> e = li.aml_evaluate\n\t>>> e(c('foo = 2.24'))\n\tTrue\n\t>>> li = create_lang_instance({'foo' : 'foo'})\n\t>>> c = li.aml_compile\n\t>>> e = li.aml_evaluate\n\t>>> e(c('foo = \"foo\"'))\n\tTrue\n\t>>> li = create_lang_instance()\n\t>>> c = li.aml_compile\n\t>>> p = li.aml_translate_python\n\t>>> s = li.aml_translate_sql\n\t>>> s(c('null = null'))\n\tu'null is null'\n\t>>> p(c('null = null'))\n\tu'None == None'\n\t>>> s(c('null != null'))\n\tu'null is not null'\n\t>>> p(c('null != null'))\n\tu'None != None'\n\t>>> s(c('5 != 3'))\n\tu'5 <> 3'\n\t>>> p(c('5 != 3'))\n\tu'5 != 3'\n\t>>> li = create_lang_instance({'foo' : 'bar', 'fo2' : 'ba2'})\n\t>>> c = li.aml_compile\n\t>>> p = li.aml_translate_python\n\t>>> e = li.aml_evaluate\n\t>>> u = li.aml_suggest\n\t>>> u('1 = fo')\n\t[u'fo2', u'foo']\n\t>>> u('1 = FO')\n\t[u'fo2', u'foo']\n\t>>> p(c('null = null'))\n\tu'None == None'\n\t>>> e(c('foo = \"bar\"'))\n\tTrue\n\t>>> e(c('fo2 = \"ba2\"'))\n\tTrue", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gtzampanakis/aml", "keywords": "programming,language,expression", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "amlang", "package_url": "https://pypi.org/project/amlang/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/amlang/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/gtzampanakis/aml" }, "release_url": "https://pypi.org/project/amlang/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "Small and simple expression language", "version": "1.0.0" }, "last_serial": 1980757, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "350947099a9fc1e7b2243d43320e61b4", "sha256": "ff2068028ea16e7ff98f64dd5554a533e3fd1f7815b116c3b0558f24e3a65e10" }, "downloads": -1, "filename": "amlang-1.0.0.tar.gz", "has_sig": false, "md5_digest": "350947099a9fc1e7b2243d43320e61b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4910, "upload_time": "2016-02-28T17:01:16", "url": "https://files.pythonhosted.org/packages/9f/88/1604cfe5b094274dd1840f28ff1e28576b29ea2f98d620ce577cc0b38268/amlang-1.0.0.tar.gz" }, { "comment_text": "", "digests": { "md5": "6f4d5a733add33ea31c8d95d1fe65c44", "sha256": "f97a298c09de398af8a1a9af58642a05c96ec691826b0ea95743de3a5fcf4ddb" }, "downloads": -1, "filename": "amlang-1.0.0.zip", "has_sig": false, "md5_digest": "6f4d5a733add33ea31c8d95d1fe65c44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6432, "upload_time": "2016-02-28T17:00:32", "url": "https://files.pythonhosted.org/packages/34/a2/1ea219e8b11d45477cdf16c75de826417125c0f548b506f083afc9bd5078/amlang-1.0.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "350947099a9fc1e7b2243d43320e61b4", "sha256": "ff2068028ea16e7ff98f64dd5554a533e3fd1f7815b116c3b0558f24e3a65e10" }, "downloads": -1, "filename": "amlang-1.0.0.tar.gz", "has_sig": false, "md5_digest": "350947099a9fc1e7b2243d43320e61b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4910, "upload_time": "2016-02-28T17:01:16", "url": "https://files.pythonhosted.org/packages/9f/88/1604cfe5b094274dd1840f28ff1e28576b29ea2f98d620ce577cc0b38268/amlang-1.0.0.tar.gz" }, { "comment_text": "", "digests": { "md5": "6f4d5a733add33ea31c8d95d1fe65c44", "sha256": "f97a298c09de398af8a1a9af58642a05c96ec691826b0ea95743de3a5fcf4ddb" }, "downloads": -1, "filename": "amlang-1.0.0.zip", "has_sig": false, "md5_digest": "6f4d5a733add33ea31c8d95d1fe65c44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6432, "upload_time": "2016-02-28T17:00:32", "url": "https://files.pythonhosted.org/packages/34/a2/1ea219e8b11d45477cdf16c75de826417125c0f548b506f083afc9bd5078/amlang-1.0.0.zip" } ] }