Skip to main content

Overview

GLYPH is available for 5 languages: Python, JavaScript/TypeScript, Go, Rust, and C. Choose your language below for installation instructions.
All implementations provide the same core functionality: parsing, emitting, JSON conversion, and fingerprinting.

Python

Requirements

  • Python 3.8 or higher
  • pip (Python package manager)

Install

pip install glyph-serial

Verify Installation

import glyph

# Check version
print(f"GLYPH version: {glyph.__version__}")

# Test basic functionality
data = {"test": "success", "active": True}
text = glyph.json_to_glyph(data)
print(f"GLYPH output: {text}")
# Expected: {active=t test=success}

restored = glyph.glyph_to_json(text)
assert restored == data
print("✓ Installation verified")

Available Functions

import glyph

# JSON conversion
glyph.json_to_glyph(data)      # Python → GLYPH
glyph.glyph_to_json(text)      # GLYPH → Python

# Parsing and emitting
glyph.parse(text)               # Parse GLYPH text
glyph.emit(value)               # Emit GLYPH text

# Fingerprinting
glyph.fingerprint_loose(data)   # SHA-256 hash
glyph.equal_loose(a, b)         # Semantic equality

JavaScript / TypeScript

Requirements

  • Node.js 16 or higher
  • npm or yarn

Install

npm install glyph-js

Verify Installation

import { ... } from 'glyph-js';

// Test basic functionality
const data = { test: 'success', active: true };
const text = emit(fromJSON(data));
console.log(`GLYPH output: ${text}`);
// Expected: {active=t test=success}

const value = parse(text);
const restored = toJSON(value);
console.log('✓ Installation verified');

Available Functions

import { ... } from 'glyph-js';

// JSON conversion
const gv = fromJSON(data);      // JS → GValue
const obj = toJSON(gv);         // GValue → JS

// Parsing and emitting
const value = parse(text);      // Parse GLYPH text
const text = emit(value);       // Emit GLYPH text

TypeScript Support

GLYPH-JS includes full TypeScript definitions:
import { ... } from 'glyph-js';

const value: GValue = parse('{name=Alice age=30}');
const name: string | undefined = value.get('name');

Go

Requirements

  • Go 1.19 or higher

Install

go get github.com/Neumenon/glyph

Verify Installation

Create test.go:
package main

import (
    "fmt"
    "log"
    "github.com/Neumenon/glyph/glyph"
)

func main() {
    // Test basic functionality
    text := `{test=success active=t}`
    val, err := glyph.Parse([]byte(text))
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Printf("Parsed value: %v\n", val)
    
    // Convert to JSON
    data, err := glyph.ToJSONLoose(val)
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Printf("JSON: %v\n", data)
    fmt.Println("✓ Installation verified")
}
Run:
go run test.go

Available Functions

import "github.com/Neumenon/glyph/glyph"

// Parse GLYPH text
val, err := glyph.Parse([]byte(text))

// Emit GLYPH text
text := glyph.CanonicalizeLoose(val)

Rust

Requirements

  • Rust 1.70 or higher
  • Cargo (Rust package manager)

Install

Add to your Cargo.toml:
[dependencies]
glyph-codec = "0.1"
Or use cargo:
cargo add glyph-codec

Verify Installation

Create src/main.rs:
use glyph_codec::{from_json, to_json, canonicalize_loose};
use serde_json::json;

fn main() {
    // Test basic functionality
    let data = json!({
        "test": "success",
        "active": true
    });
    
    let gvalue = from_json(&data);
    let glyph = canonicalize_loose(&gvalue);
    println!("GLYPH output: {}", glyph);
    // Expected: {active=t test=success}
    
    let restored = to_json(&gvalue);
    assert_eq!(restored, data);
    println!("✓ Installation verified");
}
Run:
cargo run

Available Functions

use glyph_codec::{from_json, to_json, canonicalize_loose};
use serde_json::json;

// JSON → GLYPH
let data = json!({"action": "search"});
let gvalue = from_json(&data);
let glyph = canonicalize_loose(&gvalue);

// GLYPH → JSON
let json = to_json(&gvalue);

C

Requirements

  • GCC or Clang
  • Make
  • Standard C library

Install

1

Clone Repository

git clone https://github.com/Neumenon/glyph.git
cd glyph/c/glyph-codec
2

Build Library

make
This creates:
  • build/libglyph.a (static library)
  • build/libglyph.so (shared library)
3

Run Tests

make test

Verify Installation

Create test.c:
#include "glyph.h"
#include <stdio.h>
#include <assert.h>

int main() {
    // Test basic functionality
    glyph_value_t *v = glyph_from_json(
        "{\"test\": \"success\", \"active\": true}"
    );
    
    char *glyph = glyph_canonicalize_loose(v);
    printf("GLYPH output: %s\n", glyph);
    // Expected: {active=t test=success}
    
    // Convert back to JSON
    char *json = glyph_to_json(v);
    printf("JSON: %s\n", json);
    
    // Cleanup
    glyph_free(glyph);
    glyph_free(json);
    glyph_value_free(v);
    
    printf("✓ Installation verified\n");
    return 0;
}
Compile and run:
gcc -I./include test.c -L./build -lglyph -lm -o test
./test

Available Functions

#include "glyph.h"

// JSON → GLYPH
glyph_value_t *v = glyph_from_json(
    "{\"action\": \"search\"}"
);
char *glyph = glyph_canonicalize_loose(v);

// GLYPH → JSON
char *json = glyph_to_json(v);

// Cleanup
glyph_free(glyph);
glyph_free(json);
glyph_value_free(v);
Memory Management: Always free strings returned by GLYPH functions using glyph_free(), and free values using glyph_value_free().

Platform Notes

Linux

All implementations work out of the box on Linux.

macOS

  • Python, JavaScript, Go, Rust: Work natively
  • C: May need Xcode Command Line Tools:
    xcode-select --install
    

Windows

  • Python, JavaScript: Work with standard installers
  • Go, Rust: Work with official Windows installers
  • C: Requires MinGW or Visual Studio:
    # Using MinGW
    mingw32-make
    

Development Setup

Running Tests

cd py
python -m pytest tests/ -v

Building from Source

# Clone repository
git clone https://github.com/Neumenon/glyph.git
cd glyph

# Choose your language directory
cd py    # or js, go, rust, c/glyph-codec

# Follow language-specific build instructions

Troubleshooting

Make sure you installed from the correct environment:
python -m pip install glyph-serial

# Verify
python -c "import glyph; print(glyph.__version__)"
Check your package.json has the dependency:
npm list glyph-js

# Reinstall if needed
npm install glyph-js
Make sure your go.mod is set up:
go mod init your-project
go get github.com/Neumenon/glyph
Ensure you have build tools:
# Ubuntu/Debian
sudo apt-get install build-essential

# macOS
xcode-select --install

# Check GCC
gcc --version
For optimal performance:
  • Python: Use PyPy for 2-5x speedup
  • JavaScript: Use Node.js 18+ with JIT optimizations
  • Go/Rust/C: Already optimized, compile with -O3 for C

Next Steps

Now that you have GLYPH installed:

Quickstart Guide

Get working code in 5 minutes

API Reference

Complete API documentation

Agent Patterns

Tool calling and state management

Cookbook

10 practical recipes

Get Help

Build docs developers (and LLMs) love