{"id":13759407,"url":"https://github.com/racket/zuo","last_synced_at":"2025-05-16T10:08:20.884Z","repository":{"id":41139043,"uuid":"480042309","full_name":"racket/zuo","owner":"racket","description":"A tiny Racket for scripting","archived":false,"fork":false,"pushed_at":"2025-03-25T12:23:52.000Z","size":491,"stargazers_count":288,"open_issues_count":1,"forks_count":31,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-12T08:16:04.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/racket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null},"funding":{"github":"racket"}},"created_at":"2022-04-10T14:29:23.000Z","updated_at":"2025-04-07T13:02:01.000Z","dependencies_parsed_at":"2023-02-01T04:15:50.090Z","dependency_job_id":"54438cfd-1e19-4f0c-b1a6-b04540b1454f","html_url":"https://github.com/racket/zuo","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racket%2Fzuo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racket%2Fzuo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racket%2Fzuo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racket%2Fzuo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/racket","download_url":"https://codeload.github.com/racket/zuo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082892,"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-08-03T13:00:52.592Z","updated_at":"2025-05-16T10:08:15.876Z","avatar_url":"https://github.com/racket.png","language":"C","funding_links":["https://github.com/sponsors/racket"],"categories":["C"],"sub_categories":[],"readme":"This is a mirror of the Zuo sources in the `racket/src/zuo` directory of\n[the Racket repository](https://github.com/racket/racket).\n\nZuo: A Tiny Racket for Scripting\n================================\n\nYou should use Racket to write scripts. But what if you need something\nmuch smaller than Racket for some reason — or what if you're trying\nto script a build of Racket itself? Zuo is a tiny Racket with\nprimitives for dealing with files and running processes, and it comes\nwith a `make`-like embedded DSL.\n\nZuo is a Racket variant in the sense that program files start with\n`#lang`, and the module path after `#lang` determines the parsing and\nexpansion of the file content. That's how the `make`-like DSL is\ndefined, and even the base Zuo language is defined by layers of\n`#lang`s. One of the early layers implements macros.\n\n\nSome Example Scripts\n--------------------\n\nSee [`local/hello.zuo`](local/hello.zuo),\n[`local/tree.zuo`](local/tree.zuo),\n[`local/image.zuo`](local/image.zuo), and\n[`build.zuo`](build.zuo).\n\n\nBuilding and Running Zuo\n------------------------\n\nCompile `zuo.c` with a C compiler. No additional files are needed,\nother than system and C library headers. No compiler flags should be\nneeded, although flags like `-o zuo` or `-O2` are a good idea.\n\nYou can also use `configure`, `make`, and `make install`, where `make`\ntargets mostly invoke a Zuo script after compiling `zuo.c`. If you\ndon't use `configure` but compile to `zuo` in the current directory,\nthen `./zuo build.zuo` and `./zuo build.zuo install` (omit the `./` on Windows)\nwill do the same thing as `make` and `make install` with a default\nconfiguration.\n\nThe Zuo executable runs only modules. If you run Zuo with no\ncommand-line arguments, then it loads `main.zuo`. Use the `-c`\nflag to provide module text as an argument. Otherwise, the first\nargument to Zuo is a file to run or a directory containing a\n`main.zuo` to run, and additional arguments are delivered to that Zuo\nprogram via the `runtime-env` procedure. Running the command\n`./zuo build install`, for example, runs the `build/main.zuo` program\nwith the argument `install`. Whatever initial script is run, if it has\na `main` submodule, that submodule is also run.\n\n\nLibrary Modules and Startup Performance\n---------------------------------------\n\nExcept for the built-in `zuo/kernel` language module, Zuo finds\nlanguages and modules through a collection of libraries. By default,\nZuo looks for a directory `lib` relative to the executable as the root\nof the library-collection tree. You can supply an alternate collection\npath with the `-X` command-line flag.\n\nYou can also create an instance of Zuo with a set of libraries\nembedded as a heap image. Embedding a heap image has two advantages:\n\n * No extra directory of library modules is necessary.\n\n * Zuo can start especially quickly, competitive with the fastest\n   command-line programs.\n\nThe `local/image.zuo` script generates a `.c` file that is a copy of\n`zuo.c` plus embedded modules. By default, the `zuo` module and its\ndependencies are included, but you can specify others with `++lib`. In\naddition, the default collection-root path is disabled in the\ngenerated copy, unless you supply `--keep-collects` to\n`local/image.zuo`.\n\nWhen you use `configure` and `make` or `./zuo build.zuo`, the default\nbuild target creates a `to-run/zuo` that embeds the `zuo` library, as\nwell as a `to-install/zuo` that has the right internal path to find\nother libraries after `make install` or `./zuo build.zuo install`.\n\nYou can use heap images without embedding. The `dump-heap-and-exit`\nZuo kernel primitive creates a heap image, and a `-B` or `--boot`\ncommand-line flag for Zuo uses the given boot image on startup. You\ncan also embed an image created with `dump-image-and-exit` by using\n`local/image.zuo` with the `--image` flag.\n\nA boot image is machine-independent, whether in a stand-alone file or\nembedded in `.c` source.\n\n\nCross Compiling\n---------------\n\nIf you use `./configure --host=...` to cross compile, then you will\nalso need to add something like `CC_FOR_BUILD=cc` as a `./configure`\nargument to specify the compiler for a `zuo` to use on the build\nmachine. If necessary, you can also specify `CFLAGS_FOR_BUILD`,\n`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`.\n\n\nEmbedding Zuo in Another Application\n------------------------------------\n\nZuo can be embedded in a larger application, with or without an\nembedded boot image. To support embedding, compile `zuo.c` or the\noutput of `local/image.zuo` with the `ZUO_EMBEDDED` preprocessor macro\ndefined (to anything); the `zuo.h` header will be used in that case,\nand `zuo.h` should also be used by the embedding application.\nDocumentation for the embedding API is provided as comments within\n`zuo.h`.\n\n\nMore Information\n----------------\n\nInstall the `zuo-doc` directory as a package in Racket to render the\ndocumentation there, or see\n[docs.racket-lang.org](https://docs.racket-lang.org/zuo/index.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fracket%2Fzuo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fracket%2Fzuo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fracket%2Fzuo/lists"}