{"id":16603357,"url":"https://github.com/dbrgn/pycoolc","last_synced_at":"2025-03-09T17:36:28.270Z","repository":{"id":6219989,"uuid":"7451336","full_name":"dbrgn/pycoolc","owner":"dbrgn","description":"A compiler for the \"cool\" language (http://theory.stanford.edu/~aiken/software/cool/cool.html) written in Python.","archived":false,"fork":false,"pushed_at":"2013-01-15T00:49:34.000Z","size":236,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-06T08:51:06.742Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"wakaleo/game-of-life","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbrgn.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-05T03:56:25.000Z","updated_at":"2019-12-27T10:21:47.000Z","dependencies_parsed_at":"2022-07-30T16:18:46.408Z","dependency_job_id":null,"html_url":"https://github.com/dbrgn/pycoolc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fpycoolc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fpycoolc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fpycoolc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fpycoolc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbrgn","download_url":"https://codeload.github.com/dbrgn/pycoolc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242729418,"owners_count":20175943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T00:49:39.885Z","updated_at":"2025-03-09T17:36:28.248Z","avatar_url":"https://github.com/dbrgn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pycoolc\n=======\n\n.. image:: https://secure.travis-ci.org/dbrgn/pycoolc.png?branch=master\n    :alt: Build status\n    :target: http://travis-ci.org/dbrgn/pycoolc\n\nA `cool`_ compiler written in Python 3 using `PLY`_.\n\nCool reference manual: `http://s.dbrgn.ch/4JrI \u003chttp://s.dbrgn.ch/4JrI\u003e`__ (PDF).\n\n\nProject status\n--------------\n\nAlready implemented:\n\n* Lexer\n* Parser\n* AST generation\n\nNot yet done:\n\n* Code generation\n* Optimizations\n\n\nUsage\n-----\n\nRun lexer::\n\n    python3 -m pycoolc.lexer path/to/sourcefile.cl\n\nRun parser::\n\n    python3 -m pycoolc.parser path/to/sourcefile.cl\n\nUse parser in your code:\n\n.. sourcecode:: python\n\n    \u003e\u003e\u003e from pycoolc.parser import yacc\n    \u003e\u003e\u003e yacc.parse('class Main {};')\n    (Type(name='Main', inherits=None, features=()),)\n\n\nAST\n---\n\nThe abstract syntax tree is composed of ``tuple``\\ s and ``namedtuple``\\ s.  As\nan example, parsing ``example/complex2.cl`` currently results in an AST like\nthis:\n\n.. sourcecode:: python\n\n    (\n      Type(\n        name='Silly'\n        inherits=None\n        features=(\n          Method(\n            name='copy'\n            type='SELF_TYPE'\n            formals=()\n            expr='self'\n          )\n        )\n      )\n      Type(\n        name='Sally'\n        inherits='Silly'\n        features=()\n      )\n      Type(\n        name='Main'\n        inherits=None\n        features=(\n          Attribute(\n            name='x'\n            type='Sally'\n            expr=MethodCall(\n              object=New(\n                type='Sally'\n              )\n              method='copy'\n              params=()\n            )\n          )\n          Attribute(\n            name='y'\n            type='Int'\n            expr=BinaryOperation(\n              operator='-'\n              left=12\n              right=9\n            )\n          )\n          Attribute(\n            name='z'\n            type='Int'\n            expr=If(\n              condition=BinaryOperation(\n                operator='\u003c='\n                left='y'\n                right=42\n              )\n              true=BinaryOperation(\n                operator='+'\n                left=BinaryOperation(\n                  operator='*'\n                  left=5\n                  right=3\n                )\n                right=2\n              )\n              false=0\n            )\n          )\n          Method(\n            name='main'\n            type='Sally'\n            formals=()\n            expr='x'\n          )\n        )\n      )\n    )\n\n\nTesting\n-------\n\nMake sure you have installed nose::\n\n    pip install nose\n\nThen just run the nose on the tests directory::\n\n    nosetests tests\n\n\nLicense\n-------\n\nLicense: GPLv3, see ``LICENSE`` file.\n\n\n\n.. _cool: http://theory.stanford.edu/~aiken/software/cool/cool.html\n.. _ply: http://www.dabeaz.com/ply/ \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fpycoolc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbrgn%2Fpycoolc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fpycoolc/lists"}