Inside the compiler.

Porffor owns the route from JavaScript text to a small native program. Understanding that route explains both the wins and the hard limits.

Follow the transformation

Parse

A hand-written parser accepts JavaScript and TypeScript and produces an internal syntax tree.

Resolve

Bindings, scopes, hoisting, closure captures, and opportunities for machine-number representation are determined.

Lower

The program becomes typed Porffor IR. Inspect all functions with -f, or one with -f=name.

Render

IR, selected built-ins, the value model, and garbage collector become a self-contained C translation unit.

Optimize and link

A standard C compiler performs machine-specific optimization and emits the final executable.

Values can shed their boxes

General JavaScript values travel in a compact tagged representation. When analysis proves a local value is numeric, Porffor can keep it as a plain machine number instead. That avoids repeated tagging work in hot code while preserving dynamic semantics at boundaries.

Why TypeScript helps

A type annotation can give analysis a useful hint, but it is never a promise the compiler should trust in place of runtime semantics.

The runtime is selected, not embedded whole

Much of the standard library is written in TypeScript and compiled by Porffor. A build pulls in the built-ins the program reaches, along with the core value and memory machinery. This is why small inputs can become small artifacts without packaging a general-purpose engine.

Memory

Heap allocations are managed by Porffor's garbage collector. Release builds keep it on. --no-gc is an investigative control that prevents reclamation; it is not a general performance recommendation.

Stop at C when the platform demands it

The C form is a useful handoff to cross-compilers, console SDKs, and build systems that already speak C.

terminal
$ porf c app.js app.c
$ cc app.c -O2 -lm -o app

The generated file expects a hosted C environment, including allocation and standard I/O. Programs using threads also need the platform's thread linkage.

Server variant

HTTP output is a CMake package rather than one C file because it includes a C++ bridge and uWebSockets sources.

Correctness is measured, not declared

Porffor runs Test262, the official ECMAScript conformance suite, continuously. A pass rate is evidence of broad language coverage—not evidence that a particular host API or dependency works. Verify your own program at its real boundary.