All Projects → eatonphil → Jsc

eatonphil / Jsc

A JavaScript compiler written in TypeScript targeting C++/V8

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
cpp
1120 projects

Labels

Projects that are alternatives of or similar to Jsc

Cef4delphi
CEF4Delphi is an open source project to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows, Linux and MacOS.
Stars: ✭ 785 (+481.48%)
Mutual labels:  v8
Puerts
Write your game with TypeScript in UE4 or Unity. Puerts can be read as pu-erh TS(普洱TS)
Stars: ✭ 1,139 (+743.7%)
Mutual labels:  v8
V8js
V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
Stars: ✭ 1,659 (+1128.89%)
Mutual labels:  v8
Monomorphist
monomorphist - a JavaScript performance companion
Stars: ✭ 30 (-77.78%)
Mutual labels:  v8
V8 Source Read
V8 探秘
Stars: ✭ 43 (-68.15%)
Mutual labels:  v8
V8go
Execute JavaScript from Go
Stars: ✭ 1,205 (+792.59%)
Mutual labels:  v8
V8.dev
The source code of v8.dev, the official website of the V8 project.
Stars: ✭ 567 (+320%)
Mutual labels:  v8
Rusty v8
V8 javascript bindings for Rust
Stars: ✭ 2,022 (+1397.78%)
Mutual labels:  v8
V8 Javascript Memory
V8 JavaScript 内存占用分析
Stars: ✭ 46 (-65.93%)
Mutual labels:  v8
Bacardi
Bacardi project is an effort to provide multi-language binding for Node.js native layer.
Stars: ✭ 115 (-14.81%)
Mutual labels:  v8
V8 Cffi
Embed the V8 Javascript Interpreter into Python
Stars: ✭ 31 (-77.04%)
Mutual labels:  v8
Bytenode
A minimalist bytecode compiler for Node.js
Stars: ✭ 1,012 (+649.63%)
Mutual labels:  v8
Profiling Nodejs
🌌 Collection of articles and tools to efficiently profile Node.js
Stars: ✭ 93 (-31.11%)
Mutual labels:  v8
V8 Bailout Reasons
🔧 A list of Crankshaft bailout reasons with examples
Stars: ✭ 861 (+537.78%)
Mutual labels:  v8
Learn Javascript
《前端基础漫游指南》深入的、系统的学习 javascript 基础,喜欢点 Star
Stars: ✭ 128 (-5.19%)
Mutual labels:  v8
Liquidcore
Node.js virtual machine for Android and iOS
Stars: ✭ 765 (+466.67%)
Mutual labels:  v8
Deep Into Code
Node.js / Libuv / V8 引擎源代码学习笔记
Stars: ✭ 66 (-51.11%)
Mutual labels:  v8
V8dotnet
A fairly non-abstracted wrapper for Google's V8 JavaScript engine.
Stars: ✭ 133 (-1.48%)
Mutual labels:  v8
Llvm Node
Node LLVM 4.0+ Bindings
Stars: ✭ 127 (-5.93%)
Mutual labels:  v8
Flamebearer
Blazing fast flame graph tool for V8 and Node 🔥
Stars: ✭ 1,485 (+1000%)
Mutual labels:  v8

Javascript compiler targeting C++/V8

Building

Requires Node.

$ yarn

Example

$ yarn tsc
$ node build/jsc.js tests/tco.js
$ node bin/index.js
12586269025

Features

  • Functions and function calls
    • Basic tail-call optimization
  • Var, const, let declarations
  • For, do, while statements
  • Basic primitive operations
  • Basic import support
  • Number, string, boolean and null literals
  • Basic value unboxing

Not (yet) supported

  • Prototype functions
  • Nested functions
  • Closures
  • And much, much more!

Code produced

The following:

function fib(n: number, a: number, b: number) {
    if (n == 0) {
        return a;
    }

    if (n == 1) {
        return b;
    }

    return fib(n - 1, b, a + b);
}

Gets compiled to:

void tco_fib(const FunctionCallbackInfo<Value> &args) {
  Isolate *isolate = args.GetIsolate();
  double tco_n = toNumber(args[0]);
  double tco_a = toNumber(args[1]);
  double tco_b = toNumber(args[2]);

tail_recurse_1:

    ;

  bool sym_if_test_58 = (tco_n == 0);
  if (sym_if_test_58) {
    args.GetReturnValue().Set(Number::New(isolate, tco_a));
    return;
  }

  bool sym_if_test_70 = (tco_n == 1);
  if (sym_if_test_70) {
    args.GetReturnValue().Set(Number::New(isolate, tco_b));
    return;
  }

  Local<Value> sym_arg_83 = Number::New(isolate, (tco_n - 1));
  Local<Value> sym_arg_92 = Number::New(isolate, (tco_a + tco_b));
  tco_n = toNumber(sym_arg_83);
  tco_a = tco_b;
  tco_b = toNumber(sym_arg_92);
  goto tail_recurse_1;
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].