v12 — Now with bytecode VM + computed goto

Write Code.
Build Web Pages.

A unique programming language with its own syntax, a built-in HTTP server, and everything you need to build real web applications. No npm. No packages. Just code.

168x
Faster than v1
40+
Built-in functions
186
Tests passing
1
Single binary
server.pt
let page = readFile("index.html");

httpListen(3000, (req) => {
  if (req.path is "/") {
    return page;
  }
  return "404";
});
Bytecode VM Computed Goto HTTP Server Pattern Matching Classes & OOP Closures SQLite JSON Crypto Concurrency Bytecode VM Computed Goto HTTP Server Pattern Matching Classes & OOP Closures SQLite JSON Crypto Concurrency

Why PT?

Everything you need, nothing you don't.

PT

Unique Syntax

No more print() — use show(). No == — use is. unless instead of if not. PT has its own identity that reads like English.

VM

Bytecode VM

Register-based bytecode with computed goto dispatch. 168x faster than v1.

01

Zero Setup

Single binary. No packages, no npm, no build step. Just ./pt server.pt.

:3000

Built-in HTTP Server

One line to start a web server. httpListen(3000, handler) and you're live. Route matching, request/response objects included.

GET

HTTP Client

httpGet, httpPost, httpPut, httpDelete built-in. Call any API without external libraries.

R/W

File I/O

Read and write files with readFile() and writeFile(). Check existence with fileExists().

=>

Pattern Matching

Powerful match expressions with => syntax for clean, readable branching. Wildcards, guards, destructuring.

class

Classes & OOP

Full OOP with classes, inheritance, this, super, static methods, constructors, and method overriding. Encapsulation done right.

SQL

SQLite Built-in

sqliteOpen, sqliteQuery, sqliteExec — database access without any drivers. Zero configuration.

sha

Crypto

hash(), base64Encode(), base64Decode(), uuid() built-in. No external deps.

thr

Concurrency

spawn() runs functions in background threads. sleep() for timing. Non-blocking by design.

( )

Closures

Functions capture their enclosing scope. Lexical scoping with mutable state. First-class functions.

Syntax Comparison

See how PT compares to other languages.

PT

hello.pt
let name = "World";

unless name is "" {
  show("Hello, " + name + "!");
}

let nums = [1, 2, 3, 4, 5];
let big = nums.filter((x) => x > 3);
show(big);  // [4, 5]

Python

hello.py
name = "World"

if name != "":
  print(f"Hello, {name}!")

nums = [1, 2, 3, 4, 5]
big = [x for x in nums if x > 3]
print(big)  # [4, 5]

Try PT Now

Install PT and build your own web server in 10 lines.

1. Install

git clone the repo and make

2. Create server.pt

Write your routes with httpListen

3. Run

./pt server.pt — live at localhost:3000

Quick Example

server.pt
let page = readFile("index.html");

httpListen(3000, (req) => {
  if (req.path is "/") {
    return page;
  }
  if (req.path is "/api/hello") {
    return "{message: Hello!}";
  }
  return {status: 404, body: "Not Found"};
});

Build With PT

Start building in seconds. Pick a template and start coding.

Blog
My Blog
Getting Started with PT
2024-01-15
Building Web Servers
2024-01-20
PT vs JavaScript
2024-02-01

Blog

Markdown posts, tags, RSS feed

View Source →
Portfolio
Phyo Thant
Building PT Language

Portfolio

Project gallery, contact form

View Source →
Todo App
Todo List
Buy groceries
Write docs
Deploy app

Todo App

JSON API, categories, priorities

View Source →
REST API
GET /api/users
200 OK · 12ms
{
"id": 1, "name": "Alice"
"id": 2, "name": "Bob"
}

REST API

Routes, middleware, error handling

View Source →
Chat
Hey everyone!
Welcome to PT chat
This is cool!

Chat Server

Rooms, usernames, message history

View Source →
Dashboard
1,234
Users
$56K
Revenue
Alice — $99.99 — shipped
Bob — $149.50 — pending

Dashboard

Charts, tables, user management

View Source →

Performance

PT includes a bytecode VM with optimizations. Here's how it compares:

Recursive Fibonacci

0.169s
vs Python 0.052s
Ruby 0.049s

Loop 10M iterations

0.416s
49x faster than v1
Faster than Python!

Array 100K items

0.016s
35x faster than v1

String 100K

0.004s
158x faster than v1
31.8x faster than Python!

Full benchmarks: bench/COMPARISON.md