Building a programming language from scratch was never the plan. I just wanted to build AI apps without drowning in boilerplate.
But after the 50th time writing the same Python + Flask + OpenAI SDK + error handling + JSON parsing + auth middleware combo, I thought: **what if the AI was just... part of the language?**
That's how [NC](https://github.com/devheallabs-ai/nc) was born.
## What NC Looks Like
Here's a complete AI-powered REST API in NC:
nc
service "classifier"
version "1.0.0"
to classify with ticket:
ask AI to "classify this support ticket" using ticket
save as category
respond with category
api:
POST /classify runs classify
Run it:
bash
nc serve classifier.nc
That's a running HTTP server with AI inference. No imports. No API keys. No dependencies.
## The Problem I Was Trying to Solve
Every AI app I built looked the same:
python
The ceremony before you can do anything useful
import os
import json
from flask import Flask, request, jsonify
import openai
app = Flask(name)
client = openai.Client(api_key=os.environ.get("OPENAI_API_KEY"))
@app.route("/classify", methods=["POST"])
def classify():
try:
data = request.get_json()
ticket = data.get("ticket", "")
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": f"Classify this ticket: {ticket}"}]
)
result = response.choices[0].message.content
return jsonify({"category": result})
except Exception as e:
return jsonify({"error": str(e)}), 500
if name == "main":
app.run(port=5000)
25 lines for one AI call. And that's without rate limiting, retry logic, input validation, or auth. In NC, the same thing is 11 lines.
## What I Learned Building a Language
### 1. The C engine was the easy part
NC's engine is written in C11. The tokenizer, parser, AST, and bytecode compiler were straightforward — there's 50 years of knowledge about how to build compilers. We have 485 C unit tests and 113 language test files, all passing.
### 2. The built-in AI model was the hard part
NC ships with a 5M parameter decoder-only transformer and BPE tokenizer, embedded in the binary. Training it on a 549-file NC corpus to generate meaningful code completions and classifications — that was months of work. The final eval perplexity is 77.70.
### 3. Plain-English syntax is a design constraint, not just syntax sugar
When your syntax reads like English, every new feature has to "read right." You can't just add operators — you have to think about how a non-programmer would read the code out loud. This slowed us down but made the language more accessible.
### 4. Zero dependencies is a feature
NC is a single binary — 1.3 MB on macOS. No Python, no Node, no pip, no npm. Install in 30 seconds:
bash
curl -sSL https://nc.devheallabs.in/install.sh | bash
We've gotten more positive feedback about "it just works" than about any individual feature.
## The Stack NC Replaces
| What you need today | What NC gives you |
|---|---|
| Python + Flask + requests + dotenv | One `.nc` file |
| React + Next.js + npm | `nc ui compile app.ncui` |
| OpenAI SDK + API keys + error handling | `ask AI to "..." using data` |
| Docker + requirements.txt + Procfile | `nc serve app.nc` |
## NC UI — Frontends in Plain English
NC isn't just a backend language. NC UI lets you write frontends:
plaintext
page "Dashboard":
header "Sales Overview"
chart line using sales_data
table using recent_orders
This compiles to production HTML/CSS/JS with zero dependencies. No React. No Node.
## Try It
bash
Install
curl -sSL https://nc.devheallabs.in/install.sh | bash
Hello World
echo 'show "Hello from NC!"' > hello.nc
nc run hello.nc
Start an AI service
nc serve classifier.nc
## Links
- **GitHub**: [github.com/devheallabs-ai/nc](https://github.com/devheallabs-ai/nc) (Apache 2.0)
- **Documentation**: [nc.devheallabs.in](https://nc.devheallabs.in)
- **Website**: [devheallabs.in](https://devheallabs.in)
NC is open source under Apache 2.0. We'd love your feedback — issues, PRs, or just a star if you think the concept is interesting.
---
*Built by [DevHeal Labs AI](https://devheallabs.in) in Hyderabad, India.*
Top comments (0)