Skip to main content

J# language: lexer -> parser -> AST -> bytecode -> VM

Project description

J# (J-sharp)

J# is a language project with a real execution pipeline:

source (.jsh) -> lexer -> parser -> AST -> bytecode -> VM

J# programs are not executed with Python eval/exec, and the runtime does not transpile J# source to Python/JS for execution.

Install

cd jsharp
python -m pip install -e .

If install is not available in your environment:

python jsh.py run examples/hello.jsh

Quick Start

Hello

python jsh.py run examples/hello.jsh

Web demo

python jsh.py run examples/web.jsh

Then open http://localhost:8080.

Dump and debug

python jsh.py dump examples/hello.jsh
python jsh.py run --debug examples/hello.jsh

CLI

  • python jsh.py run <file.jsh>
  • python jsh.py run --debug <file.jsh>
  • python jsh.py run --native <file.jsh>
  • python jsh.py dump <file.jsh>
  • python jsh.py build <file.jsh> -o out.jbc

If installed as a package, jsh is available as a console script.

Architecture (text diagram)

.jsh source
   |
   v
 Lexer  -> token stream
   |
   v
 Parser -> AST
   |
   v
 Compiler -> bytecode chunks (per function)
   |
   v
 VM (stack + frames + globals)

Current Feature Set (v0.1)

  • Function declarations and function literals
  • let, assignment, if/else, while, break, continue, return
  • Numbers, strings, bools, none
  • Lists ([1,2,3]), indexing (a[i]), indexed assignment (a[i] = x)
  • Calls, attribute access, short-circuit && / ||
  • Stdlib objects: http, io, fs, json
  • Builtins: print, len, div

Competitive Programming

Use the io module for fast buffered input/output.

  • examples/cp_sum.jsh
  • examples/cp_minmax.jsh
  • examples/cp_prefix_sum.jsh
  • Full guide: docs/cp-guide.md

Native Runtime Path

  • python jsh.py build file.jsh -o file.jbc emits serialized bytecode.
  • python jsh.py run --native file.jsh compiles to temp .jbc and executes jsh-native when available.
  • If jsh-native is unavailable, CLI prints guidance and falls back to Python VM execution.
  • Bytecode format spec: docs/bytecode-spec.md

Roadmap Summary

Near-term goals:

  • expand stdlib and diagnostics,
  • strengthen Python/native runtime compatibility tests,
  • keep web demo smooth in Python VM path,
  • improve performance with targeted compiler/VM optimizations.

Detailed plans: docs/roadmap.md.

Project Docs

  • LANGUAGE_REFERENCE.md
  • docs/getting-started.md
  • docs/standard-library.md
  • docs/internals.md
  • docs/cp-guide.md
  • docs/bytecode-spec.md
  • docs/roadmap.md

Limitations (current)

  • Closures/captures are intentionally disabled in v0.1 function literals.
  • Native VM path is focused on CP/runtime core; Python VM remains the primary path for full web demo behavior.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsharp-0.1.0.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsharp-0.1.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file jsharp-0.1.0.tar.gz.

File metadata

  • Download URL: jsharp-0.1.0.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsharp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 490ee42aaec5edb0200d54c3daa2814c8c6760c83738dc9a573c44629ddbe2ff
MD5 96bcaa7c7a189decb744774d63ae2980
BLAKE2b-256 cd5b3d74c3d45f87f224b2700874fd9b1e27306172f36c42bb8c056e03e481ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsharp-0.1.0.tar.gz:

Publisher: release-pypi.yml on JashMeep/JSharp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsharp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jsharp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsharp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86702346c7992ce0c879fa7986d49cd9c160c0d1fdcec27a9b3dcc1091a38156
MD5 b1ad856684fa0055d0b9708bf62e3ec5
BLAKE2b-256 b370269fd35de3f43c70f3f9c615d3162ea6bd18fd007db93e357c863acbb1d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsharp-0.1.0-py3-none-any.whl:

Publisher: release-pypi.yml on JashMeep/JSharp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page