• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / py-slang / 29745916326
86%

Build:
DEFAULT BRANCH: main
Ran 20 Jul 2026 01:35PM UTC
Jobs 1
Files 111
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Jul 2026 01:21PM UTC coverage: 86.632% (-0.3%) from 86.906%
29745916326

push

github

web-flow
py2js: compile-to-JavaScript evaluator for Python §1-4 (#282)

* Add py2js engine: compile-to-JavaScript evaluator for SICPy chapter 1

A fourth execution engine (alongside CSE, PVML and WASM) that compiles
the py-slang AST to JavaScript source and runs it natively, in the style
of js-slang's transpiler:

- src/engines/py2js/runtime.ts: unboxed value model (int=bigint,
  float=number, None=null, complex=PyComplexNumber objects); operator
  helpers mirror the CSE machine's chapter-1 semantics (same dispatch
  order, same §1 restrictions); tail-call markers + trampoline for
  proper tail calls; dual compilation support (def2/acall/callSync) so
  conductor modules can call user functions synchronously in hot loops
  while the program spine stays async-capable.
- src/engines/py2js/compiler.ts: AST-to-JS codegen, $-prefix identifier
  mangling, sync and dual modes; exec-style only (no last-expression
  value, matching Python semantics).
- src/engines/py2js/index.ts: runCodePy2Js/runCodePy2JsDual — parse,
  resolve with the chapter validators, compile, run; chapter 1 only.
- src/tests/operator-conformance-py2js.test.ts: table-driven operator
  conformance sweep (749 cases) over the docs/specs typing tables,
  pinned against a freshly computed CSE reference with print()-wrapped
  observation, mirroring the PVML-in-browser sweep.
- src/types/value-types.ts: extract context-free PyComplexNumber.divBy
  so py2js reuses the CPython-style division algorithm without a CSE
  Context.
- experiments/py2js/: the exploratory prototype, differential harness
  and benchmarks that motivated the design (CSE/PVML comparisons,
  dual-compilation sound-module measurements); not wired into the
  build or tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbExZBaxgeUL4oi1t7PG93

* Address #282 Gemini review: hypot for complex abs; guard non-finite math_floor; keep error kind in Py2JsRunError

- abs(complex) uses Math.... (continued)

4179 of 5196 branches covered (80.43%)

Branch coverage included in aggregate %.

854 of 1006 new or added lines in 8 files covered. (84.89%)

9035 of 10057 relevant lines covered (89.84%)

183357.32 hits per line

Uncovered Changes

Lines Coverage ∆ File
79
44.29
src/conductor/GenericDataHandler.ts
36
83.33
src/engines/py2js/runtime.ts
12
89.57
src/engines/py2js/compiler.ts
11
81.75
src/engines/py2js/moduleInterop.ts
8
85.53
src/engines/py2js/index.ts
4
92.5
src/engines/py2js/stdlibBridge.ts
2
90.91
src/conductor/Py2JsEvaluator.ts
Jobs
ID Job ID Ran Files Coverage
1 29745916326.1 20 Jul 2026 01:35PM UTC 111
86.63
GitHub Action Run
Source Files on build 29745916326
  • Tree
  • List 111
  • Changed 9
  • Source Changed 1
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #29745916326
  • 5acaa8fa on github
  • Prev Build on main (#29725861836)
  • Next Build on main (#29748626284)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc