{ "info": { "author": "Rich Wareham", "author_email": "rich.rbc@richwareham.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development :: Code Generators", "Topic :: Software Development :: Compilers" ], "description": "Rich's B Compiler\n=================\n\n.. image:: https://travis-ci.org/rjw57/rbc.svg?branch=master\n :target: https://travis-ci.org/rjw57/rbc\n\nThis repository contains my experimental B compiler written as a Christmas\nvacation project 2015.\n\nInstallation and getting started\n--------------------------------\n\nThe llvmlite bindings require (as of writing) LLVM version 3.6. Make sure to set\nthe LLVM_CONFIG environment variable appropriately.\n\nOn Debian/Ubuntu-like Linuxes::\n\n $ sudo apt install libedit-dev llvm-dev-3.6\n $ export LLVM_CONFIG=llvm-config-3.6\n\nOn OSX::\n\n $ brew install llvm\n $ export LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config\n\nThen install via pip::\n\n $ pip install git+https://github.com/rjw57/rbc\n\nDevelopers may manually clone the repository if they want::\n\n $ git clone git://github.com/rjw57/rbc\n $ cd /path/to/rbc; pip install -e .\n\nB code can then be compiled via the ``rbc`` tool::\n\n $ echo 'main(){ extrn putstr; putstr(\"hello!*n\"); }' >greet.b\n $ rbc -o greet greet.b\n $ ./greet\n hello!\n\nExamples\n--------\n\nCalculating *e*\n'''''''''''''''\n\nThe following example is taken from a B tutorial::\n\n /* calce.b:\n The following program will calculate the constant e-2 to about\n 4000 decimal digits, and print it 50 characters to the line in\n groups of 5 characters. The method is simple output conversion\n of the expansion\n 1/2! + 1/3! + ... = .111....\n where the bases of the digits are 2, 3, 4, . . . */\n\n main() {\n extrn putchar, n, v;\n auto i, c, col, a;\n\n i = col = 0;\n while(ifact.b\n $ rbc --emit-llvm -s fact.b\n $ cat fact.ll\n ; ModuleID = 'fact.b'\n target datalayout = \"e-m:e-i64:64-f80:128-n8:16:32:64-S128\"\n target triple = \"x86_64-pc-linux-gnu\"\n\n ; Function Attrs: nounwind readnone\n define i64 @b.fact(i64 %n) #0 {\n entry:\n %.71 = icmp eq i64 %n, 0\n br i1 %.71, label %entry.endif, label %entry.else.preheader\n\n entry.else.preheader: ; preds = %entry\n br label %entry.else\n\n entry.else: ; preds = %entry.else.preheader, %entry.else\n %n.tr3 = phi i64 [ %.20, %entry.else ], [ %n, %entry.else.preheader ]\n %accumulator.tr2 = phi i64 [ %.22, %entry.else ], [ 1, %entry.else.preheader ]\n %.20 = add i64 %n.tr3, -1\n %.22 = mul i64 %n.tr3, %accumulator.tr2\n %.7 = icmp eq i64 %.20, 0\n br i1 %.7, label %entry.endif.loopexit, label %entry.else\n\n entry.endif.loopexit: ; preds = %entry.else\n %.22.lcssa = phi i64 [ %.22, %entry.else ]\n br label %entry.endif\n\n entry.endif: ; preds = %entry.endif.loopexit, %entry\n %accumulator.tr.lcssa = phi i64 [ 1, %entry ], [ %.22.lcssa, %entry.endif.loopexit ]\n ret i64 %accumulator.tr.lcssa\n }\n\n attributes #0 = { nounwind readnone }\n\nNotice that the recursive ``fact`` function has been optimised into the\nequivalent looping version.\n\n", "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/rjw57/rbc", "keywords": "compiler B llvm example", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "rbc", "package_url": "https://pypi.org/project/rbc/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rbc/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rjw57/rbc" }, "release_url": "https://pypi.org/project/rbc/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Example B compiler written with LLVM", "version": "0.2.0" }, "last_serial": 1986294, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "c3437ae44e73e1ebd017f29bd6a11a3d", "sha256": "42f91cc0e714890e0c65b6ecf0fa369588afaf2c8127ab5fadee950e31814d5d" }, "downloads": -1, "filename": "rbc-0.2.0.tar.gz", "has_sig": false, "md5_digest": "c3437ae44e73e1ebd017f29bd6a11a3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31738, "upload_time": "2016-03-02T19:46:22", "url": "https://files.pythonhosted.org/packages/39/32/7728b67861a3febb03b92896505413f910d8806cd4a6c5818d6329892297/rbc-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c3437ae44e73e1ebd017f29bd6a11a3d", "sha256": "42f91cc0e714890e0c65b6ecf0fa369588afaf2c8127ab5fadee950e31814d5d" }, "downloads": -1, "filename": "rbc-0.2.0.tar.gz", "has_sig": false, "md5_digest": "c3437ae44e73e1ebd017f29bd6a11a3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31738, "upload_time": "2016-03-02T19:46:22", "url": "https://files.pythonhosted.org/packages/39/32/7728b67861a3febb03b92896505413f910d8806cd4a6c5818d6329892297/rbc-0.2.0.tar.gz" } ] }