{"id":26449409,"url":"https://github.com/fab13n/metalua","last_synced_at":"2025-04-09T06:10:23.825Z","repository":{"id":43703148,"uuid":"83639","full_name":"fab13n/metalua","owner":"fab13n","description":"The metalua programming language","archived":false,"fork":false,"pushed_at":"2024-01-16T11:00:29.000Z","size":4217,"stargazers_count":351,"open_issues_count":19,"forks_count":60,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-02T02:14:38.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://metalua.luaforge.net","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fab13n.png","metadata":{"files":{"readme":"README-compiler.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":"2008-12-02T12:18:17.000Z","updated_at":"2025-01-09T07:32:30.000Z","dependencies_parsed_at":"2024-05-01T20:56:30.102Z","dependency_job_id":null,"html_url":"https://github.com/fab13n/metalua","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab13n%2Fmetalua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab13n%2Fmetalua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab13n%2Fmetalua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab13n%2Fmetalua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fab13n","download_url":"https://codeload.github.com/fab13n/metalua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"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":"2025-03-18T14:55:38.674Z","updated_at":"2025-04-09T06:10:23.807Z","avatar_url":"https://github.com/fab13n.png","language":"Lua","funding_links":[],"categories":["资源","Resources"],"sub_categories":["Analysis Tools and ASTs","Lua 5.1"],"readme":"Metalua Compiler\n================\n\n## Metalua compiler\n\nThis module `metalua-compiler` depends on `metalua-parser`. Its main\nfeature is to compile ASTs into Lua 5.1 bytecode, allowing to convert\nthem into bytecode files and executable functions. This opens the\nfollowing possibilities:\n\n* compiler objects generated with `require 'metalua.compiler'.new()`\n  support methods `:xxx_to_function()` and `:xxx_to_bytecode()`;\n\n* Compile-time meta-programming: use of `-{...}` splices in source\n  code, to generate code during compilation;\n\n* Some syntax extensions, such as structural pattern matching and\n  lists by comprehension;\n\n* Some AST manipulation facilities such as `treequery`, which are\n  implemented with Metalua syntax extensions.\n\n## What's new in Metalua 0.7\n\nThis is a major overhaul of the compiler's architecture. Some of the\nmost noteworthy changes are:\n\n* No more installation or bootstrap script. Some Metalua source files\n  have been rewritten in plain Lua, and module sources have been\n  refactored, so that if you just drop the `metalua` folder somewhere\n  in your `LUA_PATH`, it works.\n\n* The compiler can be cut in two parts:\n\n  * a parser which generates ASTs out of Lua sources, and should be\n    either portable or easily ported to Lua 5.2;\n\n  * a compiler, which can turn sources and AST into executable\n    Lua 5.1 bytecode and run it. It also supports compile-time\n    meta-programming, i.e. code included between `-{ ... }` is\n    executed during compilation, and the ASTs it produces are\n    included in the resulting bytecode.\n\n* Both parts are packaged as separate LuaRocks, `metalua-parser` and\n  `metalua-compiler` respectively, so that you can install the former\n  without the latter.\n\n* The parser is not a unique object anymore. Instead,\n  `require \"metalua.compiler\".new()` returns a different compiler\n  instance every time it's called. Compiler instances can be reused on\n  as many source files as wanted, but extending one instance's grammar\n  doesn't affect other compiler instances.\n\n* Included standard library has been shed. There are too many standard\n  libs in Lua, and none of them is standard enough, offering\n  yet-another-one, coupled with a specific compiler can only add to\n  confusion.\n\n* Many syntax extensions, which either were arguably more code samples\n  than actual production-ready tools, or relied too heavily on the\n  removed runtime standard libraries, have been removed.\n\n* The remaining libraries and samples are:\n\n  * `metalua.compiler` converts sources into ASTs, bytecode,\n    functions, and ASTs back into sources.\n\n  * `metalua` compiles and/or executes files from the command line,\n    can start an interactive REPL session.\n\n  * `metalua.loader` adds a package loader which allows to use modules\n    written in Metalua, even from a plain Lua program.\n\n  * `metalua.treequery` is an advanced DSL allowing to search ASTs in\n    a smart way, e.g. \"_search `return` statements which return a\n    `local` variable but aren't in a nested `function`_\".\n\n  * `metalua.extension.comprehension` is a language extension which\n    supports lists by comprehension\n    (`even = { i for i=1, 100 if i%2==0 }`) and improved loops\n    (`for i=1, 10 for j=1,10 if i~=j do print(i,j) end`).\n\n  * `metalua.extension.match` is a language extension which offers\n    Haskell/ML structural pattern matching\n    (``match AST with `Function{ args, body } -\u003e ... | `Number{ 0 } -\u003e ...end``)\n\n   * **TODO Move basic extensions in a separate module.**\n\n* To remove the compilation speed penalty associated with\n  metaprogramming, when environment variable `LUA_MCACHE` or Lua\n  variable `package.mcache` is defined and LuaFileSystem is available,\n  the results of Metalua source compilations is cached. Unless the\n  source file is more recent than the latest cached bytecode file, the\n  latter is loaded instead of the former.\n\n* The Luarock install for the full compiler lists dependencies towards\n  Readline, LuaFileSytem, and Alt-Getopts. Those projects are\n  optional, but having them automatically installed by LuaRocks offers\n  a better user experience.\n\n* The license has changed from MIT to double license MIT + EPL. This\n  has been done in order to provide the IP guarantees expected by the\n  Eclipse Foundation, to include Metalua in Eclipse's\n  [Lua Development Tools](http://www.eclipse.org/koneki/ldt/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffab13n%2Fmetalua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffab13n%2Fmetalua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffab13n%2Fmetalua/lists"}