Skip to content

Deecellar/bottom-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bottom-Zig

A complete implementation of the Bottom Spec in Zig with both encoding and decoding capabilities.

Features

  • Bottom format encoding/decoding
  • CLI interface compatible with bottom-rs options
  • Static and shared library support
  • WebAssembly build target
  • C API bindings
  • Configurable allocators when targeting zig

Upcoming Features

  • Speed improvements

Build Options

# Basic build
zig build

# Build with C API with main
zig build -Duse_c=true  
# or
zig build run -Duse_c=true -- [bottom zig options]

# Run tests
zig build test-exe    # CLI tests
zig build test-lib    # Library tests 

# Install library only
zig build install-lib

# Build WebAssembly
zig build wasm-shared

# Build benchmarks
zig build benchmark
# Run benchmarks
zig build run-benchmark 

Usage

As a dependency in your build.zig.zon via zig fetch. use the standard way of adding a module to your project.

Bottom CLI Usage

# Encode
bottom-zig 
--bottomify "Hello World"     # πŸ«‚πŸ’–βœ¨βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨πŸ«‚πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,,πŸ‘‰πŸ‘ˆβœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨πŸ‘‰πŸ‘ˆ

# Decode
bottom-zig --regress "πŸ«‚πŸ’–βœ¨βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨πŸ«‚πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,,πŸ‘‰πŸ‘ˆβœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–βœ¨βœ¨βœ¨πŸ‘‰πŸ‘ˆ"    # Hello World

# Use with files
bottom-zig --bottomify -i input.txt -o output.txt
bottom-zig --regress -i output.txt

C API Usage

See include/bottom.h for the API definition.

For an example of how to use the C API, see src/example.c.

Online Demo

Try it in WebAssembly: https://deecellar.github.io/bottom-zig/

Binaries

Pre-built binaries for Linux, macOS and Windows (x86_64) are available in CI artifacts.

License

MIT License

Thanks to

  • Andrew for making an awesome language
  • MasterQ32 for making zig args and being awesome
  • der-teufel-programming for saying I should do this
  • =3

About

πŸ₯Ί

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published