{"id":15403188,"url":"https://github.com/woodruffw/bindef","last_synced_at":"2025-04-16T05:56:08.371Z","repository":{"id":52406367,"uuid":"146110897","full_name":"woodruffw/bindef","owner":"woodruffw","description":"A DSL and command-line tool for generating binary files.","archived":false,"fork":false,"pushed_at":"2021-04-29T22:34:19.000Z","size":51,"stargazers_count":37,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T07:18:42.668Z","etag":null,"topics":["dsl","parser","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/bindef","language":"Ruby","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/woodruffw.png","metadata":{"files":{"readme":"README.md","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":"2018-08-25T16:22:01.000Z","updated_at":"2024-01-03T14:15:57.000Z","dependencies_parsed_at":"2022-08-29T12:41:08.271Z","dependency_job_id":null,"html_url":"https://github.com/woodruffw/bindef","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fbindef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fbindef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fbindef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fbindef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woodruffw","download_url":"https://codeload.github.com/woodruffw/bindef/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248388154,"owners_count":21095350,"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":["dsl","parser","ruby"],"created_at":"2024-10-01T16:06:41.362Z","updated_at":"2025-04-16T05:56:08.352Z","avatar_url":"https://github.com/woodruffw.png","language":"Ruby","readme":"bindef\n========\n\n![license](https://raster.shields.io/badge/license-MIT%20with%20restrictions-green.png)\n[![Gem Version](https://badge.fury.io/rb/bindef.svg)](https://badge.fury.io/rb/bindef)\n[![Build Status](https://img.shields.io/github/workflow/status/woodruffw/bindef/CI/master)](https://github.com/woodruffw/bindef/actions?query=workflow%3ACI)\n[![Coverage Status](https://codecov.io/gh/woodruffw/bindef/branch/master/graph/badge.svg)](https://codecov.io/gh/woodruffw/bindef)\n[![Maintainability](https://api.codeclimate.com/v1/badges/bc780f5233688a8e5951/maintainability)](https://codeclimate.com/github/woodruffw/bindef/maintainability)\n\n`bindef` is a DSL and command-line tool for building binary files.\n\nIt's inspired by [t2b](https://github.com/thosakwe/t2b), but with a few crucial differences:\n\n* `bindef` scripts run within a Ruby process, making the DSL a strict superset of Ruby\n* Support for different (and multiple!) endians, string encodings, etc, is baked into the language\n* Reports common mistakes loudly as warnings (or errors, if severe enough)\n* Comes with a collection of user-selectable extensions for common binary formats (TLVs, control\ncodes, etc.)\n\n## Syntax\n\n`bindef`'s syntax is stream-oriented, with two primary expressions: commands and pragmas.\n\nCommands cause `bindef` to emit data, while pragmas influence *how* commands act.\n\nHere's a simple `bindef` script that emits a unsigned 32-bit integer twice, in different endians:\n\n```ruby\n# `bindef` starts in little-endian, so this is redundant\npragma endian: :little\n\nu32 0xFF000000\n\n# or `pragma :endian =\u003e :big`, if you prefer\npragma endian: :big\n\nu32 0xFF000000\n```\n\nThe [example directory](example/) has more. Read the [SYNTAX](SYNTAX.md) file for a\ncomplete listing of commands and pragmas.\n\n## Installation\n\n`bindef` is available via RubyGems:\n\n```bash\n$ gem install bindef\n$ bd -h\n```\n\nYou can also run it directly from this repository:\n\n```bash\n$ ruby -Ilib ./bin/bd -h\n```\n\n## Usage\n\nIn general, running a `bindef` script is as simple as:\n\n```bash\n$ bd \u003c path/to/input.bd \u003e path/to/output.bin\n```\n\nor:\n\n```bash\n$ bd -i path/to/input.bd -o /path/to/output.bin\n```\n\nYou can also choose to enable one or more *extra* command sets via the `-e`, `--extra` flag:\n\n```bash\n# extra commands for building TLVs\n$ bd -e tlv \u003c input.bd \u003e output.bin\n\n# extra commands for ASCII control codes and string manipulation\n$ bd -e ctrl,string \u003c input.bd \u003e output.bin\n```\n\n## Design goals\n\n`bindef` should...\n\n* ...have no runtime dependencies other than the current stable Ruby\n* ...be easy to read, even without knowledge of Ruby's syntax\n* ...be easy to write, even without knowledge of Ruby's syntax\n* ...be easy for other programs to emit without being (too) aware of Ruby's syntax\n* ...be easy to debug, with warnings and errors for common mistakes (overflows, negative\nunsigned integers, etc.)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoodruffw%2Fbindef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoodruffw%2Fbindef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoodruffw%2Fbindef/lists"}