Skip to main content

A custom programming language jxlang

Reason this release was yanked:

正常优化

Project description

JxLang 0.2.1

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

Update Content

  • New support for single line notes.
  • Optimized partial code structure.
  • Solve some known minor problems.

Features

  • Single-Line Comments: # stands for single-line comments.
  • 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 (table(...)).
  • Exit Session: endend() for exiting current session.
  • REPL Support: Interactive shell for quick testing.

Quick Examples

1. Variable Declaration and Printing

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

2. Loop

(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.2.1.tar.gz (14.9 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.2.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jxlang-0.2.1.tar.gz
Algorithm Hash digest
SHA256 15b56bc1317430c32bb3d8e3e8971ade972fde98a48eaeb873ddc9782c403adb
MD5 8a949d3a3361a31d3e783545766a9c5d
BLAKE2b-256 1e5210712f898d7f140075947ed25f84d09cbc1c8beb75b6134706fede8d48f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jxlang-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb86e01cc4da7116826538b19e275850ed4af6816b60348077b64520339c29d3
MD5 eb485db7f855f418da70cb984996f668
BLAKE2b-256 8e6b27ce0c4b96685752268aa8d8804853d1924775a98a4c267b35f8a18fb51b

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