Skip to main content

A custom programming language jxlang

Reason this release was yanked:

Significant Wrong

Project description

JxLang

A lightweight custom programming language designed for simplicity and interactive scripting. Built with Python, jxlang provides a REPL environment and supports basic programming constructs, including variables, loops, functions, and library imports.

Installation

Install jxlang via PyPI:

pip install jxlang

Features

  • Variable Declaration: Use let to declare variables.
  • Loops: for loops with range-based iteration.
  • Functions: Define functions with func and return values using out.
  • I/O Operations: enter() for input, say() for output.
  • Library Imports: Import Python libraries via cite.
  • List/Table Structures: Create lists ([1, 2, 3]) and tables (table(...)).
  • REPL Support: Interactive shell for quick testing.

Quick Examples

1. Variable Declaration and Printing

let x: 5
say(x + 3)  # Output: 8

2. Loop

for (i -> 1 && 5).for(
    say(i)
)
# Output: 1 2 3 4 5

3. Function Definition (Not open for users now)

func(a && b -> add):
    let a: 4
    let b: 5
    out __ + _  # '__'stands for last and last element, 
                # '_'stands for last element

say(add(3, 4))  # Output: 9

* This feature doesn't open for users because it has significant problem we have known. You can wait for next import update that we will have repaired.

4. Input and Output

let name: enter()  # User enters "Alice"
say("Hello, " + name)  # Output: Hello, Alice

5. Import a Python Library

cite math
say(math.sqrt(25))  # Output: 5.0
cite numpy
let a: numpy.array([1,2,3])
say(a)              # Output: [1,2,3]

* JxLang can calls Python Libraries only if you installed in your python environment.

6. List and Table

let lst: table(1, 2, 3)
say(lst[0])  # Output: 1
say(lst)     # Output: [1,2,3]
let tbl = table(1, 2; 3, 4)
say(tbl)     # Output: [[1, 2], [3, 4]]

* JxLang splits into n-plus-1-dimensional lists by n semicolons.

Using the REPL

Start the interactive environment by running:

jxlang

Example REPL session:

jxlang> say(42)
42
jxlang> endend(0)  # you can use numbers from 0 to 9 for endend()
Exiting with code 0

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.
For major changes, open an issue first to discuss your ideas.

License

This project is licensed under the Apache License.


Happy coding! 🚀

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

jxlang-0.1.6.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

jxlang-0.1.6-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file jxlang-0.1.6.tar.gz.

File metadata

  • Download URL: jxlang-0.1.6.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for jxlang-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7ab29907fa07fb9c085ecc1db1c86457a4d4d44aef7fdcf07a2793075416cdd6
MD5 7f55d978d81ff0b508f5077ea6144b6b
BLAKE2b-256 cc1ed90f654ee891e1987ddcb60d1b6e478f0c73f76505f197b177b2b369f431

See more details on using hashes here.

File details

Details for the file jxlang-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: jxlang-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for jxlang-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d7da82054a2023748f0380846365bd15a0f083230f9b30cfa09237466819ecc0
MD5 90e4dcb0bd03cff8f7646599f0c6401e
BLAKE2b-256 b9a6a27712eb744a7d6f8cf8a892c3bba943cc424d0726427b9a4ef9caba116d

See more details on using hashes here.

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