porffor README

The project's README from github.com/CanadaHonk/porffor. As one markdown file: README.md.

Porffor  (poor-for)

An ahead-of-time JavaScript compiler

curl -fsSL https://porffor.dev/install.sh | sh

$ cat hello.js
console.log('hello world!');
$ porf hello.js -o hello
[105ms] compiled hello.js -> hello (33.7KB)
$ ./hello
hello world!

Porffor is a 100% AOT compiled JS engine/runtime. There is nothing interpreted or compiled just-in-time. Porffor compiles JS to C (with an IR inbetween). We chose this approach because:

Versioning

Porffor releases use a single increasing release number. Releases are automatically published every git push after CI testing.

Name

purple in Welsh is porffor. Why purple?

porffor (CanadaHonk/porffor)

Searching Database…

5.3K ·GitHub
这是什么?Porffor 是一个提前编译(AOT)的 JavaScript 编译器:一个 100% 提前编译的 JS 引擎和运行时。它不会对代码做任何解释或即时(JIT)编译。
这和 V8 这类常见的 JavaScript 引擎有什么不同?常见的引擎在代码运行时进行解释或 JIT 编译;而 Porffor 会把你的整个 JS 程序提前编译成 C 语言(中间会经过一层 IR),生成的 C 代码像普通程序一样构建。
我怎么安装它并编译我的第一个脚本?README 里没有提供安装命令;每次 git push 通过 CI 后都会自动发布新版本,去项目的 GitHub releases 页面获取最新版本即可。
我需要 LLVM、Node 或其他重型工具吗?不需要 LLVM 也不需要 Cranelift——避免直接依赖这类后端正是该项目明确的设计目标。它的输出是纯 C 代码,只需要常规的 C 工具链就能为你的目标平台编译。
它足够稳定,能用在真正的项目里吗?它更新很快:版本号就是一个不断递增的发布序号,每次通过 CI 的代码推送都会产生一个新版本,所以别指望有固定的稳定版本线,要做好频繁变动的准备。
编译出来的产物能在哪些地方运行?Porffor 输出的是 C 代码,所以编译产物基本上在任何能编译 C 的地方都能运行,而且生成的代码在编译后也很容易修改,以适配各种不同的环境。
为什么叫 Porffor?'Porffor' 在威尔士语里是紫色。作者选这个名字是因为目前还没有别的 JS 引擎是紫色的,紫色确实很酷,而且据说紫色代表雄心——正如 README 所说,这很符合这个项目。
Porffor 本身是用什么写的?主要是 JavaScript:GitHub 上把 JavaScript 列为该项目的主要语言,同时也用到了 C——对于一个输出是 C 的编译器来说,这很合适。
What are similar projects?CalcKernel, gcc, scriptc, mquickjs, ir, Singeli, raddebugger, rust
Creator
CanadaHonk
Size
40.9 MB
Stars
5.3K
Age
3y
Commits · 90 Days