{"id":23359869,"url":"https://github.com/markmll/tree-meta","last_synced_at":"2025-04-07T20:46:49.572Z","repository":{"id":266043607,"uuid":"896957404","full_name":"MarkMLl/TREE-META","owner":"MarkMLl","description":"This is a verbatim copy of the implementation formerly at https://github.com/lugon/TREE-META","archived":false,"fork":false,"pushed_at":"2025-03-04T13:19:54.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T14:22:56.212Z","etag":null,"topics":["compiler-compiler","compiler-generator","meta-compiler"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarkMLl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-01T18:05:59.000Z","updated_at":"2025-03-04T13:50:51.000Z","dependencies_parsed_at":"2024-12-02T09:25:44.279Z","dependency_job_id":"26f9e7cf-f6e8-4f2e-8d6f-2574adcfe830","html_url":"https://github.com/MarkMLl/TREE-META","commit_stats":null,"previous_names":["markmll/tree-meta"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMLl%2FTREE-META","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMLl%2FTREE-META/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMLl%2FTREE-META/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMLl%2FTREE-META/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkMLl","download_url":"https://codeload.github.com/MarkMLl/TREE-META/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247729485,"owners_count":20986392,"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":["compiler-compiler","compiler-generator","meta-compiler"],"created_at":"2024-12-21T11:12:12.105Z","updated_at":"2025-04-07T20:46:49.243Z","avatar_url":"https://github.com/MarkMLl.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Provenance\n\nBetween December 1st 2024 and March 4th 2025 this was a placeholder for a copy of the implementation originally at https://github.com/lugon/TREE-META, with no other content.\n\nThe original author deleted his repository, and I believed that I had accidentally deleted the copy which I had downloaded. I find, however, that I still have it.\n\nHowever the files have no definite indication of authorship, no expression of copyright, and no attached license.\n\nDespite indicating here and on the Wikipedia talk page https://en.wikipedia.org/wiki/Talk:TREE-META#Example_implementation_sources that I intended to republish the files, and attempting to contact the author via his only other project on Github (which is empty), I have received no indication of an objection.\n\nI have applied GPL v3 to this repository, since I believe that it is the best way to protect the original author's rights. If anybody can \"show cause\" that this is inappropriate, please raise it as an issue.\n\nShare and enjoy. MarkMLl.\n\n## Description\n\nThis is an implementation of the [TREE-META](https://en.wikipedia.org/wiki/TREE-META)\ncompiler writing system. This version is based on the version of TREE-META for the\nICL 1900 described in [this manual][1].\n\n## Getting started\n\nAfter executing `make` in the base directory you should get `tmc` and `tmm`.\n\n`tmc` will use a program written in TREE-META to translate a program in the\nobject language. For example, if we have the description of a compiler for\nlanguage X in the file `X.tm` and a program written in language X that we wish\nto compile in the file `foo.X`, then the following\n\n    $ ./tmc X.tm foo.X\n\nwill use `X.tm` to compile `foo.X` and output the result to `stdout`.\n\n`tmm` is the TREE-META equivalent of the [META II machine][3]. It reads and executes\nprograms written in its assembly language. It is used to bootstrap the system.\n\n## Bootstrapping\n\nThe TREE-META compiler can be written in its own language. The file [treemeta.tm](treemeta.tm)\nis a TREE-META program that describes a TREE-META compiler. This compiler translates\nTREE-META programs into assembly language for the TREE-META machine (`tmm`).\nThe bootstrapping process is as follows (this is what the `meta` target of the makefile does):\n\n    $ ./tmc treemeta.tm treemeta.tm \u003etreemeta1.tmm\n    $ ./tmm treemeta1.tmm treemeta.tm \u003etreemeta2.tmm\n    $ cmp treemeta1.tmm treemeta2.tmm  #should succeed, meaning we reached a fixed point\n\nNote that above we \"cheated\" by already having a compiler to start with (`tmc`).\nWe used `tmc` to get a compiled version of `treemeta.tm`. Alternatively, we would\nhave to first somehow (by hand, for example) translate `treemeta.tm` into assembly.\n\n## Differences and extensions\n\nThere are some differences with respect to the version of TREE-META described in\n[the manual][1].\n\nThe arithmetic expressions recognized are similar in syntax and precedence/associativity\nto the ones found in the C language. Signed and unsigned arithmetic is supported\nthrough the introduction of new operators. See the annotated grammar at [grammar.txt](grammar.txt)\nfor precise details on the syntax recognized.\n\nC style comments (`/*...*/`) are automatically recognized in TREE-META programs\nand in the input those programs read. They can appear anywhere whitespace can appear.\n\nThe stack used for tree-building is cleared after code generation (initiated by `*`).\nThe top tree will be processed and everything below will be lost. Generally this\nis not a problem because a single tree is passed to the code generation phase.\nCode generation must be initiated only from the main syntax rule (the one named\nafter `.META`).\n\nDumping of trees in DOT format is supported. After building a tree you can use\n`**` instead of `*` to cause the generation of a DOT description of the top tree.\nYou can render the result with [Graphviz](http://www.graphviz.org/) (you can\ndo it online [here](http://www.webgraphviz.com/) without installing anything).\nHere is an example:\n\n    $ cat expr.tm\n    .META PR\n    PR = EXPRESSION ** ;\n    EXPRESSION = TERM $('+' TERM :ADD[2] / '-' TERM :SUB[2]) ;\n    TERM = FACTOR $('*' FACTOR :MULT[2] / '/' FACTOR :DIV[2]) ;\n    FACTOR = '+' PRIMARY / '-' PRIMARY :MIN[1] / PRIMARY ;\n    PRIMARY = .ID / .NUM / '(' EXPRESSION ')' ;\n    ADD /=\u003e .EMPTY ;\n    SUB /=\u003e .EMPTY ;\n    MIN /=\u003e .EMPTY ;\n    MULT /=\u003e .EMPTY ;\n    DIV /=\u003e .EMPTY ;\n    .END\n    $ cat expr.sr\n    X/2+Y*(Z-7)\n    $ ./tmc expr.tm expr.sr \u003eexpr.dot\n    $ dot -Tpng expr.dot -o expr.png\n\nand the result:\n\n![expr example](res/expr.png)\n\n## References \u0026 History\n\n - [Manual for ICL 1900 version of TREE-META by F R A Hopgood][1]\n - [A TREE META for the XDS 940 by J. F. Rulifson][2]\n - [META II A SYNTAX-ORIENTED COMPILER WRITING LANGUAGE by Dewey Val Schorre][3]\n - [The Tree-Meta Compiler-Compiler System: A Meta Compiler System for the Univac 1108 and the General Electric 645][4]\n - [Jeff Rulifson discussing Tree Meta at \"The Mother of All Demos\" (Clip 18)][5]\n - [The Mother of All Demos (1968)(Complete video) (the above clip is from around minute 53)][6]\n - [The programming languages behind \"the mother of all demos\"][7]\n - [Tree Meta in the On-Line System (NLS)][8]\n - Alan Kay about Tree Meta, [here][9] and [here][10]\n\n[1]: http://www.chilton-computing.org.uk/acl/literature/manuals/tree-meta/contents.htm\n[2]: http://bitsavers.org/pdf/sri/arc/rulifson/A_Tree_Meta_For_The_XDS_940_Appendix_D_Apr68.pdf\n[3]: http://www.ibm-1401.info/Meta-II-schorre.pdf\n[4]: https://ntrl.ntis.gov/NTRL/dashboard/searchResults/titleDetail/AD855122.xhtml\n[5]: http://web.stanford.edu/dept/SUL/library/extra4/sloan/mousesite/1968Demo.html\n[6]: https://www.youtube.com/watch?v=yJDv-zdhzMY\n[7]: http://lambda-the-ultimate.org/node/3122\n[8]: http://www.dougengelbart.org/pubs/augment-3954.html#4d\n[9]: https://en.wikipedia.org/wiki/Talk:TREE-META#Corrections\n[10]: http://ibm-1401.info/OtherStories.html#01/09/2013\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmll%2Ftree-meta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkmll%2Ftree-meta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmll%2Ftree-meta/lists"}