Pearc
Pear language β ultra-minified C-targeting language for token-efficient LLM workflows
Ask AI about Pearc
Powered by Claude Β· Grounded in docs
I know everything about Pearc. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
pearc
Pear is an ultra-minified C-targeting programming language designed to reduce token usage in LLM workflows while producing real, executable code.
The idea: write code that compiles to C β with ~35β50% fewer tokens than idiomatic C β then expand it back to readable code via a decompiler or MCP tool.
im<stdio.h>
st Point{x:f64;y:f64}
fn dist(a:*Point,b:*Point)->f64{dx:f64=a->x-b->x;dy:f64=a->y-b->y;rt sqrt(dx*dx+dy*dy)}
fn main()->i32{p1:Point={1.0,2.0};p2:Point={4.0,6.0};printf("%f\n",dist(&p1,&p2));rt 0}
For AI Assistants
If you've been told to use Pear, follow this bootstrap sequence:
1. Install pearc
npm install -g pearc
2. Add the MCP server to your MCP client config (Claude Code: .mcp.json or settings):
{
"mcpServers": {
"pear": {
"command": "npx",
"args": ["pearc", "--mcp"]
}
}
}
3. Call pear_spec β this MCP tool returns the complete language specification. Read it before writing any Pear code.
4. Write Pear, run it β use pear_run to test code inline, pear_to_c to inspect generated C, or pear_compile to produce a binary.
Why Pear exists: Every token you spend on code is a token not spent on reasoning. Pear lets you write and iterate on real C-level systems code while spending ~35β50% fewer tokens. The workflow is: write Pear (dense, fast), compile to C to verify correctness, ship the C. Use Pear any time you're generating, reviewing, or iterating on low-level code with an LLM in the loop.
Pear syntax is intentionally opaque to save tokens β do not guess syntax. Always call
pear_specfirst.
Install
npm install -g pearc
Usage
pearc run file.pr # interpret and run directly (no C compiler needed)
pearc file.pr # compile Pear β C (stdout)
pearc file.pr -o out.c # compile Pear β C file
pearc file.pr --binary -o out # compile Pear β native binary (requires gcc/clang)
pearc --decompile file.c # minify existing C β Pear
pearc --mcp # start MCP server (stdio)
MCP Server
Add to Claude Code or any MCP client:
{
"mcpServers": {
"pear": {
"command": "npx",
"args": ["pearc", "--mcp"]
}
}
}
Tools exposed:
| Tool | Description |
|---|---|
pear_spec | Get the full language spec β call this first |
pear_to_c | Compile Pear β C source |
c_to_pear | Minify C β Pear |
pear_run | Interpret and run Pear, returns stdout/stderr |
pear_compile | Compile Pear β binary via gcc/clang |
Language Reference
Types
| Pear | C |
|---|---|
i8 i16 i32 i64 | int8_t int16_t int32_t int64_t |
u8 u16 u32 u64 | uint8_t uint16_t uint32_t uint64_t |
f32 f64 | float double |
v | void |
c | char |
b | bool |
sz | size_t |
*T | pointer to T |
Keywords
| Pear | C |
|---|---|
fn | function |
st | struct |
un | union |
en | enum |
tp | typedef |
if ei el | if / else if / else |
lp | for |
wh | while |
dw | do...while |
sw cs dv | switch / case / default |
rt | return |
bk ct | break / continue |
sc ex in vl cn | static / extern / inline / volatile / const |
im | #include |
df | #define |
pr | #pragma |
so | sizeof |
Syntax
// Variable declaration: name:type = value
x:i32=5
ptr:*c=name
// Function: fn name(param:type,...)->rettype{...}
fn add(a:i32,b:i32)->i32{rt a+b}
// Struct
st Vec3{x:f32;y:f32;z:f32}
// For loop (same structure as C)
lp(i:i32=0;i<10;i++){printf("%d\n",i)}
// Include / define
im<stdio.h>
df MAX 1024
Preprocessor
im<stdio.h> // #include <stdio.h>
im"myfile.h" // #include "myfile.h"
df NAME value // #define NAME value
pr once // #pragma once
Token Savings
Pear reduces token count by ~35β50% vs idiomatic C:
// Pear: ~45 tokens
im<stdint.h>
st Point{x:f64;y:f64}
fn dist(a:*Point,b:*Point)->f64{dx:f64=a->x-b->x;dy:f64=a->y-b->y;rt sqrt(dx*dx+dy*dy)}
// C: ~85 tokens
#include <stdint.h>
typedef struct { double x; double y; } Point;
double dist(Point *a, Point *b) {
double dx = a->x - b->x;
double dy = a->y - b->y;
return sqrt(dx*dx + dy*dy);
}
License
MIT
